Skip to content

Commit 079b089

Browse files
authored
Alpine Node-RED (#3457)
* Alpine Node-RED * Update alpine-node-red-install.sh
1 parent 8300d77 commit 079b089

File tree

3 files changed

+119
-2
lines changed

3 files changed

+119
-2
lines changed

ct/alpine-node-red.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://nodered.org
7+
8+
APP="Alpine-Node-RED"
9+
var_tags="${var_tags:-alpine;automation}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-256}"
12+
var_disk="${var_disk:-1}"
13+
var_os="${var_os:-alpine}"
14+
var_version="${var_version:-3.21}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
msg_info "Updating Alpine Packages"
24+
$STD apk update
25+
$STD apk upgrade
26+
msg_ok "Updated Alpine Packages"
27+
28+
msg_info "Updating Node.js and npm"
29+
$STD apk upgrade nodejs npm
30+
msg_ok "Updated Node.js and npm"
31+
32+
msg_info "Updating Node-RED"
33+
$STD npm install -g --unsafe-perm node-red
34+
msg_ok "Updated Node-RED"
35+
36+
msg_info "Restarting Node-RED"
37+
$STD rc-service nodered restart
38+
msg_ok "Restarted Node-RED"
39+
40+
exit 0
41+
}
42+
43+
start
44+
build_container
45+
description
46+
47+
msg_ok "Completed Successfully!\n"
48+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
49+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
50+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:1880${CL}"

frontend/public/json/node-red.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
"os": "debian",
2525
"version": "12"
2626
}
27+
},
28+
{
29+
"type": "alpine",
30+
"script": "ct/alpine-node-red.sh",
31+
"resources": {
32+
"cpu": 1,
33+
"ram": 256,
34+
"hdd": 1,
35+
"os": "alpine",
36+
"version": "3.21"
37+
}
2738
}
2839
],
2940
"default_credentials": {
@@ -32,8 +43,8 @@
3243
},
3344
"notes": [
3445
{
35-
"text": "To install themes, type `update` in the LXC console.",
46+
"text": "To install themes, type `update` in the LXC console. (debian/ubuntu only)",
3647
"type": "info"
3748
}
3849
]
39-
}
50+
}

install/alpine-node-red-install.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://nodered.org/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apk add --no-cache \
18+
gpg \
19+
git \
20+
nodejs \
21+
npm
22+
msg_ok "Installed Dependencies"
23+
24+
msg_info "Creating Node-RED User"
25+
adduser -D -H -s /sbin/nologin -G users nodered
26+
msg_ok "Created Node-RED User"
27+
28+
msg_info "Installing Node-RED"
29+
npm install -g --unsafe-perm node-red
30+
msg_ok "Installed Node-RED"
31+
32+
msg_info "Creating Node-RED Service"
33+
service_path="/etc/init.d/nodered"
34+
35+
echo '#!/sbin/openrc-run
36+
description="Node-RED Service"
37+
38+
command="/usr/bin/node-red"
39+
command_args="--max-old-space-size=128 -v"
40+
command_user="nodered"
41+
pidfile="/var/run/nodered.pid"
42+
43+
depend() {
44+
use net
45+
}' >$service_path
46+
47+
chmod +x $service_path
48+
$STD rc-update add nodered default
49+
msg_ok "Created Node-RED Service"
50+
51+
msg_info "Starting Node-RED"
52+
$STD service nodered start
53+
msg_ok "Started Node-RED"
54+
55+
motd_ssh
56+
customize

0 commit comments

Comments
 (0)