2026-05-17 15:54:19 +02:00
|
|
|
#!/usr/bin/env bash
|
2026-05-17 17:32:10 +02:00
|
|
|
# deploy-stability-agent.sh - Helper to deploy stability-agent (print or SSH)
|
2026-05-17 15:54:19 +02:00
|
|
|
|
2026-05-17 17:32:10 +02:00
|
|
|
TARGET=$1
|
|
|
|
|
MODE="print"
|
2026-05-17 15:54:19 +02:00
|
|
|
REPO_PATH="~/homelab-codex-ws"
|
|
|
|
|
|
2026-05-17 17:32:10 +02:00
|
|
|
if [[ "$2" == "--ssh" ]]; then
|
|
|
|
|
MODE="ssh"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ -z "$TARGET" ]]; then
|
|
|
|
|
echo "Usage: $0 <node-name> [--ssh]"
|
2026-05-17 15:54:19 +02:00
|
|
|
echo "Supported nodes: chelsty, piha, solaria, vps"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-05-17 17:32:10 +02:00
|
|
|
case "$TARGET" in
|
2026-05-17 15:54:19 +02:00
|
|
|
chelsty|piha|solaria|vps)
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2026-05-17 17:32:10 +02:00
|
|
|
echo "Error: Unknown node '$TARGET'"
|
2026-05-17 15:54:19 +02:00
|
|
|
echo "Supported nodes: chelsty, piha, solaria, vps"
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
2026-05-17 17:32:10 +02:00
|
|
|
if [[ "$MODE" == "ssh" ]]; then
|
|
|
|
|
echo "--- Deploying to $TARGET via SSH ---"
|
|
|
|
|
ssh "$TARGET" "cd $REPO_PATH && git fetch origin && git checkout master && git pull && cd services/stability-agent && ./deploy-local.sh"
|
|
|
|
|
else
|
|
|
|
|
echo "# --- Deployment commands for $TARGET ---"
|
|
|
|
|
echo "cd $REPO_PATH"
|
|
|
|
|
echo "git fetch origin"
|
|
|
|
|
echo "git checkout master"
|
|
|
|
|
echo "git pull"
|
|
|
|
|
echo "cd services/stability-agent"
|
|
|
|
|
echo "./deploy-local.sh"
|
|
|
|
|
echo ""
|
|
|
|
|
echo "# Notes:"
|
|
|
|
|
echo "# - Run './deploy-local.sh' on the target host."
|
|
|
|
|
echo "# - Ensure /opt/homelab/state and /opt/homelab/events exist on the host."
|
|
|
|
|
fi
|