yams/tests/integration/p2p_mesh/node.sh
trvon 69b8bdcd54
test(p2p): add docker mesh harness for N-node direct memory-sync convergence
Production meshes (transport=direct, full mesh, operator-pinned mutual TLS)
stalled at a fixed record count with failed_cycles=0 because a failed inbound
apply stage skipped the node's own publish. Reproducing that needs several
real daemons with enrolled pins and a corpus of embeddings and topology
edges authored on different nodes, so add tests/integration/p2p_mesh:

- Dockerfile and node entrypoint that run prebuilt yams/yams-daemon from a
  host build dir or a released .deb, one isolated volume per node.
- mesh.py (stdlib only) with up/seed/converge/status/chaos/run/down. It
  generates writer keys and manifests, enrolls every peer pin and connects
  a full mesh the way an operator does, and records apply-health counters
  when the build reports them.

Local/manual tooling only; not wired into any CI.

Signed-off-by: trvon <me@trevon.dev>
2026-10-01 12:20:26 -06:00

21 lines
766 B
Bash

#!/bin/sh
# Container entrypoint. mesh.py generates keys and writes the config through `docker exec` while
# this process idles, then creates /node/ready. Waiting here (instead of starting the daemon
# straight away) lets `docker restart` re-run the same daemon with the same node id and data dir.
set -eu
mkdir -p /node/home /node/data /node/log /node/run \
"${XDG_CONFIG_HOME}" "${XDG_DATA_HOME}" "${XDG_STATE_HOME}"
chmod 700 /node/run
while [ ! -f /node/ready ]; do
sleep 0.3
done
rm -f "${YAMS_DAEMON_SOCKET}"
exec yams-daemon --foreground \
--config "${XDG_CONFIG_HOME}/yams/config.toml" \
--socket "${YAMS_DAEMON_SOCKET}" \
--data-dir "${YAMS_DATA_DIR}" \
--log-file /node/log/daemon.log \
--log-level "${MESH_LOG_LEVEL:-info}"