31 lines
1.0 KiB
Bash
Executable File
31 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
PB_DATA=${PB_DATA_DIR:-/app/pb_data}
|
|
|
|
# Seed a platform superuser from env (idempotent — no-op if it already exists).
|
|
# If PB_EMAIL/PB_PASSWORD aren't set, skip and rely on manual web setup.
|
|
if [ -n "$PB_EMAIL" ] && [ -n "$PB_PASSWORD" ]; then
|
|
echo "[entrypoint] Ensuring PocketBase superuser..."
|
|
pocketbase superuser upsert "$PB_EMAIL" "$PB_PASSWORD" --dir="$PB_DATA" || true
|
|
fi
|
|
|
|
# Start PocketBase (internal only; published via loopback for admin UI).
|
|
pocketbase serve --http=0.0.0.0:8090 --dir="$PB_DATA" &
|
|
|
|
# Wait for PB to be healthy before starting the proxy (which runs migrate).
|
|
echo "[entrypoint] Waiting for PocketBase..."
|
|
for i in $(seq 1 30); do
|
|
if curl -sf http://127.0.0.1:8090/api/health >/dev/null 2>&1; then
|
|
echo "[entrypoint] PocketBase is healthy."
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
# Start the app (frontend + proxy). The proxy auto-runs schema migration.
|
|
PORT=${FRONTEND_PORT:-2080} node /app/frontend/build/index.js &
|
|
PROXY_PORT=${PROXY_PORT:-3456} node /app/proxy/dist/index.js &
|
|
|
|
nginx -g 'daemon off;'
|