thermograph/infra/deploy/swarm/join-swarm.sh
Emi Griffith ae1d9bb534 Subtree-merge thermograph-infra (origin/main) into infra/
git-subtree-dir: infra
git-subtree-mainline: d6df04eab2
git-subtree-split: 99b4b3f78d
2026-07-22 22:01:11 -07:00

19 lines
615 B
Bash
Executable file

#!/usr/bin/env bash
# Run ONCE on EACH worker node (beta, and the desktop — not the manager,
# prod). Joins the Swarm initialized by init-swarm.sh, over the WireGuard
# tunnel. The join token is the same for both workers.
set -euo pipefail
MANAGER_WG_IP="${1:?usage: $0 <manager_wg_ip> <join_token>}"
JOIN_TOKEN="${2:?}"
if docker info 2>/dev/null | grep -q "Swarm: active"; then
echo "This node is already part of a swarm:"
docker info 2>/dev/null | grep -A2 "Swarm:"
exit 0
fi
docker swarm join --token "$JOIN_TOKEN" "${MANAGER_WG_IP}:2377"
echo
echo "Joined. Verify from the manager: docker node ls"