feat(swarm): per-host microservices as systemd units, mutator off agents

Previously `decnet status` on an agent showed every microservice as DOWN
because deploy's auto-spawn was unihost-scoped and the agent CLI gate
hid the per-host commands. Now:

  - collect, probe, profiler, sniffer drop out of MASTER_ONLY_COMMANDS
    (they run per-host; master-side work stays master-gated).
  - mutate stays master-only (it orchestrates swarm-wide respawns).
  - decnet/mutator/ excluded from agent tarballs — never invoked there.
  - decnet/web exclusion tightened: ship db/ + auth.py + dependencies.py
    (profiler needs the repo singleton), drop api.py, swarm_api.py,
    ingester.py, router/, templates/.
  - Four new systemd unit templates (decnet-collector/prober/profiler/
    sniffer) shipped in every enrollment tarball.
  - enroll_bootstrap.sh enables + starts all four alongside agent and
    forwarder at install time.
  - updater restarts the aux units on code push so they pick up the new
    release (best-effort — legacy enrollments without the units won't
    fail the update).
  - status table hides Mutator + API rows in agent mode.
This commit is contained in:
2026-04-19 18:58:48 -04:00
parent ee9ade4cd5
commit 6d7877c679
10 changed files with 172 additions and 19 deletions

View File

@@ -60,15 +60,24 @@ chmod 0755 "$VENV_DIR/bin/decnet"
ln -sf "$VENV_DIR/bin/decnet" /usr/local/bin/decnet
echo "[DECNET] installing systemd units..."
install -Dm0644 etc/systemd/system/decnet-agent.service /etc/systemd/system/decnet-agent.service
install -Dm0644 etc/systemd/system/decnet-forwarder.service /etc/systemd/system/decnet-forwarder.service
install -Dm0644 etc/systemd/system/decnet-engine.service /etc/systemd/system/decnet-engine.service
for unit in \
decnet-agent decnet-forwarder decnet-engine \
decnet-collector decnet-prober decnet-profiler decnet-sniffer; do
install -Dm0644 "etc/systemd/system/${unit}.service" "/etc/systemd/system/${unit}.service"
done
if [[ "$WITH_UPDATER" == "true" ]]; then
install -Dm0644 etc/systemd/system/decnet-updater.service /etc/systemd/system/decnet-updater.service
fi
systemctl daemon-reload
ACTIVE_UNITS=(decnet-agent.service decnet-forwarder.service)
# Agent + forwarder are the control plane; collector/prober/profiler/sniffer
# are the per-host microservices that used to require `decnet deploy` to
# auto-spawn. With systemd units they come up at boot and auto-restart.
ACTIVE_UNITS=(
decnet-agent.service decnet-forwarder.service
decnet-collector.service decnet-prober.service
decnet-profiler.service decnet-sniffer.service
)
if [[ "$WITH_UPDATER" == "true" ]]; then
ACTIVE_UNITS+=(decnet-updater.service)
fi