compose.yaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ---
  2. name: "n8n"
  3. description: "Workflow automation and integration tool"
  4. version: "0.0.1"
  5. date: "2025-09-03"
  6. author: "Christian Lempa"
  7. tags:
  8. - n8n
  9. - automation
  10. - workflows
  11. - compose
  12. variables:
  13. ports.http:
  14. description: "Port for HTTP access to n8n"
  15. default: "5678"
  16. ---
  17. services:
  18. {{ service_name }}:
  19. image: n8nio/n8n:1.110.1
  20. environment:
  21. - N8N_LOG_LEVEL={{ container_loglevel | default('info') }}
  22. - GENERIC_TIMEZONE={{ container_timezone }}
  23. - TZ={{ container_timezone }}
  24. - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
  25. - N8N_RUNNERS_ENABLED=true
  26. {% if traefik %}
  27. {% if traefik.tls %}
  28. - N8N_EDITOR_BASE_URL=https://{{ traefik.host }}
  29. {% else %}
  30. - N8N_EDITOR_BASE_URL=http://{{ traefik.host }}
  31. {% endif %}
  32. {% endif %}
  33. {% if postgres %}
  34. - DB_TYPE=postgresdb
  35. - DB_POSTGRESDB_HOST={{ postgres.host }}
  36. - DB_POSTGRESDB_PORT=${DB_POSTGRESDB_PORT:-5432}
  37. - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
  38. - DB_POSTGRESDB_USER=${POSTGRES_USER}
  39. - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
  40. {% endif %}
  41. volumes:
  42. - /etc/localtime:/etc/localtime:ro
  43. - data:/home/node/.n8n
  44. {% if network %}
  45. networks:
  46. - {{ network_name | default('bridge') }}
  47. {% endif %}
  48. {% if traefik %}
  49. labels:
  50. - traefik.enable={{ traefik | default('true') }}
  51. - traefik.http.routers.{{ service_name }}.rule=Host(`{{ traefik.host }}`)
  52. {% if traefik.tls %}
  53. - traefik.http.routers.{{ service_name }}.entrypoints={{ traefik.tls.entrypoint | default('websecure') }}
  54. - traefik.http.routers.{{ service_name }}.tls=true
  55. - traefik.http.routers.{{ service_name }}.tls.certresolver={{ traefik.tls.certresolver }}
  56. {% else %}
  57. - traefik.http.routers.{{ service_name }}.entrypoints={{ traefik.entrypoint | default('web') }}
  58. {% endif %}
  59. - traefik.http.services.{{ service_name }}.loadbalancer.server.port=5678
  60. {% endif %}
  61. restart: {{ restart_policy | default('unless-stopped') }}
  62. {% if ports %}
  63. ports:
  64. - "{{ ports.http | default('5678') }}:5678"
  65. {% endif %}
  66. volumes:
  67. data:
  68. driver: local
  69. {% if network %}
  70. networks:
  71. {{ network_name | default('bridge') }}:
  72. {% if network_external %}
  73. external: true
  74. {% endif %}
  75. {% endif %}