Pumping-station demo overhaul + cross-node test harness + bumps
Some checks failed
CI / lint-and-test (push) Has been cancelled

Submodule bumps land the deadlock fix (state.js residue unpark + MGC
optimalControl dispatch reorder) and pumpingStation stopLevel hysteresis.

- Renames examples/pumpingstation-3pumps-dashboard →
  pumpingstation-complete-example with regenerated flow.json. New
  dashboard groups, demand-broadcast wiring, S88 placement rule
  applied, ui-chart trend-split and link-channel naming follow
  .claude/rules/node-red-flow-layout.md.
- New cross-node test harness under test/: end-to-end-pumpingstation
  drives PS + MGC + 3 pumps + physics simulator end-to-end and
  verifies the ~5/15 min cycle.
- Adds Grafana provisioning dashboards (pumping-station.json) and a
  helper sync-example.sh script for export/import to live Node-RED.
- Docker entrypoint + settings + compose tweaks for the persistent
  user dir layout used by the demo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rene De Ren
2026-05-08 11:21:21 +02:00
parent ca0644d689
commit 0cab98c196
21 changed files with 5863 additions and 2745 deletions

View File

@@ -63,18 +63,90 @@ npm install --no-save "$EVOLV_DIR" 2>/dev/null || {
echo "[entrypoint] EVOLV nodes installed into Node-RED user dir."
# -------------------------------------------------------
# 4. Deploy demo flow if no user flow exists yet
# 4. Bootstrap Node-RED projects from examples/
#
# Each examples/<name>/ becomes a project under /data/projects/<name>/.
# The Projects feature (settings.js) needs each project to be a Git
# repo, so we git-init each on first copy. After that the projects
# live in the persistent nodered_data volume.
#
# Default project: pumpingstation-complete-example (settable via
# DEFAULT_PROJECT env var).
# -------------------------------------------------------
PROJECTS_DIR="/data/projects"
DEFAULT_PROJECT="${DEFAULT_PROJECT:-pumpingstation-complete-example}"
mkdir -p "$PROJECTS_DIR"
if [ -d "$EVOLV_DIR/examples" ]; then
for src in "$EVOLV_DIR/examples"/*/; do
[ -d "$src" ] || continue
name=$(basename "$src")
dst="$PROJECTS_DIR/$name"
if [ -d "$dst" ]; then
echo "[entrypoint] Project '$name' already exists in /data/projects, skipping bootstrap."
continue
fi
echo "[entrypoint] Bootstrapping project '$name'..."
cp -r "$src" "$dst"
# Synthesize a Node-RED project package.json so the project is
# recognised even when the source folder doesn't have one.
if [ ! -f "$dst/package.json" ]; then
cat > "$dst/package.json" << PKGJSON
{
"name": "$name",
"description": "EVOLV example: $name",
"version": "0.1.0",
"private": true,
"node-red": {
"settings": {
"flowFile": "flow.json",
"credentialsFile": "flow_cred.json"
}
}
}
PKGJSON
fi
# Git init + initial commit (Node-RED projects require Git).
if [ ! -d "$dst/.git" ]; then
(
cd "$dst" && \
git init -q -b main && \
git config user.email "evolv-dev@local" && \
git config user.name "EVOLV Dev" && \
git add . && \
git commit -q -m "Bootstrap project $name from examples/" || true
)
fi
echo "[entrypoint] Project '$name' ready at $dst"
done
fi
# -------------------------------------------------------
# 4b. Set the active project (Node-RED's projects state lives in
# /data/.config.projects.json). Only set on first run; subsequent
# boots respect the operator's last selection in the editor.
# -------------------------------------------------------
PROJ_STATE="/data/.config.projects.json"
if [ ! -f "$PROJ_STATE" ] && [ -d "$PROJECTS_DIR/$DEFAULT_PROJECT" ]; then
echo "[entrypoint] Setting active project = $DEFAULT_PROJECT"
cat > "$PROJ_STATE" << JSON
{
"activeProject": "$DEFAULT_PROJECT",
"projects": {
"$DEFAULT_PROJECT": {}
}
}
JSON
fi
# Legacy demo-flow.json fallback — kept for the no-projects case if a
# user flips projects.enabled = false in settings.js.
DEMO_FLOW="$EVOLV_DIR/docker/demo-flow.json"
FLOW_FILE="/data/flows.json"
if [ -f "$DEMO_FLOW" ]; then
# Deploy demo flow if flows.json is missing or is the default stub
if [ ! -f "$FLOW_FILE" ] || grep -q "WARNING: please check" "$FLOW_FILE" 2>/dev/null; then
echo "[entrypoint] Deploying demo flow..."
cp "$DEMO_FLOW" "$FLOW_FILE"
echo "[entrypoint] Demo flow deployed to $FLOW_FILE"
fi
if [ -f "$DEMO_FLOW" ] && [ ! -f "$FLOW_FILE" ]; then
cp "$DEMO_FLOW" "$FLOW_FILE"
fi
# -------------------------------------------------------