A skeleton for getting started with a self-hosted n8n environment running in Docker Compose.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

volumes:
db_storage:
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:
- 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
n8n:
image: docker.n8n.io/n8nio/n8n
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}
- WEBHOOK_URL=https://n8n.digitaltelepresence.com/
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- NODE_FUNCTION_ALLOW_BUILTIN=*
- NODE_FUNCTION_ALLOW_EXTERNAL=dayjs,numeral,whois-json
ports:
- 5678:5678
links:
- postgres
volumes:
- n8n_storage:/home/node/.n8n
- /home/dtp/live/dtp-n8n-hosting/node_modules/dayjs:/usr/local/lib/node_modules/dayjs
- /home/dtp/live/dtp-n8n-hosting/node_modules/numeral:/usr/local/lib/node_modules/numeral
- /home/dtp/live/dtp-n8n-hosting/node_modules/whois-json:/usr/local/lib/node_modules/whois-json
depends_on:
postgres:
condition: service_healthy