Compose-Examples/examples/n8n/docker-compose.yml
LRVT 4d02f7710f
Update docker-compose.yml
new compose based on psql; mariadb and mysql are deprecated
2024-02-22 12:23:05 +01:00

51 lines
1.5 KiB
YAML

version: '3.8'
services:
n8n-db:
image: postgres:11-alpine
container_name: n8n-db
restart: unless-stopped
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_NON_ROOT_USER
- POSTGRES_NON_ROOT_PASSWORD
volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/database:/var/lib/postgresql/data
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/init-database.sh:/docker-entrypoint-initdb.d/init-data.sh:ro
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 5s
timeout: 5s
retries: 10
n8n:
image: n8nio/n8n
container_name: n8n
hostname: n8n
restart: unless-stopped
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=n8n-db
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
ports:
- 5678:5678
links:
- n8n-db
volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/storage:/home/node/.n8n
depends_on:
n8n-db:
condition: service_healthy
#labels:
# - traefik.enable=true
# - traefik.http.routers.n8n.rule=Host(`n8n.example.com`)
# - traefik.http.services.n8n.loadbalancer.server.port=5678
# - traefik.docker.network=proxy
# # Part for optional traefik middlewares
# - traefik.http.routers.n8n.middlewares=local-ipwhitelist@file,basic-auth@file