Remove Node-RED stack and associated configurations

This commit is contained in:
Brian Pooe 2026-06-17 18:42:57 +02:00
parent fc2d5b24ca
commit 78f42fc7ca
11 changed files with 6 additions and 278 deletions

View file

@ -32,13 +32,6 @@ SERVER_COUNTRIES=
# Home Automation
SLZB06_HOST=
# Node-RED
HA_URL=http://homeassistant:8123
# Long-Lived Access Token from HA: Profile → Security → Long-lived access tokens
HA_TOKEN=
# Auto-generated by setup-node-red.sh if left empty — do not change after first run
NODE_RED_CREDENTIAL_SECRET=
# Database
POSTGRES_USER=
POSTGRES_PASSWORD=

View file

@ -25,7 +25,6 @@ networking, troubleshooting, and backup.
| [Gramps Web](docker-compose-files/gramps-web/README.md) | Genealogy web application |
| [Home Assistant](docker-compose-files/homeassistant/README.md) | Home Assistant, Mosquitto, and Zigbee2MQTT |
| [Immich](docker-compose-files/immich/README.md) | Photo and video management with GPU acceleration |
| [Node-RED](docker-compose-files/node-red/README.md) | Flow automation with Home Assistant integration |
| [PostgreSQL](docker-compose-files/postgres/README.md) | PostgreSQL and pgAdmin |
| [Technitium DNS](docker-compose-files/technitium/README.md) | DNS server and ad blocking |
| [Vault](docker-compose-files/vault/README.md) | HashiCorp Vault secrets management |
@ -40,8 +39,8 @@ docker compose -f docker-compose.<stack>.yml config --quiet
docker compose -f docker-compose.<stack>.yml up -d
```
Home Assistant and Node-RED use their setup scripts instead. Arr Stack, Caddy,
and Gramps Web render additional configuration templates.
Home Assistant uses its setup script instead. Arr Stack, Caddy, and Gramps Web
render additional configuration templates.
## Requirements

View file

@ -175,11 +175,6 @@ z2m.{{CADDY_BASE_DOMAIN:-home.example.com}} {
reverse_proxy {{CADDY_IOT_PREFIX:-10.0.30}}.6:8080
}
node-red.{{CADDY_BASE_DOMAIN:-home.example.com}} {
import common
reverse_proxy {{CADDY_IOT_PREFIX:-10.0.30}}.6:1880
}
#### Proxmox Apps
bento-pdf.{{CADDY_BASE_DOMAIN:-home.example.com}} {
import common

View file

@ -18,7 +18,7 @@ listener 1883
protocol mqtt
allow_anonymous true
# WebSocket listener (used by browser-based MQTT clients, Node-RED dashboard, etc.)
# WebSocket listener (used by browser-based MQTT clients, etc.)
listener 9001
protocol websockets
allow_anonymous true

View file

@ -1,6 +0,0 @@
FROM nodered/node-red:latest
# Install the Home Assistant websocket node into Node-RED's own module directory
# (/usr/src/node-red), NOT into /data — so the /data volume mount does not hide it.
RUN npm install --no-update-notifier --no-fund --omit=dev \
node-red-contrib-home-assistant-websocket

View file

@ -1,87 +0,0 @@
# Node-RED
Docker deployment for Node-RED with the Home Assistant websocket integration.
Run all commands from the repository root.
## Persistent Data
Node-RED flows, credentials, and runtime state are stored in the
Docker-managed named volume `node_red_data`. The setup script creates the
generated read-only `appdata/node-red/settings.js` host mount.
Existing deployments that store all Node-RED state in `appdata/node-red` must
copy that state into the named volume before recreating the container.
## Installation
1. Deploy the Home Assistant stack first, then create `.env` if needed:
```bash
cp -n .env.sample .env
```
2. Set the required values in `.env`:
```dotenv
TZ=Africa/Johannesburg
HA_URL=http://homeassistant:8123
HA_TOKEN=<home-assistant-long-lived-access-token>
DOCKERLOGGING_MAXFILE=3
DOCKERLOGGING_MAXSIZE=10m
```
`setup-node-red.sh` generates `NODE_RED_CREDENTIAL_SECRET` if it is empty.
3. Render settings and generate Compose:
```bash
./setup-node-red.sh
```
4. Validate, build, and start Node-RED:
```bash
docker compose -f docker-compose.node-red.yml config --quiet
docker compose -f docker-compose.node-red.yml up -d --build
```
5. Verify the container and open `http://<HOST_IP>:1880`:
```bash
docker compose -f docker-compose.node-red.yml ps
docker compose -f docker-compose.node-red.yml logs --tail=100 node-red
```
## Apply Configuration Changes
```bash
./setup-node-red.sh
docker compose -f docker-compose.node-red.yml up -d --build
```
Do not change `NODE_RED_CREDENTIAL_SECRET` after saving credentials.
## Initial Setup
Add a Home Assistant server node using `$(HA_URL)` and `$(HA_TOKEN)`.
## Network Requirements
The Home Assistant stack must be running because Node-RED joins the external
`ha_network`.
## Troubleshooting
If startup fails with a missing network, start `docker-compose.homeassistant.yml`
first.
## Useful Commands
```bash
docker compose -f docker-compose.node-red.yml restart node-red
```
## Backup
Back up the `node_red_data` named volume,
`appdata/node-red/settings.js`, and `NODE_RED_CREDENTIAL_SECRET`.

