version: "3.8" services: n8n: image: n8nio/n8n:latest restart: unless-stopped ports: - "5678:5678" environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=n8n-db - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=n8n - DB_POSTGRESDB_USER=n8n - DB_POSTGRESDB_PASSWORD=${N8N_DB_PASSWORD} - N8N_PORT=5678 - GENERIC_TIMEZONE=America/Chicago - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY} volumes: - /data/configs/n8n:/home/node/.n8n depends_on: - n8n-db networks: - n8n-internal healthcheck: test: ["CMD-SHELL", "wget -q --spider http://localhost:5678/healthz || exit 1"] interval: 30s timeout: 10s retries: 3 start_period: 120s logging: driver: "json-file" options: max-size: "50m" max-file: "3" deploy: mode: replicated replicas: 1 placement: constraints: - node.hostname == hf-pdocker-01 resources: limits: memory: 512M n8n-db: image: postgres:15-alpine restart: unless-stopped environment: - POSTGRES_DB=n8n - POSTGRES_USER=n8n - POSTGRES_PASSWORD=${N8N_DB_PASSWORD} volumes: - /data/configs/n8n-db:/var/lib/postgresql/data networks: - n8n-internal healthcheck: test: ["CMD-SHELL", "pg_isready -U n8n -d n8n"] interval: 30s timeout: 10s retries: 3 start_period: 30s logging: driver: "json-file" options: max-size: "50m" max-file: "3" deploy: mode: replicated replicas: 1 placement: constraints: - node.hostname == hf-pdocker-01 labels: - "com.centurylinklabs.watchtower.enable=false" resources: limits: memory: 256M networks: n8n-internal: driver: overlay