rdeangel/instrada-ogm-sqlite

By rdeangel

•Updated 2 months ago

InstradaOGM for sqlite db

Image
Networking
Security
0

2.9K

rdeangel/instrada-ogm-sqlite repository overview

InstradaOGM Logo

⁠InstradaOGM - Docker Deployment Guide (SQLite)

Quick Start Guide for deploying InstradaOGM with SQLite database using Docker

šŸ™ GitHub⁠ | 🐘 View PostgreSQL Guide⁠


ā šŸ“¦ Docker Hub Images


ā šŸŽÆ Deployment Options

Choose the deployment method that fits your environment:

⁠Option 1: HTTP Only (Development/Testing)

Simple setup without SSL certificates - ideal for local networks or testing.

⁠Option 2: HTTPS with Traefik (Production)

Production-ready setup with automatic SSL certificates via Let's Encrypt.


ā šŸ“‹ Prerequisites

  • Docker Engine 20.10+
  • Docker Compose v2.0+
  • OPNsense firewall with API access (v23.1+, preferred v25.1+)
  • Domain name (for HTTPS deployment)

ā šŸš€ Option 1: HTTP Deployment

⁠Step 1: Create Project Directory
mkdir instrada-ogm && cd instrada-ogm
⁠Step 2: Download Docker Compose File
curl -o docker-compose.yml https://raw.githubusercontent.com/rdeangel/InstradaOGM/main/docker-compose.yml
⁠Step 3: Create Environment Configuration

Create a .env file with the following configuration:

# =============================================================================
# InstradaOGM - SQLite 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 (SQLite) ---
SQLITE_DB_NAME=instrada-ogm.db
DATABASE_URL=file:/app/data/db/instrada-ogm.db

# --- 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
⁠Step 4: Create Data Directory
mkdir -p data/db 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/
⁠Step 5: Start the Application
docker compose --profile sqlite up -d
⁠Step 6: Access the Application

Open your browser and navigate to:

  • Application: http://192.168.1.100:3000 (replace with your server's IP address)
⁠Step 7: Initial Setup

Default Login Credentials:

  • Username: admin
  • Password: admin

āš ļø Important: You will be required to change the admin password on first login for security.

  1. Open your browser and navigate to http://192.168.1.100:3000 (replace with your server's IP)
  2. Log in with the default credentials above
  3. You will be prompted to change the password immediately

ā šŸ”’ Option 2: HTTPS Deployment with Traefik

⁠Step 1: Create Project Directory
mkdir instrada-ogm && cd instrada-ogm
⁠Step 2: Download Configuration Files
# 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 ..
⁠Step 3: Create Main Environment Configuration

Create a .env file in the root directory:

# =============================================================================
# InstradaOGM - SQLite 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 (SQLite) ---
SQLITE_DB_NAME=instrada-ogm.db
DATABASE_URL=file:/app/data/db/instrada-ogm.db

# --- 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
⁠Step 4: Configure Traefik
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 ..
⁠Step 5: Create Data Directory
mkdir -p data/db 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/
⁠Step 6: Start the Application
docker compose -f docker-compose-traefik.yml --profile sqlite up -d
⁠Step 7: Wait for Database Initialization
# Watch the logs until database is ready
docker compose -f docker-compose-traefik.yml --profile sqlite logs -f db
⁠Step 7: Access the Application
  • Application: https://your-instrada-ogm.com
⁠Step 8: Initial Setup

Default Login Credentials:

  • Username: admin
  • Password: admin

āš ļø Important: You will be required to change the admin password on first login for security.

  1. Open your browser and navigate to https://your-instrada-ogm.com
  2. Log in with the default credentials above
  3. You will be prompted to change the password immediately
⁠Step 8: Switch to Production SSL Certificates

