volumes: test_n8n_db_storage: test_n8n_storage: services: postgres: image: postgres:16 restart: always environment: - POSTGRES_USER - POSTGRES_PASSWORD - POSTGRES_DB - POSTGRES_NON_ROOT_USER - POSTGRES_NON_ROOT_PASSWORD volumes: - test_n8n_db_storage:/var/lib/postgresql/data - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh healthcheck: test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}'] interval: 5s timeout: 5s retries: 10 networks: - test_n8n_internal logging: driver: "json-file" options: max-size: "10m" max-file: "3" n8n: image: docker.n8n.io/n8nio/n8n:${N8N_VERSION} restart: always environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=postgres - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=${POSTGRES_DB} - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER} - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD} - N8N_HOST=${N8N_HOST} - N8N_PORT=5678 - N8N_PROTOCOL=https - N8N_TRUSTED_PROXIES=1 - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true - EXECUTIONS_DATA_MAX_AGE=72 - EXECUTIONS_DATA_PRUNE - NODE_ENV=production - WEBHOOK_URL=https://${N8N_HOST} - QUEUE_HEALTH_CHECK_ACTIVE=true healthcheck: test: ["CMD", "wget", "--no-check-certificate", "--spider", "http://127.0.0.1:5678/healthz"] interval: 12s timeout: 10s retries: 3 start_period: 15s volumes: - test_n8n_storage:/home/node/.n8n depends_on: postgres: condition: service_healthy networks: - test_n8n_internal - traefik labels: - "traefik.enable=true" - "traefik.http.routers.testn8n.rule=Host(`testn8n.hyperthrive.io`)" - "traefik.http.routers.testn8n.entrypoints=websecure" - "traefik.http.routers.testn8n.tls.certresolver=letsencrypt" - "traefik.http.routers.testn8n.service=testn8n" - "traefik.http.services.testn8n.loadbalancer.server.port=5678" - "traefik.docker.network=traefik" logging: driver: "json-file" options: max-size: "10m" max-file: "3" networks: test_n8n_internal: traefik: external: true