diff --git a/ct/n8n.sh b/ct/n8n.sh index bd542d17e2..c23b4a79c7 100644 --- a/ct/n8n.sh +++ b/ct/n8n.sh @@ -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 </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}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5678${CL}" diff --git a/frontend/public/json/n8n.json b/frontend/public/json/n8n.json index 7ab0ed00be..3dbff38c0f 100644 --- a/frontend/public/json/n8n.json +++ b/frontend/public/json/n8n.json @@ -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" + } + ] } diff --git a/install/n8n-install.sh b/install/n8n-install.sh index 7496a85959..3d83f19286 100644 --- a/install/n8n-install.sh +++ b/install/n8n-install.sh @@ -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 </opt/n8n.env +N8N_SECURE_COOKIE=false +N8N_PORT=5678 +N8N_PROTOCOL=http +N8N_HOST=$HOST_IP +EOF + cat </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