add Container N8N
This commit is contained in:
parent
6529ccfda2
commit
c6831f0aa7
2 changed files with 86 additions and 0 deletions
15
n8n/.env-example
Normal file
15
n8n/.env-example
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# N8N Version (Standard: latest)
|
||||||
|
N8N_VERSION=latest
|
||||||
|
|
||||||
|
# N8N PostgreSQL Version
|
||||||
|
N8N_POSTGRES_VERSION=16
|
||||||
|
|
||||||
|
# N8N Domain
|
||||||
|
N8N_DOMAIN=n8n.example.com
|
||||||
|
|
||||||
|
# N8N Database Config
|
||||||
|
N8N_POSTGRES_USER=changeUser
|
||||||
|
N8N_POSTGRES_PASSWORD=changePassword
|
||||||
|
N8N_POSTGRES_DB=n8n
|
||||||
|
N8N_POSTGRES_NON_ROOT_USER=changeUser
|
||||||
|
N8N_POSTGRES_NON_ROOT_PASSWORD=changePassword
|
71
n8n/docker-compose.yml
Normal file
71
n8n/docker-compose.yml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:${N8N_POSTGRES_VERSION:-16}
|
||||||
|
container_name: n8n_db
|
||||||
|
networks:
|
||||||
|
- n8n
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER
|
||||||
|
- POSTGRES_PASSWORD
|
||||||
|
- POSTGRES_DB
|
||||||
|
- POSTGRES_NON_ROOT_USER
|
||||||
|
- POSTGRES_NON_ROOT_PASSWORD
|
||||||
|
volumes:
|
||||||
|
- ./data/db:/var/lib/postgresql/data
|
||||||
|
- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${N8N_POSTGRES_USER} -d ${N8N_POSTGRES_DB}']
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
n8n:
|
||||||
|
image: docker.n8n.io/n8nio/n8n:${N8N_VERSION:-latest}
|
||||||
|
restart: always
|
||||||
|
container_name: n8n
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
- n8n
|
||||||
|
environment:
|
||||||
|
- DB_TYPE=postgresdb
|
||||||
|
- DB_POSTGRESDB_HOST=postgres
|
||||||
|
- DB_POSTGRESDB_PORT=5432
|
||||||
|
- DB_POSTGRESDB_DATABASE=${N8N_POSTGRES_DB}
|
||||||
|
- DB_POSTGRESDB_USER=${N8N_POSTGRES_NON_ROOT_USER}
|
||||||
|
- DB_POSTGRESDB_PASSWORD=${N8N_POSTGRES_NON_ROOT_PASSWORD}
|
||||||
|
- N8N_HOST=${N8N_DOMAIN:?error}
|
||||||
|
- N8N_PORT=5678
|
||||||
|
- N8N_PROTOCOL=https
|
||||||
|
- NODE_ENV=production
|
||||||
|
- N8N_TRUST_PROXY=true
|
||||||
|
- WEBHOOK_URL=https://${N8N_DOMAIN:?error}
|
||||||
|
- GENERIC_TIMEZONE=Europe/Berlin
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
links:
|
||||||
|
- postgres
|
||||||
|
volumes:
|
||||||
|
- ./data/n8n:/home/node/.n8n
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
- "traefik.http.routers.n8n.entrypoints=http"
|
||||||
|
- "traefik.http.routers.n8n.rule=Host(`${N8N_DOMAIN:?error}`)"
|
||||||
|
- "traefik.http.middlewares.n8n-https-redirect.redirectscheme.scheme=https"
|
||||||
|
- "traefik.http.routers.n8n.middlewares=n8n-https-redirect"
|
||||||
|
- "traefik.http.routers.n8n-secure.entrypoints=https"
|
||||||
|
- "traefik.http.routers.n8n-secure.rule=Host(`${N8N_DOMAIN:?error}`)"
|
||||||
|
- "traefik.http.routers.n8n-secure.tls=true"
|
||||||
|
- "traefik.http.routers.n8n-secure.service=n8n"
|
||||||
|
- "traefik.http.services.n8n.loadbalancer.server.port=5678"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
n8n:
|
||||||
|
driver: bridge
|
Loading…
Add table
Reference in a new issue