n8n: refactor environmentfile (#6297)

* n8n: add config path

* n8n: refactor servicefile to seperate env

* n8n: refactor envfile

* Update n8n.sh

* Update n8n.json

---------

Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
This commit is contained in:
Tobias 2025-07-28 13:33:51 +02:00 committed by GitHub
parent 9c50105e86
commit 759239bc7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 5 deletions

View File

@ -34,6 +34,18 @@ function update_script() {
echo "Installed NPM..."
fi
fi
if [ ! -f /opt/n8n.env ]; then
sed -i 's|^Environment="N8N_SECURE_COOKIE=false"$|EnvironmentFile="/opt/n8n.env"|' /etc/systemd/system/n8n.service
HOST_IP=$(hostname -I | awk '{print $1}')
mkdir -p /opt
cat <<EOF >/opt/n8n.env
N8N_SECURE_COOKIE=false
N8N_PORT=5678
N8N_PROTOCOL=http
N8N_HOST=$HOST_IP
EOF
fi
msg_info "Updating ${APP} LXC"
$STD npm update -g n8n
systemctl restart n8n
@ -48,4 +60,4 @@ description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5678${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5678${CL}"

View File

@ -12,7 +12,7 @@
"documentation": "https://docs.n8n.io/",
"website": "https://n8n.io/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/n8n.webp",
"config_path": "",
"config_path": "/opt/n8n.env",
"description": "n8n is a workflow automation tool that enables users to automate various tasks and processes by connecting various data sources, systems, and services. It provides a visual interface for building workflows, allowing users to easily define and automate complex sequences of actions, such as data processing, conditional branching, and API calls. n8n supports a wide range of integrations, making it a versatile tool for automating a variety of use cases, from simple data processing workflows to complex business processes. With its extendable architecture, n8n is designed to be easily customizable and can be adapted to meet the specific needs of different users and industries.",
"install_methods": [
{
@ -31,5 +31,10 @@
"username": null,
"password": null
},
"notes": []
"notes": [
{
"text": "You may need to configure the `WEBHOOK_URL` in the config file when using a domain.",
"type": "info"
}
]
}

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# Author: tteck (tteckster) | Co-Author: CrazyWolf13
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://n8n.io/
@ -26,13 +26,22 @@ $STD npm install --global n8n
msg_ok "Installed n8n"
msg_info "Creating Service"
HOST_IP=$(hostname -I | awk '{print $1}')
mkdir -p /opt
cat <<EOF >/opt/n8n.env
N8N_SECURE_COOKIE=false
N8N_PORT=5678
N8N_PROTOCOL=http
N8N_HOST=$HOST_IP
EOF
cat <<EOF >/etc/systemd/system/n8n.service
[Unit]
Description=n8n
[Service]
Type=simple
Environment="N8N_SECURE_COOKIE=false"
EnvironmentFile="/opt/n8n.env"
ExecStart=n8n start
[Install]
WantedBy=multi-user.target