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

69 lines
1.9 KiB
Bash

#!/usr/bin/env bash
# Full dev environment reset: stop everything, drop and recreate the DB,
# re-run all Liquibase migrations, then restart dev servers.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
info() { echo -e "${GREEN}[apix]${NC} $*"; }
warn() { echo -e "${YELLOW}[warn]${NC} $*"; }
die() { echo -e "${RED}[fail]${NC} $*" >&2; exit 1; }
_on_exit() {
echo ""
read -rp "Press Enter to close…" _
}
trap _on_exit EXIT
warn "This will DROP and recreate the local 'apix' database."
read -rp "Continue? [y/N] " confirm
[[ "${confirm,,}" == "y" ]] || { echo "Aborted."; exit 0; }
# Stop everything
info "Stopping dev servers"
"$SCRIPT_DIR/stop.sh"
# Load .env
cd "$PROJECT_ROOT"
if [[ ! -f .env ]]; then
die ".env not found — run ./scripts/setup-dev.sh first."
fi
set -a
# shellcheck disable=SC1091
source .env
set +a
DB_USER="${APIX_DB_USER:-apix}"
DB_PASS="${APIX_DB_PASSWORD:-apix}"
DB_NAME="${APIX_DB_NAME:-apix}"
DB_PORT="${APIX_DB_PORT:-5432}"
# Remove and recreate the container (fastest way to wipe the DB on local dev)
info "Removing apix-postgres container"
docker rm -f apix-postgres 2>/dev/null || true
info "Starting fresh PostgreSQL container"
docker run -d \
--name apix-postgres \
--restart unless-stopped \
-e POSTGRES_USER="$DB_USER" \
-e POSTGRES_PASSWORD="$DB_PASS" \
-e POSTGRES_DB="$DB_NAME" \
-p "${DB_PORT}:5432" \
postgres:16-alpine >/dev/null
info "Waiting for PostgreSQL…"
for i in $(seq 1 30); do
if docker exec apix-postgres pg_isready -U "$DB_USER" -q 2>/dev/null; then
info "PostgreSQL ready"
break
fi
[[ $i -eq 30 ]] && die "PostgreSQL did not become ready. Check: docker logs apix-postgres"
sleep 1
done
info "Reset complete — starting dev servers (Quarkus applies migrations at startup)"
exec "$SCRIPT_DIR/dev.sh"