services: postgres: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: n8n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: n8n volumes: - postgres_data:/var/lib/postgresql/data - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U n8n"] interval: 5s timeout: 5s retries: 5 job-digest-api: build: context: ./api dockerfile: Dockerfile restart: unless-stopped ports: - "8001:8000" healthcheck: test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 5s timeout: 5s retries: 5 n8n: image: n8nio/n8n:latest restart: unless-stopped environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=postgres - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=n8n - DB_POSTGRESDB_USER=n8n - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD} - N8N_HOST=localhost - N8N_PORT=5678 - N8N_PROTOCOL=http - GENERIC_TIMEZONE=Africa/Lagos - TZ=Africa/Lagos - N8N_LOG_LEVEL=info - NODES_EXCLUDE=[] - EXECUTIONS_DATA_SAVE_ON_ERROR=all - EXECUTIONS_DATA_SAVE_ON_SUCCESS=all - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true ports: - "5678:5678" volumes: - n8n_data:/home/node/.n8n - ./scripts:/scripts depends_on: postgres: condition: service_healthy job-digest-api: condition: service_healthy volumes: postgres_data: n8n_data: