Compose-Examples/examples/n8n/docker-compose.yml

76 lines
2.2 KiB
YAML
Raw Permalink Normal View History

2023-02-23 00:42:41 +00:00
services:
2023-02-23 00:42:41 +00:00
n8n-db:
2024-09-26 17:39:26 +00:00
image: postgres:16-alpine
2023-02-23 00:42:41 +00:00
container_name: n8n-db
restart: unless-stopped
expose:
- 5432
2023-02-23 00:42:41 +00:00
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_NON_ROOT_USER
- POSTGRES_NON_ROOT_PASSWORD
2023-02-23 00:42:41 +00:00
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
2023-02-23 00:42:41 +00:00
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 5s
2023-02-23 00:42:41 +00:00
timeout: 5s
2024-09-26 17:39:26 +00:00
retries: 10
#networks:
# - n8n-internal
2023-02-23 00:42:41 +00:00
n8n:
image: n8nio/n8n
container_name: n8n
hostname: n8n
restart: unless-stopped
environment:
2024-09-26 23:09:20 +00:00
# database settings
- 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}
2024-09-26 23:09:20 +00:00
# application settings
- NODE_ENV=${N8N_NODE_ENV}
- GENERIC_TIMEZONE=${N8N_TZ}
# tls proxy settings
- N8N_HOST=${N8N_HOST}
- N8N_PROTOCOL=${N8N_PROTOCOL}
- WEBHOOK_URL=${N8N_WEBHOOK_URL}
# npm extra options
- EXTRA_NODE_MODULES=${N8N_EXTRA_NODE_MODULES}
- NODE_FUNCTION_ALLOW_EXTERNAL=${N8N_NODE_FUNCTION_ALLOW_EXTERNAL}
2023-02-23 00:42:41 +00:00
ports:
- 5678:5678
2024-09-26 17:39:26 +00:00
expose:
- 5678
2023-02-23 00:42:41 +00:00
links:
- n8n-db
volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/storage:/home/node/.n8n
2024-09-26 23:09:20 +00:00
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/files:/files
2023-02-23 00:42:41 +00:00
depends_on:
n8n-db:
condition: service_healthy
2024-09-26 17:39:26 +00:00
#networks:
# - proxy
# - n8n-internal
2023-02-23 00:42:41 +00:00
#labels:
# - traefik.enable=true
2024-09-26 17:39:26 +00:00
# - traefik.docker.network=proxy
2023-02-23 00:42:41 +00:00
# - traefik.http.routers.n8n.rule=Host(`n8n.example.com`)
# - traefik.http.services.n8n.loadbalancer.server.port=5678
# # Part for optional traefik middlewares
# - traefik.http.routers.n8n.middlewares=local-ipwhitelist@file,basic-auth@file
2024-09-26 17:39:26 +00:00
#networks:
2024-09-26 20:31:36 +00:00
# proxy:
2024-09-26 17:39:26 +00:00
# external: true
# n8n-internal:
# internal: true