This commit is contained in:
2026-03-14 18:25:44 +01:00
parent a2f75cdafd
commit 99fc6ba04c
19 changed files with 703 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
version: "3.8"
services:
n8n:
image: "{{ n8n_docker_image }}"
restart: unless-stopped
user: "{{ n8n_docker_uid }}:{{ n8n_docker_gid }}"
env_file:
- .env
ports:
- "{{ n8n_listen_port }}:5678"
volumes:
- "{{ n8n_home }}/data:/home/node/.n8n"

View File

@@ -0,0 +1,19 @@
N8N_HOST={{ n8n_host }}
N8N_PORT=5678
N8N_PROTOCOL={{ n8n_protocol }}
WEBHOOK_URL={{ n8n_webhook_url }}
GENERIC_TIMEZONE={{ n8n_timezone }}
DB_TYPE={{ n8n_db_kind }}
{% if n8n_db_kind == 'postgres' -%}
DB_POSTGRESDB_HOST={{ n8n_db_host }}
DB_POSTGRESDB_PORT={{ n8n_db_port }}
DB_POSTGRESDB_DATABASE={{ n8n_db_name }}
DB_POSTGRESDB_USER={{ n8n_db_user }}
DB_POSTGRESDB_PASSWORD={{ n8n_db_password }}
{% else -%}
DB_MYSQLDB_HOST={{ n8n_db_host }}
DB_MYSQLDB_PORT={{ n8n_db_port }}
DB_MYSQLDB_DATABASE={{ n8n_db_name }}
DB_MYSQLDB_USER={{ n8n_db_user }}
DB_MYSQLDB_PASSWORD={{ n8n_db_password }}
{% endif -%}

View File

@@ -0,0 +1,15 @@
[Unit]
Description={{ n8n_name }} Docker Service
After=network.target docker.service
Requires=docker.service
[Service]
WorkingDirectory={{ n8n_home }}
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
Restart=always
TimeoutStartSec=0
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
[Unit]
Description={{ n8n_name }} Package Service
After=network.target
[Service]
Type=simple
User={{ n8n_user }}
Group={{ n8n_group }}
WorkingDirectory={{ n8n_home }}
EnvironmentFile={{ n8n_home }}/.env
ExecStart={{ n8n_package_bin }}
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
[Unit]
Description={{ n8n_name }} Repo Service
After=network.target
[Service]
Type=simple
User={{ n8n_user }}
Group={{ n8n_group }}
WorkingDirectory={{ n8n_home }}
EnvironmentFile={{ n8n_home }}/.env
ExecStart=/bin/sh -lc "{{ n8n_start_command }}"
Restart=always
[Install]
WantedBy=multi-user.target

19
templates/n8n.env.j2 Normal file
View File

@@ -0,0 +1,19 @@
N8N_HOST={{ n8n_host }}
N8N_PORT={{ n8n_listen_port }}
N8N_PROTOCOL={{ n8n_protocol }}
WEBHOOK_URL={{ n8n_webhook_url }}
GENERIC_TIMEZONE={{ n8n_timezone }}
DB_TYPE={{ n8n_db_kind }}
{% if n8n_db_kind == 'postgres' -%}
DB_POSTGRESDB_HOST={{ n8n_db_host }}
DB_POSTGRESDB_PORT={{ n8n_db_port }}
DB_POSTGRESDB_DATABASE={{ n8n_db_name }}
DB_POSTGRESDB_USER={{ n8n_db_user }}
DB_POSTGRESDB_PASSWORD={{ n8n_db_password }}
{% else -%}
DB_MYSQLDB_HOST={{ n8n_db_host }}
DB_MYSQLDB_PORT={{ n8n_db_port }}
DB_MYSQLDB_DATABASE={{ n8n_db_name }}
DB_MYSQLDB_USER={{ n8n_db_user }}
DB_MYSQLDB_PASSWORD={{ n8n_db_password }}
{% endif -%}

23
templates/n8n.md.j2 Normal file
View File

@@ -0,0 +1,23 @@
# n8n Setup
## Configured n8n Sites
{% if n8n_sites | length > 0 %}
{% for site in n8n_sites %}
- **Name:** {{ site.name }}
- **Deploy Type:** {{ site.deploy_type }}
- **Path:** {{ site.path | default('/srv/' + site.name) }}
- **Host:** {{ (site.app_options | default({})).host | default(n8n_default_host) }}
- **Port:** {{
((site.docker_options | default({})).listen_port
if site.deploy_type == 'docker' else (site.app_options | default({})).port)
| default(n8n_default_port)
}}
- **Protocol:** {{ (site.app_options | default({})).protocol | default(n8n_default_protocol) }}
- **Image:** {{ (site.docker_options | default({})).image | default(n8n_default_image) if site.deploy_type == 'docker' else '' }}
- **Repo:** {{ (site.app_options | default({})).repo_path | default(n8n_default_repo) if site.deploy_type == 'repo' else '' }}
- **Package:** {{ (site.app_options | default({})).package_name | default(n8n_default_package_name) if site.deploy_type == 'package' else '' }}
{% endfor %}
{% else %}
No n8n sites configured.
{% endif %}