Fix stability agent fleet deploy scripts
This commit is contained in:
parent
b7faac00c5
commit
b129f03837
|
|
@ -13,22 +13,25 @@ Previously, the `stability-agent` had `NODE_NAME` defaulted to `chelsty` and was
|
|||
|
||||
## Deployment
|
||||
|
||||
Use the helper script to deploy or generate commands:
|
||||
Use the helper script to deploy or generate commands. The script uses explicit Tailscale IPs for remote targets (piha, chelsty, vps) and runs locally for solaria.
|
||||
|
||||
```bash
|
||||
# Print commands
|
||||
./scripts/deploy/deploy-stability-agent.sh <node-name>
|
||||
|
||||
# Deploy via SSH (requires SSH access to the node)
|
||||
# Deploy via SSH (executes ssh oskar@<ip>)
|
||||
./scripts/deploy/deploy-stability-agent.sh <node-name> --ssh
|
||||
```
|
||||
|
||||
### Manual Steps per Node
|
||||
The manual steps are encapsulated in `services/stability-agent/deploy-local.sh`. On the target node:
|
||||
```bash
|
||||
cd ~/homelab-codex-ws
|
||||
git pull
|
||||
cd /home/oskar/homelab-codex-ws
|
||||
git fetch origin
|
||||
git checkout master
|
||||
git pull origin master
|
||||
cd services/stability-agent
|
||||
./deploy-local.sh
|
||||
./deploy-local.sh <node-name>
|
||||
```
|
||||
|
||||
## Verification
|
||||
|
|
|
|||
|
|
@ -1,43 +1,55 @@
|
|||
#!/usr/bin/env bash
|
||||
# deploy-stability-agent.sh - Helper to deploy stability-agent (print or SSH)
|
||||
|
||||
TARGET=$1
|
||||
NODE=$1
|
||||
MODE="print"
|
||||
REPO_PATH="~/homelab-codex-ws"
|
||||
[[ "$2" == "--ssh" ]] && MODE="ssh"
|
||||
|
||||
if [[ "$2" == "--ssh" ]]; then
|
||||
MODE="ssh"
|
||||
fi
|
||||
|
||||
if [[ -z "$TARGET" ]]; then
|
||||
if [[ -z "$NODE" ]]; then
|
||||
echo "Usage: $0 <node-name> [--ssh]"
|
||||
echo "Supported nodes: chelsty, piha, solaria, vps"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$TARGET" in
|
||||
chelsty|piha|solaria|vps)
|
||||
;;
|
||||
case "$NODE" in
|
||||
piha) TARGET="100.108.208.3" ;;
|
||||
chelsty) TARGET="100.122.201.22" ;;
|
||||
vps) TARGET="100.95.58.48" ;;
|
||||
solaria) TARGET="local" ;;
|
||||
*)
|
||||
echo "Error: Unknown node '$TARGET'"
|
||||
echo "Error: Unknown node '$NODE'"
|
||||
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 "HOST: $NODE"
|
||||
echo "MODE: $MODE"
|
||||
echo "TARGET: $TARGET"
|
||||
|
||||
REPO_PATH="/home/oskar/homelab-codex-ws"
|
||||
|
||||
if [[ "$NODE" == "solaria" ]]; then
|
||||
if [[ "$MODE" == "ssh" ]]; then
|
||||
echo "--- Running local deployment for solaria ---"
|
||||
cd "$REPO_PATH" && git fetch origin && git checkout master && git pull origin master && cd services/stability-agent && ./deploy-local.sh solaria
|
||||
else
|
||||
echo "# --- Deployment commands for solaria ---"
|
||||
echo "cd $REPO_PATH"
|
||||
echo "git fetch origin"
|
||||
echo "git checkout master"
|
||||
echo "git pull"
|
||||
echo "git pull origin master"
|
||||
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."
|
||||
echo "./deploy-local.sh solaria"
|
||||
fi
|
||||
else
|
||||
# Remote nodes
|
||||
SSH_CMD="ssh oskar@$TARGET 'cd $REPO_PATH && git fetch origin && git checkout master && git pull origin master && cd services/stability-agent && ./deploy-local.sh $NODE'"
|
||||
if [[ "$MODE" == "ssh" ]]; then
|
||||
echo "--- Deploying to $NODE ($TARGET) via SSH ---"
|
||||
eval "$SSH_CMD"
|
||||
else
|
||||
echo "# --- Deployment commands for $NODE ---"
|
||||
echo "$SSH_CMD"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -4,8 +4,26 @@
|
|||
|
||||
set -e
|
||||
|
||||
# Node resolution: positional argument takes precedence over NODE_NAME env
|
||||
NODE_NAME=${1:-$NODE_NAME}
|
||||
|
||||
if [[ -z "$NODE_NAME" ]]; then
|
||||
echo "Usage: $0 <node-name>"
|
||||
echo "Example: $0 piha"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validation
|
||||
case "$NODE_NAME" in
|
||||
piha|chelsty|solaria|vps)
|
||||
;;
|
||||
*)
|
||||
echo "Error: Invalid node '$NODE_NAME'. Must be one of: piha, chelsty, solaria, vps"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Default values
|
||||
NODE_NAME=${NODE_NAME:-$(hostname)}
|
||||
REDIS_HOST=${REDIS_HOST:-100.108.208.3}
|
||||
REDIS_PORT=${REDIS_PORT:-6379}
|
||||
REDIS_ENABLED=${REDIS_ENABLED:-true}
|
||||
|
|
|
|||
Loading…
Reference in a new issue