2026-06-03 23:51:59 +00:00
|
|
|
# =============================================================================
|
2026-07-25 22:48:38 +02:00
|
|
|
# docker-compose.yml — LeoCRM Multi-Container Setup
|
2026-06-03 23:51:59 +00:00
|
|
|
#
|
2026-07-25 22:48:38 +02:00
|
|
|
# Full stack: PostgreSQL + Redis + App + Worker, all with persistent volumes.
|
2026-08-04 11:55:04 +02:00
|
|
|
# Coolify manages networking, labels, and domains — no custom networks or labels.
|
2026-08-04 11:13:44 +02:00
|
|
|
# No hardcoded secrets, UUIDs, or domains — everything from environment.
|
2026-06-03 23:51:59 +00:00
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
postgres:
|
2026-07-25 22:48:38 +02:00
|
|
|
image: pgvector/pgvector:pg16
|
2026-06-03 23:51:59 +00:00
|
|
|
restart: unless-stopped
|
|
|
|
|
environment:
|
|
|
|
|
POSTGRES_USER: ${POSTGRES_USER:-crm_user}
|
2026-08-04 11:13:44 +02:00
|
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required}
|
2026-06-03 23:51:59 +00:00
|
|
|
POSTGRES_DB: ${POSTGRES_DB:-crm_db}
|
|
|
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
|
|
|
volumes:
|
|
|
|
|
- pgdata:/var/lib/postgresql/data
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-crm_user} -d ${POSTGRES_DB:-crm_db}"]
|
|
|
|
|
interval: 10s
|
|
|
|
|
timeout: 5s
|
|
|
|
|
retries: 5
|
|
|
|
|
start_period: 10s
|
|
|
|
|
|
2026-07-25 22:48:38 +02:00
|
|
|
redis:
|
|
|
|
|
image: redis:7-alpine
|
|
|
|
|
restart: unless-stopped
|
2026-07-26 20:45:42 +02:00
|
|
|
command: redis-server --requirepass ${REDIS_PASSWORD:?REDIS_PASSWORD is required}
|
2026-07-25 22:48:38 +02:00
|
|
|
volumes:
|
|
|
|
|
- redisdata:/data
|
|
|
|
|
healthcheck:
|
2026-07-31 00:58:05 +02:00
|
|
|
test: ["CMD-SHELL", "redis-cli ping || exit 1"]
|
2026-07-25 22:48:38 +02:00
|
|
|
interval: 10s
|
|
|
|
|
timeout: 5s
|
|
|
|
|
retries: 5
|
|
|
|
|
|
2026-06-03 23:51:59 +00:00
|
|
|
crm-app:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
2026-07-25 21:03:46 +02:00
|
|
|
redis:
|
|
|
|
|
condition: service_healthy
|
2026-06-03 23:51:59 +00:00
|
|
|
environment:
|
2026-08-05 22:29:41 +02:00
|
|
|
SERVICE_FQDN_CRM_APP_8000: ${APP_DOMAIN}
|
2026-08-04 11:13:44 +02:00
|
|
|
DATABASE_URL: ${DATABASE_URL:-postgresql+asyncpg://crm_api:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB:-crm_db}}
|
|
|
|
|
AUTH_DATABASE_URL: ${AUTH_DATABASE_URL:-postgresql+asyncpg://crm_auth:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB:-crm_db}}
|
2026-08-04 11:55:04 +02:00
|
|
|
MIGRATION_DATABASE_URL: ${MIGRATION_DATABASE_URL:-postgresql+asyncpg://crm_user:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB:-crm_db}}
|
|
|
|
|
REDIS_URL: ${REDIS_URL:-redis://default:${REDIS_PASSWORD}@redis:6379/0}
|
|
|
|
|
SECRET_KEY: ${SECRET_KEY:?SECRET_KEY is required}
|
|
|
|
|
CORS_ORIGINS: ${CORS_ORIGINS}
|
|
|
|
|
FRONTEND_URL: ${FRONTEND_URL}
|
2026-06-03 23:51:59 +00:00
|
|
|
ENVIRONMENT: ${ENVIRONMENT:-production}
|
|
|
|
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
2026-07-25 21:03:46 +02:00
|
|
|
SESSION_COOKIE_SECURE: ${SESSION_COOKIE_SECURE:-true}
|
|
|
|
|
STORAGE_PATH: ${STORAGE_PATH:-/data/storage}
|
2026-07-29 12:48:25 +02:00
|
|
|
SMTP_HOST: ${SMTP_HOST:-}
|
|
|
|
|
SMTP_PORT: ${SMTP_PORT:-587}
|
|
|
|
|
SMTP_USER: ${SMTP_USER:-}
|
|
|
|
|
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
|
|
|
|
|
SMTP_FROM: ${SMTP_FROM:-no-reply@localhost}
|
|
|
|
|
SMTP_TLS: ${SMTP_TLS:-true}
|
2026-06-03 23:51:59 +00:00
|
|
|
BCRYPT_ROUNDS: ${BCRYPT_ROUNDS:-12}
|
2026-07-25 21:03:46 +02:00
|
|
|
volumes:
|
|
|
|
|
- storage:/data/storage
|
|
|
|
|
healthcheck:
|
2026-08-04 11:55:04 +02:00
|
|
|
test: ["CMD", "curl", "-fsS", "http://localhost:8000/api/v1/health"]
|
2026-07-25 21:03:46 +02:00
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
2026-08-04 11:55:04 +02:00
|
|
|
start_period: 30s
|
2026-07-25 21:03:46 +02:00
|
|
|
|
|
|
|
|
crm-worker:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
redis:
|
|
|
|
|
condition: service_healthy
|
2026-08-05 22:18:12 +02:00
|
|
|
crm-app:
|
|
|
|
|
condition: service_healthy
|
2026-07-25 22:48:38 +02:00
|
|
|
entrypoint: ["/app/worker.sh"]
|
2026-07-25 21:03:46 +02:00
|
|
|
environment:
|
2026-08-04 11:13:44 +02:00
|
|
|
DATABASE_URL: ${WORKER_DATABASE_URL:-postgresql+asyncpg://crm_worker:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB:-crm_db}}
|
|
|
|
|
WORKER_DATABASE_URL: ${WORKER_DATABASE_URL:-postgresql+asyncpg://crm_worker:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB:-crm_db}}
|
2026-08-04 11:55:04 +02:00
|
|
|
MIGRATION_DATABASE_URL: ${MIGRATION_DATABASE_URL:-postgresql+asyncpg://crm_user:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB:-crm_db}}
|
|
|
|
|
REDIS_URL: ${REDIS_URL:-redis://default:${REDIS_PASSWORD}@redis:6379/0}
|
|
|
|
|
SECRET_KEY: ${SECRET_KEY:?SECRET_KEY is required}
|
|
|
|
|
FRONTEND_URL: ${FRONTEND_URL}
|
2026-07-25 21:03:46 +02:00
|
|
|
ENVIRONMENT: ${ENVIRONMENT:-production}
|
|
|
|
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
2026-07-25 22:48:38 +02:00
|
|
|
SESSION_COOKIE_SECURE: ${SESSION_COOKIE_SECURE:-true}
|
2026-07-25 21:03:46 +02:00
|
|
|
STORAGE_PATH: ${STORAGE_PATH:-/data/storage}
|
2026-07-29 12:48:25 +02:00
|
|
|
SMTP_HOST: ${SMTP_HOST:-}
|
|
|
|
|
SMTP_PORT: ${SMTP_PORT:-587}
|
|
|
|
|
SMTP_USER: ${SMTP_USER:-}
|
|
|
|
|
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
|
|
|
|
|
SMTP_FROM: ${SMTP_FROM:-no-reply@localhost}
|
|
|
|
|
SMTP_TLS: ${SMTP_TLS:-true}
|
2026-07-25 21:03:46 +02:00
|
|
|
volumes:
|
|
|
|
|
- storage:/data/storage
|
2026-08-04 11:55:04 +02:00
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD-SHELL", "python3 -c \"import redis,os; r=redis.from_url(os.environ.get('REDIS_URL','redis://localhost:6379/0')); print('ok' if r.ping() else 'fail')\" || exit 1"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
start_period: 30s
|
2026-07-25 21:03:46 +02:00
|
|
|
|
2026-06-03 23:51:59 +00:00
|
|
|
volumes:
|
2026-08-04 11:55:04 +02:00
|
|
|
pgdata: {}
|
|
|
|
|
redisdata: {}
|
|
|
|
|
storage: {}
|