View file

@ -1,11 +0,0 @@
module.exports = {
// Substituted from .env by setup-node-red.sh — do not edit the appdata copy directly.
// If this changes, all saved credentials (HA token, etc.) become unreadable.
credentialSecret: '{{NODE_RED_CREDENTIAL_SECRET}}',
editorTheme: {
projects: {
enabled: false
}
}
};

View file

@ -1,66 +0,0 @@
# Node-RED — Standalone with Home Assistant integration
#
# Joins ha-network so Node-RED can reach Home Assistant by container name:
# http://homeassistant:8123
#
# HA_URL and HA_TOKEN are passed as container env vars so the token stays out of
# flow files. When adding the HA server node in the editor, set the fields to:
# URL: $(HA_URL)
# Token: $(HA_TOKEN)
# Node-RED will expand them at runtime. Changing the token then only requires
# updating .env and restarting the container — no flow editing needed.
#
# Required .env variables:
# NODE_RED_CREDENTIAL_SECRET — auto-generated by setup-node-red.sh if missing
# HA_TOKEN — Long-Lived Access Token from HA profile page
# HA_URL — defaults to http://homeassistant:8123
#
# Before first run:
# 1. Add HA_TOKEN to your .env (HA Profile → Security → Long-lived access tokens)
# 2. Run: ./setup-node-red.sh
# 3. Build and start: docker compose -f docker-compose.node-red.yml up -d --build
# 4. Open http://<host>:1880, add the HA server node using $(HA_URL) and $(HA_TOKEN)
services:
node-red:
build:
context: {{NODE_RED_BUILD_CONTEXT}}
image: node-red-ha:local
container_name: node-red
restart: unless-stopped
networks:
- ha-network
ports:
- "1880:1880"
environment:
TZ: {{TZ}}
HA_URL: "{{HA_URL:-http://homeassistant:8123}}"
HA_TOKEN: "{{HA_TOKEN}}"
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- node_red_data:/data
- ./appdata/node-red/settings.js:/data/settings.js:ro
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 128M
security_opt:
- no-new-privileges:true
logging:
driver: json-file
options:
max-file: "{{DOCKERLOGGING_MAXFILE}}"
max-size: "{{DOCKERLOGGING_MAXSIZE}}"
networks:
# Join the existing HA network so Node-RED resolves homeassistant:8123 by container name.
# The HA stack must be running before Node-RED starts.
ha-network:
external: true
name: ha_network
volumes:
node_red_data:

View file

@ -242,7 +242,7 @@ docker compose -f docker-compose.caddy.yml logs --tail=100 caddy
The same risk applies to any writable bind mount when Docker uses rootless or
user-namespace mapping. The Caddy, Beszel Agent, PostgreSQL/pgAdmin,
Technitium, Gramps Web, Node-RED, Home Assistant, and Mosquitto templates use
Technitium, Gramps Web, Home Assistant, and Mosquitto templates use
named volumes for application state to avoid this issue.
Arr Stack, Gramps media, Vault config/TLS, and other explicit external storage

View file

@ -255,7 +255,7 @@ destination zone `IOT`, and protocol TCP:
| Policy name | Destination IP | Destination port(s) | Purpose |
|---|---|---|---|
| `ALLOW CADDY to Zigbee` | `10.0.30.5` | `80` | SLZB-06U web UI |
| `ALLOW CADDY to Home Automation` | `10.0.30.6` | `1880,8080,8123` | Node-RED, Zigbee2MQTT, and Home Assistant |
| `ALLOW CADDY to Home Automation` | `10.0.30.6` | `8080,8123` | Zigbee2MQTT, and Home Assistant |
### 5.6 RFC1918 block policies
@ -419,7 +419,7 @@ unenforced by policy.
| 6 | IOT | `Gateway` | Block | any | No UDM admin |
| 7 | IOT | any | Block | any | Drop all other unmatched traffic |
Home Assistant, Zigbee2MQTT, Node-RED, and SLZB-06U remain inside IOT. Their
Home Assistant, Zigbee2MQTT, and SLZB-06U remain inside IOT. Their
east-west traffic is permitted by the IOT intra-zone rule.
| # | From | To | Action | Protocol/Port | Purpose |

