Load ~/.config/taler-monitoring/env (taler-monitoring-env profiles) before suite defaults. Drop hardcoded operator homes and host aliases from scripts; apply/staging/www/secrets/wallet via env.
59 lines
2.1 KiB
Bash
Executable file
59 lines
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# run-on-firecuda.sh — entrypoint for launchd/cron on outside-runner.
|
|
# Outside-only monitoring (SKIP_SSH=1), all 9 sites, then stage HTML to koopa.
|
|
#
|
|
# Installed path on outside-runner (default):
|
|
# ~/taler-monitoring-site-gen/site-gen/run-on-firecuda.sh
|
|
#
|
|
set -uo pipefail
|
|
|
|
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
|
|
|
ROOT=$(cd "$(dirname "$0")" && pwd)
|
|
LOG_DIR="${FIRECUDA_LOG_DIR:-$HOME/Library/Logs/taler-monitoring-sites}"
|
|
mkdir -p "$LOG_DIR"
|
|
STAMP=$(date +%Y%m%d-%H%M%S)
|
|
LOG="$LOG_DIR/run-${STAMP}.log"
|
|
exec >>"$LOG" 2>&1
|
|
|
|
echo "======== $(date -Iseconds 2>/dev/null || date) outside-runner monitoring sites ========"
|
|
|
|
# Always: public DNS only, no SSH checks into stacks
|
|
export SKIP_SSH=1
|
|
export CONTINUE_ON_ERROR=1
|
|
export AUTH401_CONTINUE=1
|
|
export RUNNER_SSH=
|
|
export PHASES_ERR="${PHASES_ERR:-urls versions}"
|
|
export PHASES_OK="${PHASES_OK:-urls versions}"
|
|
export WORK_ROOT="${WORK_ROOT:-$HOME/var/taler-monitoring-sites-work}"
|
|
export MONITORING_ROOT="${MONITORING_ROOT:-$ROOT/..}"
|
|
export DEPLOY_SSH="${DEPLOY_SSH:-}"
|
|
export DEPLOY_STAGING="${DEPLOY_STAGING:-${DEPLOY_STAGING:-$HOME/monitoring-sites-staging}}"
|
|
|
|
# Prefer full 9-site list from settings or defaults inside generate script
|
|
unset ONLY_HOSTS
|
|
|
|
cd "$ROOT" || exit 1
|
|
chmod +x generate-monitoring-sites.sh deploy-monitoring-sites.sh console_to_html.py 2>/dev/null || true
|
|
|
|
./generate-monitoring-sites.sh
|
|
ec=$?
|
|
|
|
# HTML stays on outside-runner under WORK_ROOT/html.
|
|
# Optional push to koopa if this host can SSH there (often only from laptop):
|
|
if [ -n "${DEPLOY_SSH:-}" ] && [ "${DEPLOY_FROM_FIRECUDA:-0}" = "1" ]; then
|
|
if [ -x ./deploy-monitoring-sites.sh ]; then
|
|
./deploy-monitoring-sites.sh || echo "WARN: deploy staging failed"
|
|
fi
|
|
else
|
|
echo "note: HTML at ${WORK_ROOT}/html — pull from laptop:"
|
|
echo " rsync -az outside-runner:var/taler-monitoring-sites-work/html/ \\"
|
|
echo " $DEPLOY_SSH:monitoring-sites-staging/"
|
|
echo " # or: ./pull-firecuda-to-koopa.sh"
|
|
fi
|
|
|
|
# keep last 20 logs
|
|
ls -1t "$LOG_DIR"/run-*.log 2>/dev/null | tail -n +21 | xargs rm -f 2>/dev/null || true
|
|
|
|
echo "======== done ec=$ec ========"
|
|
exit "$ec"
|