version: '3.8' # Deploy with: # docker stack deploy -c n8n.yml n8n # # Runs on: pve-tools services: n8n: image: n8nio/n8n:latest environment: DB_TYPE: postgresdb DB_POSTGRESDB_HOST: postgres_postgres DB_POSTGRESDB_PORT: 5432 DB_POSTGRESDB_DATABASE: n8n_db DB_POSTGRESDB_USER: n8n_user DB_POSTGRESDB_PASSWORD: ${N8N_DB_PASSWORD} ports: - target: 5678 published: 5678 protocol: tcp mode: host volumes: - n8n_data:/home/node/.n8n networks: - overlay-net deploy: replicas: 1 placement: constraints: - node.hostname == pve-tools restart_policy: condition: on-failure delay: 5s max_attempts: 3 volumes: n8n_data: networks: overlay-net: external: true name: ${OVERLAY_NETWORK:-homelab-net}