Skip to content

About

Production-ready Docker Compose stack for Dokploy with PostgreSQL, MariaDB, Redis, ClickHouse, Authentik, n8n, Kestra, Odoo, Frappe

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Dokploy Production Stack

Production-ready Docker Compose stack for deploying multiple business and workflow applications on Dokploy.

Version: 1.0 Created: December 15, 2025 Author: tgunawan


Services Included

Databases

  • PostgreSQL 16 - Primary database for Authentik, n8n, Kestra
  • Redis 7 - Cache and queue for multiple services
  • MariaDB 11.3 - Database for Odoo and Frappe
  • ClickHouse - Analytics database

Applications

  • Authentik - SSO & Identity Provider (server + worker)
  • n8n - Workflow automation platform
  • Kestra - Data orchestration platform
  • Odoo 17 - Open-source ERP system
  • Frappe/ERPNext - Business management framework

Architecture

┌─────────────────────────────────────────────────────┐
│                  dokploy-network                    │
│  (External network for Dokploy integration)         │
└─────────────────────────────────────────────────────┘
                         │
    ┌────────────────────┼────────────────────┐
    │                    │                    │
┌───▼────┐         ┌────▼─────┐        ┌────▼────┐
│ Authen-│         │   n8n    │        │  Kestra │
│  tik   │         │  :5678   │        │  :8080  │
│ :9000  │         └──────────┘        └─────────┘
└────────┘               │                    │
    │                    │                    │
    │         ┌──────────┴────────────┐       │
    │         │                       │       │
┌───▼─────┐  │  ┌────────┐    ┌─────▼────┐  │
│Postgres │◄─┴──┤ Redis  │◄───┤ MariaDB  │◄─┘
│  :5432  │     │ :6379  │    │  :3306   │
└─────────┘     └────────┘    └──────────┘
                                     │
                    ┌────────────────┼────────────┐
                    │                │            │
                ┌───▼────┐      ┌───▼─────┐  ┌──▼──────┐
                │  Odoo  │      │ Frappe  │  │ClickHse │
                │ :8069  │      │  :8000  │  │  :8123  │
                └────────┘      └─────────┘  └─────────┘

Quick Start

1. Prerequisites

  • Docker Engine 27.x or later
  • Docker Compose v2
  • Dokploy installed and running
  • Minimum 8GB RAM, 4 CPU cores
  • 50GB+ disk space

2. Clone Repository

cd ~/projects
git clone https://github.com/tgunawan/dokploy-stack.git
cd dokploy-stack

3. Configure Environment

# Copy example environment file
cp .env.example .env

# Edit environment variables
nano .env

Required Changes:

  • All passwords (search for your_strong_)
  • AUTHENTIK_SECRET_KEY (generate with: openssl rand -hex 32)
  • Hostnames and ports if needed
  • Database names if desired

4. Initialize Databases

Before starting services, create databases for applications:

# Start only database services first
docker compose up -d postgres mariadb redis clickhouse

# Wait for databases to be ready (30 seconds)
sleep 30

# Create application databases
docker compose exec postgres psql -U postgres -c "CREATE DATABASE authentik;"
docker compose exec postgres psql -U postgres -c "CREATE DATABASE n8n;"
docker compose exec postgres psql -U postgres -c "CREATE DATABASE kestra;"

5. Start All Services

# Start all services
docker compose up -d

# View logs
docker compose logs -f

# Check status
docker compose ps

6. Verify Services

Service URL Default Credentials
Authentik http://localhost:9000 Setup wizard on first visit
n8n http://localhost:5678 N8N_BASIC_AUTH_USER / N8N_BASIC_AUTH_PASSWORD
Kestra http://localhost:8080 KESTRA_BASIC_AUTH_USER / KESTRA_BASIC_AUTH_PASSWORD
Odoo http://localhost:8069 Create database on first visit
Frappe http://localhost:8000 Administrator / FRAPPE_ADMIN_PASSWORD

Deployment to Dokploy

Method 1: Via Dokploy UI (Recommended)

  1. Login to Dokploy dashboard
  2. Create New Application → Select "Docker Compose"
  3. Repository Settings:
    • Repository: https://github.com/tgunawan/dokploy-stack.git
    • Branch: main
    • Compose File: docker-compose.yml
  4. Environment Variables: Paste contents of .env file
  5. Deploy: Click "Deploy"

