mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
swarm-exec reaches a DinD node; reaching a swarm service container (moodle, openldap) needed a nested docker exec. Add swarm-app-exec, which resolves one running replica on the node and runs a base64-encoded command inside it, so live in-container inspection stays on a sanctioned make helper. Adding a second exec_* script tripped the prefix-group lint, so exec_node.sh moves to exec/node.sh and the new one lands at exec/service.sh. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 lines
587 B
Bash
Executable File
17 lines
587 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
: "${node:?node= must be set, e.g. node=swarm-mgr-01}"
|
|
: "${cmd:?cmd= must be set, e.g. cmd='docker service ls'}"
|
|
|
|
if ! docker inspect --format '{{.State.Running}}' "${node}" 2>/dev/null | grep -q '^true$'; then
|
|
echo "ERROR: container '${node}' is not running." >&2
|
|
echo "Available swarm-test containers (if any):" >&2
|
|
docker ps --format ' {{.Names}}\t{{.Status}}' |
|
|
grep -E 'swarm-|nfs-server' >&2 ||
|
|
echo " (none — run \`make swarm-zombie app=<id>\` first)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
docker exec -i "${node}" bash --noprofile --norc -c "${cmd}"
|