View file

@ -1,89 +0,0 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APPDATA="$SCRIPT_DIR/appdata"
STACK_DIR="$SCRIPT_DIR/docker-compose-files/node-red"
ENV_FILE="$SCRIPT_DIR/.env"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
# Parse a single value from the .env file safely (no sourcing)
get_env_value() {
local key="$1"
local line value
line=$(grep -E "^${key}=" "$ENV_FILE" 2>/dev/null | tail -1) || true
value="${line#*=}"
if [[ "$value" =~ ^\"(.*)\"[[:space:]]*(#.*)?$ ]]; then
value="${BASH_REMATCH[1]}"
elif [[ "$value" =~ ^\'(.*)\'[[:space:]]*(#.*)?$ ]]; then
value="${BASH_REMATCH[1]}"
fi
printf '%s' "$value"
}
echo "==> Checking required .env variables"
REQUIRED_VARS=(TZ HA_TOKEN DOCKERLOGGING_MAXFILE DOCKERLOGGING_MAXSIZE)
MISSING=()
for var in "${REQUIRED_VARS[@]}"; do
if [[ -z "$(get_env_value "$var")" ]]; then
MISSING+=("$var")
fi
done
if [[ ${#MISSING[@]} -gt 0 ]]; then
echo "Error: missing required variables in .env:"
for var in "${MISSING[@]}"; do echo " - $var"; done
exit 1
fi
# Auto-generate NODE_RED_CREDENTIAL_SECRET if not already in .env
if [[ -z "$(get_env_value "NODE_RED_CREDENTIAL_SECRET")" ]]; then
echo "==> Generating NODE_RED_CREDENTIAL_SECRET and saving to .env"
SECRET="$(openssl rand -hex 32)"
printf '\nNODE_RED_CREDENTIAL_SECRET="%s"\n' "$SECRET" >> "$ENV_FILE"
echo " Generated: $SECRET"
fi
# Build a minimal .env containing only the variables each template needs.
write_minimal_env() {
local tmp_env="$1"; shift
: > "$tmp_env"
for var in "$@"; do
local val
val=$(get_env_value "$var")
printf '%s="%s"\n' "$var" "$val" >> "$tmp_env"
done
}
echo "==> Creating appdata directory at $APPDATA/node-red"
sudo mkdir -p "$APPDATA/node-red"
echo "==> Substituting settings.js"
write_minimal_env "$TMP_DIR/env.settings" NODE_RED_CREDENTIAL_SECRET
"$SCRIPT_DIR/substitute_env.sh" \
"$STACK_DIR/config/settings.js" \
"$TMP_DIR/settings.js" \
"$TMP_DIR/env.settings"
sudo cp "$TMP_DIR/settings.js" "$APPDATA/node-red/settings.js"
sudo chmod 644 "$APPDATA/node-red/settings.js"
echo "==> Generating docker-compose.node-red.yml"
# NODE_RED_BUILD_CONTEXT is the absolute path to the Dockerfile directory.
# It is injected at generation time so docker compose can find the Dockerfile
# regardless of which directory the compose file is run from.
NODE_RED_BUILD_CONTEXT="$STACK_DIR"
write_minimal_env "$TMP_DIR/env.compose" TZ HA_URL HA_TOKEN DOCKERLOGGING_MAXFILE DOCKERLOGGING_MAXSIZE
printf 'NODE_RED_BUILD_CONTEXT="%s"\n' "$NODE_RED_BUILD_CONTEXT" >> "$TMP_DIR/env.compose"
"$SCRIPT_DIR/substitute_env.sh" \
"$STACK_DIR/template.yaml" \
"$SCRIPT_DIR/docker-compose.node-red.yml" \
"$TMP_DIR/env.compose"
echo ""
echo "Done. From the repository root, run:"
echo " docker compose -f docker-compose.node-red.yml up -d --build"
echo ""
echo "Then open http://<host>:1880 and add the Home Assistant server node"
echo " URL: \$(HA_URL) → http://homeassistant:8123"
echo " Token: \$(HA_TOKEN) → your Long-Lived Access Token from HA profile"