Method 2: Via CLI from DevOps Workspace

# SSH into devops workspace
coder ssh my-devops-ws

# Clone repository
cd ~/projects
git clone https://github.com/tgunawan/dokploy-stack.git
cd dokploy-stack

# Configure environment
cp .env.example .env
nano .env

# Deploy to Dokploy
docker compose --project-name dokploy-stack up -d

Service Configuration

Authentik - SSO Setup

Initial Setup:

  1. Access http://localhost:9000
  2. Create admin user (email + password)
  3. Configure SSO providers (Google, GitHub, etc.)
  4. Set up applications for n8n, Kestra, Odoo, Frappe

Integration:

  • All services can use Authentik for authentication
  • Configure OAuth2/OIDC in each application
  • Use single sign-on across all services

n8n - Workflow Automation

Features:

  • Visual workflow builder
  • 200+ integrations (Slack, Email, HTTP, etc.)
  • PostgreSQL backend for persistence
  • Redis queue for background jobs

Common Workflows:

  • Data synchronization between Odoo and Frappe
  • Automated email notifications
  • Webhook processing
  • Scheduled data exports to ClickHouse

Kestra - Data Orchestration

Features:

  • Code-first data pipelines
  • Support for Python, Node.js, SQL, Bash
  • Built-in scheduler and triggers
  • PostgreSQL backend

Use Cases:

  • ETL pipelines
  • Database migrations
  • Scheduled reports
  • Data validation workflows

Odoo - ERP System

Included Apps:

  • CRM, Sales, Inventory
  • Accounting, HR, Project Management
  • eCommerce, Manufacturing

Configuration:

  • Database: MariaDB
  • Workers: 4 (for production performance)
  • Max connections: 500

Frappe/ERPNext

Features:

  • Complete ERP suite
  • Custom app development framework
  • REST API
  • Real-time updates via Socket.IO

Configuration:

  • Database: MariaDB
  • Cache: Redis (database 0)
  • Queue: Redis (database 1)
  • Socket.IO: Redis (database 2)

Resource Requirements

Minimum (Development)

  • CPU: 4 cores
  • RAM: 8GB
  • Disk: 50GB SSD

Recommended (Production)

  • CPU: 8+ cores
  • RAM: 16GB+
  • Disk: 100GB+ NVMe SSD
  • Network: 1Gbps

Per-Service Memory Usage

Service Idle Active Peak
PostgreSQL 200MB 500MB 1GB
MariaDB 500MB 1GB 2GB
Redis 50MB 100MB 512MB
ClickHouse 200MB 500MB 2GB
Authentik (server+worker) 300MB 500MB 1GB
n8n 200MB 400MB 800MB
Kestra 300MB 600MB 1.5GB
Odoo 400MB 800MB 2GB
Frappe 500MB 1GB 3GB
TOTAL ~2.5GB ~5.5GB ~14GB

Data Persistence

Volumes

All data is persisted in Docker volumes:

postgres_data       - PostgreSQL database files
mariadb_data        - MariaDB database files
redis_data          - Redis persistence files
clickhouse_data     - ClickHouse database files
authentik_media     - Authentik uploaded files
n8n_data            - n8n workflow data
kestra_data         - Kestra flow storage
odoo_web_data       - Odoo filestore
odoo_addons         - Odoo custom addons
frappe_sites        - Frappe site files
frappe_apps         - Frappe applications

Backup Strategy

# Backup databases
docker compose exec postgres pg_dump -U postgres authentik > backup_authentik_$(date +%Y%m%d).sql
docker compose exec postgres pg_dump -U postgres n8n > backup_n8n_$(date +%Y%m%d).sql
docker compose exec mariadb mysqldump -u root -p${MYSQL_ROOT_PASSWORD} --all-databases > backup_mariadb_$(date +%Y%m%d).sql

# Backup volumes
docker run --rm -v dokploy-stack_postgres_data:/data -v $(pwd):/backup ubuntu tar czf /backup/postgres_data_$(date +%Y%m%d).tar.gz /data

# Automated backup script (add to cron)
./scripts/backup.sh

Networking

Networks

  • dokploy-network: External network for Dokploy integration
  • internal: Internal network for service communication

Port Mapping

