improve web-app config

This commit is contained in:
johba 2025-10-11 10:55:49 +00:00
parent 280e2973cd
commit 371a8557b7
28 changed files with 831 additions and 344 deletions

View file

@ -15,6 +15,11 @@ readonly POLL_INTERVAL=2 # Check health every N seconds
PID_FILE=/tmp/kraiken-watcher.pid
PROJECT_NAME=${COMPOSE_PROJECT_NAME:-$(basename "$PWD")}
container_name() {
local service="$1"
echo "${PROJECT_NAME}_${service}_1"
}
cleanup_existing() {
# Kill any existing watch scripts
pkill -f "watch-kraiken-lib.sh" 2>/dev/null || true
@ -24,11 +29,11 @@ cleanup_existing() {
rm -f "$PID_FILE"
# Kill zombie podman processes
pkill -9 -f "podman wait.*harb_" 2>/dev/null || true
pkill -9 -f "podman wait.*${PROJECT_NAME}_" 2>/dev/null || true
# Remove any existing containers (suppress errors if they don't exist)
echo " Cleaning up existing containers..."
podman ps -a --filter "name=harb_" --format "{{.Names}}" 2>/dev/null | \
podman ps -a --filter "label=com.docker.compose.project=${PROJECT_NAME}" --format "{{.Names}}" 2>/dev/null | \
xargs -r podman rm -f 2>&1 | grep -v "Error.*no container" || true
}
@ -94,32 +99,32 @@ start_stack() {
echo " Starting anvil & postgres..."
podman-compose up -d anvil postgres 2>&1 | grep -v "STEP\|Copying\|Writing\|Getting\|fetch\|Installing\|Executing" || true
wait_for_healthy harb_anvil_1 "$ANVIL_TIMEOUT" || exit 1
wait_for_healthy harb_postgres_1 "$POSTGRES_TIMEOUT" || exit 1
wait_for_healthy "$(container_name anvil)" "$ANVIL_TIMEOUT" || exit 1
wait_for_healthy "$(container_name postgres)" "$POSTGRES_TIMEOUT" || exit 1
# Phase 2: Start bootstrap (depends on anvil & postgres healthy)
echo " Starting bootstrap..."
podman-compose up -d bootstrap >/dev/null 2>&1
wait_for_exited harb_bootstrap_1 "$BOOTSTRAP_TIMEOUT" || exit 1
wait_for_exited "$(container_name bootstrap)" "$BOOTSTRAP_TIMEOUT" || exit 1
# Phase 3: Start ponder (depends on bootstrap completed)
echo " Starting ponder..."
podman-compose up -d ponder >/dev/null 2>&1
wait_for_healthy harb_ponder_1 "$PONDER_TIMEOUT" || exit 1
wait_for_healthy "$(container_name ponder)" "$PONDER_TIMEOUT" || exit 1
# Phase 4: Start frontend services (depend on ponder healthy)
echo " Starting webapp, landing, txn-bot..."
podman-compose up -d webapp landing txn-bot >/dev/null 2>&1
wait_for_healthy harb_webapp_1 "$WEBAPP_TIMEOUT" || exit 1
wait_for_healthy "$(container_name webapp)" "$WEBAPP_TIMEOUT" || exit 1
# Phase 5: Start caddy (depends on frontend services)
echo " Starting caddy..."
podman-compose up -d caddy >/dev/null 2>&1
wait_for_healthy harb_caddy_1 "$CADDY_TIMEOUT" || exit 1
wait_for_healthy "$(container_name caddy)" "$CADDY_TIMEOUT" || exit 1
if [[ -z "${SKIP_WATCH:-}" ]]; then
echo "Watching for kraiken-lib changes..."
@ -131,7 +136,8 @@ start_stack() {
echo ""
echo "[ok] Stack started in ${total_time}s"
echo " Web App: http://localhost:8081/app/"
echo " GraphQL: http://localhost:8081/graphql"
echo " RPC Proxy: http://localhost:8081/api/rpc"
echo " GraphQL: http://localhost:8081/api/graphql"
}
stop_stack() {