tuto-n8n-simple/docker-compose.yml

93 lines
2.1 KiB
YAML

version: '3.8'
services:
postgres:
image: postgres:16
restart: always
container_name: n8n_postgresql
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_NON_ROOT_USER
- POSTGRES_NON_ROOT_PASSWORD
volumes:
- 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:
- web
redis:
image: redis:6-alpine
restart: always
container_name: n8n_redis
volumes:
- redis_storage:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 5s
retries: 10
networks:
- web
n8n:
restart: always
image: docker.n8n.io/n8nio/n8n:1.46.0
container_name: n8n
ports:
- "5678:5678"
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=localhost
- N8N_PORT=5678
- N8N_PROTOCOL=http
- N8N_ENCRYPTION_KEY
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=user
- N8N_BASIC_AUTH_PASSWORD=password
- GENERIC_TIMEZONE=Europe/Paris
- NODE_ENV=production
- EXECUTIONS_MODE=regular
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_HEALTH_CHECK_ACTIVE=true
- WEBHOOK_URL=http://localhost
links:
- postgres
- redis
volumes:
- n8n_storage:/home/node/.n8n
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ['CMD', 'wget', '--spider', 'http://127.0.0.1:5678']
interval: 30s
timeout: 10s
retries: 5
networks:
- web
- internet
volumes:
n8n_storage:
db_storage:
redis_storage:
networks:
web:
driver: bridge
internet: