InstradaOGM for postgres db
2.2K
Quick Start Guide for deploying InstradaOGM with PostgreSQL database using Docker
š GitHubā | š View SQLite Guideā
rdeangel/instrada-ogm-postgreslatest, X.X.X (specific versions)Choose the deployment method that fits your environment:
Simple setup without SSL certificates - ideal for local networks or testing.
Production-ready setup with automatic SSL certificates via Let's Encrypt.
mkdir instrada-ogm && cd instrada-ogm
curl -o docker-compose.yml https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/docker-compose.yml
Create a .env file with the following configuration:
# =============================================================================
# InstradaOGM - PostgreSQL HTTP Deployment Configuration
# =============================================================================
# --- Application Version ---
NEXT_PUBLIC_APP_VERSION=latest
# --- OPNsense Configuration (REQUIRED) ---
OPNSENSE_URL=https://your-opnsense-firewall.local
OPNSENSE_API_KEY=your_api_key_here
OPNSENSE_API_SECRET=your_api_secret_here
# For self-signed certificates (development only)
SKIP_SSL_VERIFICATION=true
# --- HTTP Configuration ---
ALLOW_HTTP=true
NEXTAUTH_URL=http://localhost:3000
PORT=3000
# --- Database Configuration (PostgreSQL) ---
POSTGRES_USER=instrada-ogm-user
POSTGRES_PASSWORD=CHANGE_THIS_TO_SECURE_PASSWORD
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=instrada-ogm
# PostgreSQL connection string (auto-generated from above values)
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public
# --- Security Configuration (REQUIRED) ---
# Generate with: openssl rand -base64 32
NEXTAUTH_SECRET=CHANGE_THIS_TO_A_SECURE_RANDOM_STRING
# Generate with: openssl rand -hex 32
BACKUP_ENCRYPTION_SECRET_KEY=CHANGE_THIS_TO_A_64_CHARACTER_HEX_STRING
# --- Authentication ---
AUTH_ALLOW_LOCAL_LOGIN=true
AUTH_ALLOW_LOCAL_2FA=true
AUTH_PASSWORD_MIN_LENGTH=8
# --- Logging ---
APP_DEBUG_LEVEL=ERROR
NODE_ENV=production
mkdir -p data/backups
Option A: Using the automated setup script (recommended)
# Download the permission setup script
curl -o setup-data-permissions.sh https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/setup-data-permissions.sh
chmod +x setup-data-permissions.sh
# Run the script to set correct permissions
sudo ./setup-data-permissions.sh ./data
Option B: Manual permission setup
# Set correct ownership for the application user (UID 65532)
sudo chown -R 65532:65532 data/
docker compose --profile postgres up -d
# Watch the logs until database is ready
docker compose --profile postgres logs -f db
# You should see: "database system is ready to accept connections"
Open your browser and navigate to:
http://192.168.1.100:3000 (replace with your server's IP address)Default Login Credentials:
adminadminā ļø Important: You will be required to change the admin password on first login for security.
http://192.168.1.100:3000 (replace with your server's IP)mkdir instrada-ogm && cd instrada-ogm
# Download Traefik compose file
curl -o docker-compose-traefik.yml https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/docker-compose-traefik.yml
# Download Traefik configuration scripts
mkdir -p traefik
cd traefik
curl -o generate-config.sh https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/traefik/generate-config.sh
curl -o validate.sh https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/traefik/validate.sh
chmod +x generate-config.sh validate.sh
cd ..
Create a .env file in the root directory:
# =============================================================================
# InstradaOGM - PostgreSQL HTTPS Deployment Configuration
# =============================================================================
# --- Domain Configuration (REQUIRED for Traefik) ---
DOMAIN=your-instrada-ogm.com
# --- Application Version ---
NEXT_PUBLIC_APP_VERSION=latest
# --- OPNsense Configuration (REQUIRED) ---
OPNSENSE_URL=https://your-opnsense-firewall.local
OPNSENSE_API_KEY=your_api_key_here
OPNSENSE_API_SECRET=your_api_secret_here
# For self-signed certificates
SKIP_SSL_VERIFICATION=true
# --- HTTPS Configuration ---
ALLOW_HTTP=false
NEXTAUTH_URL=https://your-instrada-ogm.com
PORT=3000
# --- Database Configuration (PostgreSQL) ---
POSTGRES_USER=instrada-ogm-user # this can be any valid username
POSTGRES_PASSWORD=CHANGE_THIS_TO_SECURE_PASSWORD # this can be any valid password
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=instrada-ogm
# PostgreSQL connection string (auto-generated from above values)
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public
# --- Security Configuration (REQUIRED) ---
# Generate with: openssl rand -base64 32
NEXTAUTH_SECRET=CHANGE_THIS_TO_A_SECURE_RANDOM_STRING
# Generate with: openssl rand -hex 32
BACKUP_ENCRYPTION_SECRET_KEY=CHANGE_THIS_TO_A_64_CHARACTER_HEX_STRING
# --- Authentication ---
AUTH_ALLOW_LOCAL_LOGIN=true
AUTH_ALLOW_LOCAL_2FA=true
AUTH_PASSWORD_MIN_LENGTH=8
# --- Logging ---
APP_DEBUG_LEVEL=ERROR
NODE_ENV=production
cd traefik
./generate-config.sh
Edit traefik/runtime/.env.traefik:
# Must match DOMAIN in main .env file
DOMAIN=your-instrada-ogm.com
# DNS Provider (cloudflare, route53, digitalocean, etc.)
DNS_PROVIDER=cloudflare
# DNS Provider Credentials (example for Cloudflare)
CLOUDFLARE_DNS_API_TOKEN=your_cloudflare_api_token_here
# Let's Encrypt Configuration
[email protected]
# Use staging for testing, production for live certificates
ACME_SERVER=staging
Run the configuration generator again to apply settings:
./generate-config.sh
./validate.sh
cd ..
mkdir -p data/backups
Option A: Using the automated setup script (recommended)
# Download the permission setup script
curl -o setup-data-permissions.sh https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/setup-data-permissions.sh
chmod +x setup-data-permissions.sh
# Run the script to set correct permissions
sudo ./setup-data-permissions.sh ./data
Option B: Manual permission setup
# Set correct ownership for the application user (UID 65532)
sudo chown -R 65532:65532 data/
docker compose -f docker-compose-traefik.yml --profile postgres up -d
# Watch the logs until database is ready
docker compose -f docker-compose-traefik.yml --profile postgres logs -f db
# You should see: "database system is ready to accept connections"
https://your-instrada-ogm.comhttp://192.168.1.100:8080/dashboard/ (access from server only, disable in production)Default Login Credentials:
adminadminā ļø Important: You will be required to change the admin password on first login for security.
https://your-instrada-ogm.comOnce you verify everything works with staging certificates:
Edit traefik/runtime/.env.traefik and change:
ACME_SERVER=production
Regenerate configuration and restart:
cd traefik && ./generate-config.sh && cd ..
docker compose -f docker-compose-traefik.yml --profile postgres down
rm traefik/runtime/acme.json
docker compose -f docker-compose-traefik.yml --profile postgres up -d
# HTTP deployment - all services
docker compose --profile postgres logs -f
# HTTP deployment - application only
docker compose --profile postgres logs -f instrada-ogm-postgres
# HTTP deployment - database only
docker compose --profile postgres logs -f db
# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile postgres logs -f
# HTTP deployment
docker compose --profile postgres down
# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile postgres down
# HTTP deployment
docker compose --profile postgres pull
docker compose --profile postgres up -d
# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile postgres pull
docker compose -f docker-compose-traefik.yml --profile postgres up -d
# Create PostgreSQL backup
docker compose --profile postgres exec db pg_dump -U instrada-ogm-user instrada-ogm > backup-$(date +%Y%m%d).sql
# For HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile postgres exec db pg_dump -U instrada-ogm-user instrada-ogm > backup-$(date +%Y%m%d).sql
# Restore PostgreSQL backup
docker compose --profile postgres exec -T db psql -U instrada-ogm-user instrada-ogm < backup-20240101.sql
# For HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile postgres exec -T db psql -U instrada-ogm-user instrada-ogm < backup-20240101.sql
# HTTP deployment
docker compose --profile postgres exec db psql -U instrada-ogm-user -d instrada-ogm
# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile postgres exec db psql -U instrada-ogm-user -d instrada-ogm
instrada-ogm/
āāā docker-compose.yml # HTTP deployment
āāā docker-compose-traefik.yml # HTTPS deployment
āāā .env # Main configuration
āāā data/
ā āāā backups/ # Application backups
āāā traefik/ # Traefik configuration (HTTPS only)
āāā generate-config.sh
āāā validate.sh
āāā runtime/
āāā .env.traefik
āāā traefik.yml
āāā config.yml
āāā acme.json # SSL certificates
Note: PostgreSQL data is stored in a Docker volume named postgres_data and managed automatically by Docker.
| Variable | Description | Example |
|---|---|---|
OPNSENSE_URL | OPNsense firewall URL | https://firewall.local |
OPNSENSE_API_KEY | OPNsense API key | Generated in OPNsense UI |
OPNSENSE_API_SECRET | OPNsense API secret | Generated in OPNsense UI |
POSTGRES_USER | PostgreSQL username | instrada-ogm-user |
POSTGRES_PASSWORD | PostgreSQL password | Strong password |
POSTGRES_DB | PostgreSQL database name | instrada-ogm |
NEXTAUTH_SECRET | JWT signing secret | openssl rand -base64 32 |
BACKUP_ENCRYPTION_SECRET_KEY | Backup encryption key | openssl rand -hex 32 |
| Variable | Default | Description |
|---|---|---|
ALLOW_HTTP | false | Allow HTTP connections |
POSTGRES_HOST | db | PostgreSQL hostname |
POSTGRES_PORT | 5432 | PostgreSQL port |
APP_DEBUG_LEVEL | SILENT | Logging level (SILENT/ERROR/WARN/INFO/DEBUG) |
SKIP_SSL_VERIFICATION | false | Skip OPNsense SSL verification (dev only) |
# Check logs
docker compose --profile postgres logs instrada-ogm-postgres
docker compose --profile postgres logs db
# Verify .env file is present
ls -la .env
# Check environment variables are loaded
docker compose --profile postgres config
# Check if database is ready
docker compose --profile postgres exec db pg_isready -U instrada-ogm-user
# Verify connection string
docker compose --profile postgres exec instrada-ogm-postgres env | grep DATABASE_URL
# Check if database exists
docker compose --profile postgres exec db psql -U instrada-ogm-user -l
# Option A: Use the automated setup script (recommended)
curl -o setup-data-permissions.sh https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/setup-data-permissions.sh
chmod +x setup-data-permissions.sh
sudo ./setup-data-permissions.sh ./data
# Option B: Manual fix
sudo chown -R 65532:65532 data/
# Verify containers are running
docker compose --profile postgres ps
# Check port binding
netstat -tuln | grep 3000
# Test local connection (or use your server IP)
curl http://localhost:3000
# Check PostgreSQL stats
docker compose --profile postgres exec db psql -U instrada-ogm-user -d instrada-ogm -c "SELECT * FROM pg_stat_activity;"
# View active connections
docker compose --profile postgres exec db psql -U instrada-ogm-user -d instrada-ogm -c "SELECT count(*) FROM pg_stat_activity;"
# Check Traefik logs
docker compose -f docker-compose-traefik.yml --profile postgres logs traefik
# Verify DNS is resolving
nslookup your-instrada-ogm.com
# Check acme.json permissions
ls -la traefik/runtime/acme.json
# Should be: -rw------- (600)
# Stop services
docker compose --profile postgres down
# Remove PostgreSQL volume
docker volume rm instrada-ogm_postgres_data
# Start services (fresh database)
docker compose --profile postgres up -d
POSTGRES_PASSWORD to a strong passwordNEXTAUTH_SECRET using openssl rand -base64 32BACKUP_ENCRYPTION_SECRET_KEY using openssl rand -hex 32ALLOW_HTTP=false for HTTPS enforcementSKIP_SSL_VERIFICATION=false (use valid SSL for OPNsense)APP_DEBUG_LEVEL=ERROR or SILENTNODE_ENV=productionFor production deployments, consider tuning PostgreSQL settings:
# Edit docker-compose.yml and add to db service:
command:
- "postgres"
- "-c"
- "max_connections=200"
- "-c"
- "shared_buffers=256MB"
- "-c"
- "effective_cache_size=1GB"
- "-c"
- "work_mem=4MB"
Consider adding resource limits in docker-compose.yml:
services:
instrada-ogm-postgres:
deploy:
resources:
limits:
cpus: '2'
memory: 2G
db:
deploy:
resources:
limits:
cpus: '2'
memory: 2G
Category: Deployment | Database: PostgreSQL | Status: Production Ready
admin, Password admin (must be changed on first login)postgres_datapg_dump or the built-in backup featureContent type
Image
Digest
sha256:4fad157d3ā¦
Size
189.7 MB
Last updated
2 months ago
docker pull rdeangel/instrada-ogm-postgres