#!/usr/bin/env bash # Operator runbook — run ON CT 116 after Forgejo migration + env updates. # Copy-paste from your laptop: # ssh root@192.168.68.116 'bash -s' < scripts/ct116-post-migration.sh # # Or on CT 116 directly: # cd /opt/submatter && bash scripts/ct116-post-migration.sh set -euo pipefail APP_DIR="${APP_DIR:-/opt/submatter}" cd "$APP_DIR" echo "=== CT 116 post-migration ===" if [[ -f scripts/migrate-origin-to-forgejo.sh ]]; then bash scripts/migrate-origin-to-forgejo.sh else echo "WARN: migrate-origin-to-forgejo.sh missing — pull latest main first" git fetch origin main && git checkout main && git reset --hard origin/main fi if grep -q '^NEXT_PUBLIC_COLLAB_SERVER_URL=ws://' .env 2>/dev/null; then echo "" echo "ACTION REQUIRED: update .env collab URLs to wss:// before deploy:" echo " NEXT_PUBLIC_COLLAB_SERVER_URL=wss://collab.echodo.stillwell.cloud" echo " COLLAB_SERVER_URL=wss://collab.echodo.stillwell.cloud" echo "" fi missing=() for var in OMNIROUTE_BASE_URL OMNIROUTE_API_KEY FORGEJO_TOKEN; do if ! grep -q "^${var}=" .env 2>/dev/null; then missing+=("$var") fi done if ((${#missing[@]} > 0)); then echo "Optional .env vars not set (add when ready): ${missing[*]}" fi echo "" echo "=== deploying (serialized build — may take 15–30 min) ===" bash scripts/deploy-prod.sh build echo "" echo "=== health ===" docker compose -f docker/docker-compose.prod.yml -f docker/docker-compose.prod.standalone.yml ps