# eminuxCRM — stack Docker completo (postgres + web + edge) # Uso: docker compose -f docker-compose.deploy.yml --env-file .env up -d --build services: postgres: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-simplecrm} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD required} POSTGRES_DB: ${POSTGRES_DB:-simplecrm_production} TZ: Europe/Rome PGTZ: Europe/Rome volumes: - postgres_data:/var/lib/postgresql/data networks: - internal healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-simplecrm} -d ${POSTGRES_DB:-simplecrm_production}"] interval: 5s timeout: 5s retries: 20 start_period: 10s web: build: context: . dockerfile: Dockerfile target: production restart: unless-stopped environment: RAILS_ENV: production FORCE_SSL: ${FORCE_SSL:-false} ASSUME_SSL: ${ASSUME_SSL:-true} RUN_SEEDS: ${RUN_SEEDS:-false} DATABASE_HOST: postgres DATABASE_PORT: "5432" POSTGRES_USER: ${POSTGRES_USER:-simplecrm} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB:-simplecrm_production} SECRET_KEY_BASE: ${SECRET_KEY_BASE:?SECRET_KEY_BASE required} MAILER_FROM: ${MAILER_FROM:-noreply@simplecrm.local} APP_HOST: ${APP_HOST:-192.168.1.158} APP_PORT: "80" RAILS_ALLOWED_HOSTS: ${RAILS_ALLOWED_HOSTS:-192.168.1.158,localhost} RAILS_LOG_LEVEL: info TZ: Europe/Rome volumes: - storage_data:/rails/storage networks: - internal depends_on: postgres: condition: service_healthy expose: - "3000" healthcheck: test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:3000/up >/dev/null || exit 1"] interval: 10s timeout: 5s retries: 12 start_period: 90s edge: image: caddy:2-alpine restart: unless-stopped ports: - "80:80" volumes: - ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config networks: - internal depends_on: web: condition: service_healthy networks: internal: volumes: postgres_data: storage_data: caddy_data: caddy_config: