Files
apix-mvp/scripts/dev.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

95 lines
3.1 KiB
Bash

#!/usr/bin/env bash
# Start all three Quarkus modules in dev mode.
# Uses tmux (one window per module) if available; falls back to background processes.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
LOG_DIR="$PROJECT_ROOT/.logs"
PID_DIR="$PROJECT_ROOT/.pids"
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
info() { echo -e "${GREEN}[apix]${NC} $*"; }
warn() { echo -e "${YELLOW}[warn]${NC} $*"; }
mkdir -p "$LOG_DIR" "$PID_DIR"
cd "$PROJECT_ROOT"
# Require PostgreSQL
if ! docker ps --format '{{.Names}}' | grep -qx apix-postgres; then
echo "PostgreSQL container is not running."
echo "Run: ./scripts/setup-dev.sh"
read -rp "Press Enter to close…" _
exit 1
fi
# ── tmux mode ────────────────────────────────────────────────────────────────
if command -v tmux &>/dev/null; then
SESSION=apix-dev
if tmux has-session -t "$SESSION" 2>/dev/null; then
warn "tmux session '$SESSION' already exists."
echo " Attach: tmux attach -t $SESSION"
echo " Restart: ./scripts/restart.sh"
exit 0
fi
tmux new-session -d -s "$SESSION" -x 220 -y 50 -n registry
tmux send-keys -t "$SESSION:registry" \
"cd '$PROJECT_ROOT' && mvn quarkus:dev -pl apix-registry" Enter
tmux new-window -t "$SESSION" -n portal
tmux send-keys -t "$SESSION:portal" \
"cd '$PROJECT_ROOT' && mvn quarkus:dev -pl apix-portal" Enter
tmux new-window -t "$SESSION" -n spider
tmux send-keys -t "$SESSION:spider" \
"cd '$PROJECT_ROOT' && mvn quarkus:dev -pl apix-spider" Enter
tmux select-window -t "$SESSION:registry"
echo ""
echo -e "${GREEN}Started in tmux session '${SESSION}'${NC}"
echo " Switch windows: Ctrl-b 0 / 1 / 2"
echo " Detach: Ctrl-b d"
echo ""
echo " Registry API → http://localhost:8180"
echo " Portal → http://localhost:8081"
echo ""
tmux attach -t "$SESSION"
exit 0
fi
# ── Background mode (no tmux) ─────────────────────────────────────────────────
warn "tmux not found — starting modules in background with log files."
_start() {
local module="$1" port="$2"
local pidfile="$PID_DIR/${module}.pid"
local logfile="$LOG_DIR/${module}.log"
if [[ -f "$pidfile" ]] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
info "$module already running (PID $(cat "$pidfile"))"
return
fi
info "Starting $module → http://localhost:${port}"
MAVEN_OPTS="-XX:TieredStopAtLevel=1" \
mvn quarkus:dev -pl "$module" >"$logfile" 2>&1 &
echo $! >"$pidfile"
}
_start apix-registry 8180
_start apix-portal 8081
_start apix-spider 8082
echo ""
echo -e "${GREEN}All modules started${NC}"
echo " Logs: ./scripts/logs.sh [registry|portal|spider|all]"
echo " Stop: ./scripts/stop.sh"
echo ""
echo " Registry API → http://localhost:8180"
echo " Portal → http://localhost:8081"
echo ""
read -rp "Press Enter to close…" _