homelab-codex-ws/scripts/deploy/deploy-stability-agent.sh

44 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# deploy-stability-agent.sh - Helper to deploy stability-agent (print or SSH)
TARGET=$1
MODE="print"
REPO_PATH="~/homelab-codex-ws"
if [[ "$2" == "--ssh" ]]; then
MODE="ssh"
fi
if [[ -z "$TARGET" ]]; then
echo "Usage: $0 <node-name> [--ssh]"
echo "Supported nodes: chelsty, piha, solaria, vps"
exit 1
fi
case "$TARGET" in
chelsty|piha|solaria|vps)
;;
*)
echo "Error: Unknown node '$TARGET'"
echo "Supported nodes: chelsty, piha, solaria, vps"
exit 1
;;
esac
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