Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version: '3.8'
- volumes:
- db_storage:
- n8n_storage:
- redis_storage:
- x-shared: &shared
- restart: always
- image: docker.n8n.io/n8nio/n8n
- environment:
- - N8N_LOG_LEVEL=debug
- - 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}
- - EXECUTIONS_MODE=queue
- - QUEUE_BULL_REDIS_HOST=redis
- - QUEUE_HEALTH_CHECK_ACTIVE=true
- links:
- - postgres
- - redis
- volumes:
- - n8n_storage:/home/node/.n8n
- depends_on:
- redis:
- condition: service_healthy
- postgres:
- condition: service_healthy
- services:
- postgres:
- image: postgres:11
- restart: always
- environment:
- - POSTGRES_USER
- - POSTGRES_PASSWORD
- - POSTGRES_DB
- - POSTGRES_NON_ROOT_USER
- - POSTGRES_NON_ROOT_PASSWORD
- networks:
- n8n_default:
- 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
- redis:
- image: redis:6-alpine
- restart: always
- volumes:
- - redis_storage:/data
- networks:
- n8n_default:
- healthcheck:
- test: ['CMD', 'redis-cli', 'ping']
- interval: 5s
- timeout: 5s
- retries: 10
- n8n:
- <<: *shared
- labels:
- - traefik.enable=true
- #- traefik.http.routers.n8n-prod.rule=hostregexp(`{host:.+}`)
- - traefik.http.routers.n8n-prod.rule=Host(`n8n.domain.com`)
- - traefik.http.routers.n8n-prod.entrypoints=websecure
- - traefik.http.routers.n8n-prod.tls.certresolver=le
- - traefik.http.routers.n8n-prod.middlewares=n8n-prod-ratelimit,n8n-prod-cors-mw
- - traefik.http.routers.n8n-prod.service=n8n-prod
- - traefik.http.services.n8n-prod.loadbalancer.server.port=5678
- # Middlewares
- - traefik.http.middlewares.n8n-prod-ratelimit.ratelimit.average=50
- - traefik.http.middlewares.n8n-prod-ratelimit.ratelimit.burst=15
- # CORS
- - traefik.http.middlewares.n8n-prod-cors-mw.headers.accesscontrolalloworiginlist=*
- - traefik.http.middlewares.n8n-prod-cors-mw.headers.accesscontrolallowmethods=GET,POST,HEAD,PUT,DELETE,PATCH,OPTIONS
- - traefik.http.middlewares.n8n-prod-cors-mw.headers.accesscontrolexposeheaders=*
- - traefik.http.middlewares.n8n-prod-cors-mw.headers.accesscontrolallowheaders=*
- - traefik.http.middlewares.n8n-prod-cors-mw.headers.accesscontrolmaxage=120
- #- traefik.http.middlewares.n8n-cors-mw.headers.accessControlAllowCredentials="true"
- - traefik.http.middlewares.n8n-prod-cors-mw.headers.addvaryheader=true
- # for n8n specific
- - traefik.http.routers.n8n.tls=true
- - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- - traefik.http.middlewares.n8n.headers.STSPreload=true
- - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- networks:
- traefik-public:
- n8n_default:
- ports:
- - 5678:5678
- n8n-worker:
- <<: *shared
- command: worker
- networks:
- n8n_default:
- depends_on:
- - n8n
- networks:
- # Use created public network "traefik-public", shared with other
- # services that need to be publicly available via this Traefik
- n8n_default:
- driver: bridge
- name: n8n_default
- traefik-public:
- external: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement