#!/bin/sh set -e # Create/update the superuser from env vars so the API Server can authenticate on # first boot. `superuser upsert` is idempotent (PocketBase v0.22+/v0.23). Accepts # either the PilotVault names (POCKETBASE_ADMIN_*) or the short PB_ADMIN_* aliases. ADMIN_EMAIL="${POCKETBASE_ADMIN_EMAIL:-$PB_ADMIN_EMAIL}" ADMIN_PASSWORD="${POCKETBASE_ADMIN_PASSWORD:-$PB_ADMIN_PASSWORD}" if [ -n "$ADMIN_EMAIL" ] && [ -n "$ADMIN_PASSWORD" ]; then echo "Ensuring PocketBase superuser $ADMIN_EMAIL exists..." /pb/pocketbase superuser upsert "$ADMIN_EMAIL" "$ADMIN_PASSWORD" \ || echo "warning: superuser upsert failed; create an admin via the UI at /_/" fi # Serve. --migrationsDir applies the bundled JS migrations on boot, which # create/reconcile every collection and seed the baseline org + accounts # (including superadmin@pilotvault.local) — all idempotent. exec /pb/pocketbase serve --http=0.0.0.0:8070 --migrationsDir=/pb/pb_migrations