Once you verify everything works with staging certificates:

  1. Edit traefik/runtime/.env.traefik and change:

    ACME_SERVER=production
    
  2. Regenerate configuration and restart:

    cd traefik && ./generate-config.sh && cd ..
    docker compose -f docker-compose-traefik.yml --profile sqlite down
    rm traefik/runtime/acme.json
    docker compose -f docker-compose-traefik.yml --profile sqlite up -d
    

ā šŸ”§ Common Commands

⁠View Logs
# HTTP deployment
docker compose --profile sqlite logs -f

# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile sqlite logs -f
⁠Stop Services
# HTTP deployment
docker compose --profile sqlite down

# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile sqlite down
⁠Update to Latest Version
# HTTP deployment
docker compose --profile sqlite pull
docker compose --profile sqlite up -d

# HTTPS deployment
docker compose -f docker-compose-traefik.yml --profile sqlite pull
docker compose -f docker-compose-traefik.yml --profile sqlite up -d
⁠Backup Database
# Copy SQLite database file
cp data/db/instrada-ogm.db data/backups/instrada-ogm-$(date +%Y%m%d).db

ā šŸ“ Directory Structure

instrada-ogm/
ā”œā”€ā”€ docker-compose.yml              # HTTP deployment
ā”œā”€ā”€ docker-compose-traefik.yml      # HTTPS deployment
ā”œā”€ā”€ .env                            # Main configuration
ā”œā”€ā”€ data/
│   ā”œā”€ā”€ db/
│   │   └── instrada-ogm.db        # SQLite database
│   └── backups/                    # Application backups
└── traefik/                        # Traefik configuration (HTTPS only)
    ā”œā”€ā”€ generate-config.sh
    ā”œā”€ā”€ validate.sh
    └── runtime/
        ā”œā”€ā”€ .env.traefik
        ā”œā”€ā”€ traefik.yml
        ā”œā”€ā”€ config.yml
        └── acme.json               # SSL certificates

ā āš™ļø Configuration Reference

⁠Required Variables
VariableDescriptionExample
OPNSENSE_URLOPNsense firewall URLhttps://firewall.local
OPNSENSE_API_KEYOPNsense API keyGenerated in OPNsense UI
OPNSENSE_API_SECRETOPNsense API secretGenerated in OPNsense UI
NEXTAUTH_SECRETJWT signing secretopenssl rand -base64 32
BACKUP_ENCRYPTION_SECRET_KEYBackup encryption keyopenssl rand -hex 32
⁠Optional Variables
VariableDefaultDescription
ALLOW_HTTPfalseAllow HTTP connections
SQLITE_DB_NAMEinstrada-ogm.dbSQLite database filename
APP_DEBUG_LEVELSILENTLogging level (SILENT/ERROR/WARN/INFO/DEBUG)
SKIP_SSL_VERIFICATIONfalseSkip OPNsense SSL verification (dev only)

ā šŸ†˜ Troubleshooting

⁠Container won't start
# Check logs
docker compose --profile sqlite logs instrada-ogm

# Verify .env file is present
ls -la .env

# Check environment variables are loaded
docker compose --profile sqlite config
⁠Cannot access application
# Verify container is running
docker compose --profile sqlite ps

# Check port binding
netstat -tuln | grep 3000

# Test local connection (or use your server IP)
curl http://localhost:3000
⁠Database permission issues
# 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/
⁠Traefik SSL certificate issues
# Check Traefik logs
docker compose -f docker-compose-traefik.yml --profile sqlite 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)

Category: Deployment | Database: SQLite | Status: Production Ready

ā šŸ“ Notes

  • Default Login: Username admin, Password admin (must be changed on first login)
  • SQLite is ideal for small to medium deployments (< 10 users)
  • Database is stored in data/db/instrada-ogm.db
  • For high-traffic production environments, consider PostgreSQL deployment
  • Regular backups are recommended - use the built-in backup feature

Tag summary

Content type

Image

Digest

sha256:e87788855…

Size

189.6 MB

Last updated

2 months ago

docker pull rdeangel/instrada-ogm-sqlite