Files
apix-mvp/scripts/restart.sh
T
Carsten Rehfeld b2a16a8be7 Implement apix-registry with IoT sunset/decommission lifecycle and full BDD suite
- REST API: register, patch, O-level, replacements, history, search endpoints
- IoT lifecycle validations: future sunset, lock-before-release, sunset-passed-before-decommission
- DB schema: Liquibase changesets 001–008 (services, versions, replacements, sunset-at column)
- @ColumnTransformer(write="?::jsonb") on bsm_payload fields to avoid JDBC varchar→jsonb rejection
- Jandex plugin on apix-common + quarkus.index-dependency so @NotBlank validators resolve at runtime
- quarkus-logging-json extension added; quarkus.log.console.json=false is now a recognised key
- Fix requireSunsetBeforeLockRelease: Boolean.TRUE.equals instead of !Boolean.FALSE.equals (null guard)
- BDD suite: 27 scenarios / 213 steps across 5 feature files (sunset-lock, decommission, replacement, discovery, anonymity)
- Test infrastructure: JDBC TRUNCATE in @Before for DB isolation, Arc.container() for clock control — no test endpoints in production code
- sunsetAt truncated to microseconds in BDD steps to match Postgres timestamptz precision
- Cucumber step fixes: singular/plural candidate(s), lastResponse propagation in replacementsReturnsNCandidates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 09:13:26 +02:00

87 lines
2.8 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} $*"; }
# ── 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