1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-04-16 16:11:55 +00:00

Alpine Node-RED (#3457)

* Alpine Node-RED

* Update alpine-node-red-install.sh
This commit is contained in:
CanbiZ 2025-03-28 16:36:32 +01:00 committed by GitHub
parent 8300d7725d
commit 079b089518
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 119 additions and 2 deletions

50
ct/alpine-node-red.sh Normal file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://nodered.org
APP="Alpine-Node-RED"
var_tags="${var_tags:-alpine;automation}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-256}"
var_disk="${var_disk:-1}"
var_os="${var_os:-alpine}"
var_version="${var_version:-3.21}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
msg_info "Updating Alpine Packages"
$STD apk update
$STD apk upgrade
msg_ok "Updated Alpine Packages"
msg_info "Updating Node.js and npm"
$STD apk upgrade nodejs npm
msg_ok "Updated Node.js and npm"
msg_info "Updating Node-RED"
$STD npm install -g --unsafe-perm node-red
msg_ok "Updated Node-RED"
msg_info "Restarting Node-RED"
$STD rc-service nodered restart
msg_ok "Restarted Node-RED"
exit 0
}
start
build_container
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}:1880${CL}"

View File

@ -24,6 +24,17 @@
"os": "debian",
"version": "12"
}
},
{
"type": "alpine",
"script": "ct/alpine-node-red.sh",
"resources": {
"cpu": 1,
"ram": 256,
"hdd": 1,
"os": "alpine",
"version": "3.21"
}
}
],
"default_credentials": {
@ -32,8 +43,8 @@
},
"notes": [
{
"text": "To install themes, type `update` in the LXC console.",
"text": "To install themes, type `update` in the LXC console. (debian/ubuntu only)",
"type": "info"
}
]
}
}

View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://nodered.org/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apk add --no-cache \
gpg \
git \
nodejs \
npm
msg_ok "Installed Dependencies"
msg_info "Creating Node-RED User"
adduser -D -H -s /sbin/nologin -G users nodered
msg_ok "Created Node-RED User"
msg_info "Installing Node-RED"
npm install -g --unsafe-perm node-red
msg_ok "Installed Node-RED"
msg_info "Creating Node-RED Service"
service_path="/etc/init.d/nodered"
echo '#!/sbin/openrc-run
description="Node-RED Service"
command="/usr/bin/node-red"
command_args="--max-old-space-size=128 -v"
command_user="nodered"
pidfile="/var/run/nodered.pid"
depend() {
use net
}' >$service_path
chmod +x $service_path
$STD rc-update add nodered default
msg_ok "Created Node-RED Service"
msg_info "Starting Node-RED"
$STD service nodered start
msg_ok "Started Node-RED"
motd_ssh
customize