Service Internal Port External Port (default)
PostgreSQL 5432 5432
MariaDB 3306 3306
Redis 6379 6379
ClickHouse HTTP 8123 8123
ClickHouse Native 9000 9000
Authentik HTTP 9000 9000
Authentik HTTPS 9443 9443
n8n 5678 5678
Kestra 8080 8080
Odoo 8069 8069
Odoo Longpolling 8072 8072
Frappe 8000 8000
Frappe Socket.IO 9000 9000 (conflicts with Authentik!)

⚠️ Port Conflict: Frappe Socket.IO and Authentik both use port 9000. Update FRAPPE_SOCKETIO_PORT in .env to avoid conflicts.


Security Considerations

✅ Best Practices Applied

  • Strong Passwords: All services require unique, strong passwords
  • Internal Network: Services communicate via internal network
  • Health Checks: All databases have health checks
  • Resource Limits: Memory limits prevent resource exhaustion
  • Secrets Management: Credentials via environment variables (not hardcoded)

⚠️ Additional Hardening Required for Production

  1. Enable HTTPS:

    • Use Traefik or nginx reverse proxy
    • Install SSL certificates (Let's Encrypt)
    • Force HTTPS redirects
  2. Firewall Configuration:

    # Only expose necessary ports
    ufw allow 80/tcp
    ufw allow 443/tcp
    ufw deny 5432/tcp  # PostgreSQL
    ufw deny 3306/tcp  # MariaDB
    ufw deny 6379/tcp  # Redis
  3. Database Security:

    • Change default PostgreSQL user
    • Disable remote root login for MariaDB
    • Use separate database users per application
  4. Regular Updates:

    # Update images
    docker compose pull
    docker compose up -d
  5. Monitoring:

    • Enable Grafana (uncomment in docker-compose.yml)
    • Set up log aggregation (Loki, ELK)
    • Configure alerts (disk space, memory, CPU)

Troubleshooting

Issue: Services Won't Start

Check Logs:

docker compose logs <service-name>

Common Causes:

  • Port conflicts (change EXTERNAL_PORT in .env)
  • Missing environment variables
  • Database not ready (increase sleep time in init script)

Issue: Database Connection Errors

Verify Database Health:

docker compose exec postgres pg_isready -U postgres
docker compose exec mariadb mysql -u root -p${MYSQL_ROOT_PASSWORD} -e "SELECT 1;"

Reset Databases:

# ⚠️ WARNING: This deletes all data
docker compose down -v
docker volume prune -f
docker compose up -d

Issue: Out of Memory

Check Resource Usage:

docker stats

Reduce Resource Consumption:

  • Stop unused services
  • Reduce Odoo workers (--workers=2)
  • Lower database buffer pools

Issue: Slow Performance

Optimize Databases:

# MariaDB
docker compose exec mariadb mysql -u root -p${MYSQL_ROOT_PASSWORD} -e "OPTIMIZE TABLE;"

# PostgreSQL
docker compose exec postgres psql -U postgres -c "VACUUM ANALYZE;"

Check Disk I/O:

iostat -x 1

Maintenance

Update Services

# Pull latest images
docker compose pull

# Restart services with new images
docker compose up -d

# Clean up old images
docker image prune -f

Scale Services

# Scale n8n workers
docker compose up -d --scale n8n-worker=3

# Scale Frappe workers
docker compose up -d --scale frappe-worker=2

Monitor Logs

# All services
docker compose logs -f

# Specific service
docker compose logs -f n8n

# Last 100 lines
docker compose logs --tail=100 authentik-server

Development vs Production

Development Configuration

# Use docker-compose.dev.yml override
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d

Changes:

  • Debug logging enabled
  • Auto-reload for Odoo and Frappe
  • Port forwarding for all services
  • No resource limits

Production Configuration

# Use docker-compose.prod.yml override
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Changes:

  • Production logging levels
  • Resource limits enforced
  • Health checks with restart policies
  • Only expose required ports

Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/improvement)
  3. Commit changes (git commit -am 'Add improvement')
  4. Push to branch (git push origin feature/improvement)
  5. Create Pull Request

License

MIT License - See LICENSE file for details


Support


Last Updated: December 15, 2025 Version: 1.0 Maintained By: tgunawan

About

Production-ready Docker Compose stack for Dokploy with PostgreSQL, MariaDB, Redis, ClickHouse, Authentik, n8n, Kestra, Odoo, Frappe

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors