Files
apix-mvp/scripts/restart.sh
T
Carsten Rehfeld 82a379e536
Deploy to Production / deploy (push) Failing after 47s
feat(admin): apix-admin UI at admin.api-index.org
Internal maintainer dashboard: global stats, sandbox list with
tier-filter and pagination, sandbox drill-down with D3 world map,
tier-promotion form. API-key auth via HttpOnly cookie. Port 8084,
rolling a/b deploy alongside the existing service pairs.

- apix-common: AdminSandboxSummary, AdminSandboxListResponse, AdminStatsResponse DTOs
- apix-registry: AdminResource (4 endpoints), SandboxService.listAllSandboxes + getGlobalStats
- apix-registry: SandboxResource GET /{uuid}/dashboard endpoint (was missing — fixes portal 500)
- apix-portal: RegistryClient path corrected to /dashboard
- apix-admin: new Quarkus module — auth filter, registry REST client, 3 resources, 6 Qute templates, admin.js
- infra: Dockerfile.admin, docker-compose admin-a/b services, Caddyfile admin.api-index.org block
- scripts: deploy-bluegreen.sh extended for admin-a/b

Co-Authored-By: Mira Rehfeld <noreply@anthropic.com>
2026-05-16 21:18:48 +02:00

90 lines
2.9 KiB
Bash

#!/usr/bin/env bash
# Restart one or all dev-mode Quarkus modules.
# Usage: restart.sh [registry|portal|spider|all] (default: all)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PID_DIR="$PROJECT_ROOT/.pids"
LOG_DIR="$PROJECT_ROOT/.logs"
TARGET="${1:-all}"
GREEN='\033[0;32m'; NC='\033[0m'
info() { echo -e "${GREEN}[apix]${NC} $*"; }
_on_exit() { echo ""; read -rp "Press Enter to close…" _; }
trap _on_exit EXIT
# ── tmux mode ────────────────────────────────────────────────────────────────
if command -v tmux &>/dev/null && tmux has-session -t apix-dev 2>/dev/null; then
_restart_window() {
local win="$1" cmd="$2"
tmux send-keys -t "apix-dev:${win}" C-c '' ENTER
sleep 0.5
tmux send-keys -t "apix-dev:${win}" "cd '$PROJECT_ROOT' && $cmd" ENTER
info "Restarted $win"
}
case "$TARGET" in
registry) _restart_window registry "mvn quarkus:dev -pl apix-registry" ;;
portal) _restart_window portal "mvn quarkus:dev -pl apix-portal" ;;
spider) _restart_window spider "mvn quarkus:dev -pl apix-spider" ;;
all)
_restart_window registry "mvn quarkus:dev -pl apix-registry"
_restart_window portal "mvn quarkus:dev -pl apix-portal"
_restart_window spider "mvn quarkus:dev -pl apix-spider"
;;
*) echo "Usage: restart.sh [registry|portal|spider|all]"; exit 1 ;;
esac
exit 0
fi
# ── Background mode ───────────────────────────────────────────────────────────
_kill_module() {
local module="$1"
local pidfile="$PID_DIR/${module}.pid"
if [[ -f "$pidfile" ]]; then
local pid
pid=$(cat "$pidfile")
if kill -0 "$pid" 2>/dev/null; then
info "Stopping $module (PID $pid)"
kill "$pid" 2>/dev/null || true
sleep 1
fi
rm -f "$pidfile"
fi
}
_start_module() {
local module="$1" port="$2"
local pidfile="$PID_DIR/${module}.pid"
local logfile="$LOG_DIR/${module}.log"
info "Starting $module → http://localhost:${port}"
MAVEN_OPTS="-XX:TieredStopAtLevel=1" \
mvn quarkus:dev -pl "$module" >"$logfile" 2>&1 &
echo $! >"$pidfile"
}
case "$TARGET" in
registry)
_kill_module apix-registry
_start_module apix-registry 8180
;;
portal)
_kill_module apix-portal
_start_module apix-portal 8081
;;
spider)
_kill_module apix-spider
_start_module apix-spider 8082
;;
all)
_kill_module apix-registry; _kill_module apix-portal; _kill_module apix-spider
_start_module apix-registry 8180
_start_module apix-portal 8081
_start_module apix-spider 8082
;;
*) echo "Usage: restart.sh [registry|portal|spider|all]"; exit 1 ;;
esac