48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
# This compose file uses configs for Portainer. Uncomment the local script lines if you want to use it.
|
|
# Comment out the configs section if you don't use Portainer.
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
restart: always
|
|
environment:
|
|
- POSTGRES_USER
|
|
- POSTGRES_PASSWORD
|
|
- POSTGRES_DB
|
|
- POSTGRES_NON_ROOT_USER
|
|
- POSTGRES_NON_ROOT_PASSWORD
|
|
volumes:
|
|
# PostgreSQL will be stored in a local folder
|
|
- ${PATH_TO_POSTGRES}:/var/lib/postgresql/data
|
|
# - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
|
|
configs:
|
|
- source: n8n_init_script
|
|
target: /docker-entrypoint-initdb.d/init-data.sh
|
|
mode: 0755 # Important: make the script executable
|
|
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}
|
|
ports:
|
|
- 5678:5678
|
|
links:
|
|
- postgres
|
|
volumes:
|
|
# n8n data will be stored in a local folder
|
|
- ${PATH_TO_APP}:/home/node/.n8n
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|