E EMBAN / Docs

Runbook

Use this page for restart steps, migration order, smoke checks, and basic incident handling around the Emban API.

Scope: this is the operational companion to Alpha Readiness. Use it when you need to start, validate, or recover the running system rather than reason about product concepts.

Starting the server

cd /var/www/emban
source .env
./emban

The server listens on SERVER_PORT with 8092 as the default. PostgreSQL and ClickHouse must already be reachable.

Infrastructure

ServiceRuntimePort
PostgreSQLemban_postgres5434
ClickHouseexternal9000
Redisemban_redis6380
Emban APInative binary8092
Buildernative3003
Demonative or static3002

Migrations

Run the full chain in order on a fresh database:

psql $DATABASE_URL -f migrations/001_init.sql
psql $DATABASE_URL -f migrations/002_billing.sql
psql $DATABASE_URL -f migrations/003_auth.sql
psql $DATABASE_URL -f migrations/004_invites_publish.sql
psql $DATABASE_URL -f migrations/005_entitlements.sql
psql $DATABASE_URL -f migrations/006_alerts.sql

All migrations are idempotent and safe to re-run.

Prelaunch smoke

# Full local flow
bash scripts/prelaunch_smoke.sh

# Against a live base URL
bash scripts/prelaunch_smoke.sh https://emban.sidelabs.dev

# Static-only validation when the server is intentionally down
bash scripts/prelaunch_smoke.sh --skip-e2e

The script covers Go build, app and demo static validation, embed SDK checks, and the full API happy path when the server is reachable.

Backup

PostgreSQL

# Backup
docker exec emban_postgres pg_dump -U emban emban > backup_pg_$(date +%Y%m%d).sql

# Restore
docker exec -i emban_postgres psql -U emban emban < backup_pg_YYYYMMDD.sql

ClickHouse

# Backup events table
clickhouse-client --host=159.69.6.132 --user=poptrade --password=XXX \
  --database=emban --query="SELECT * FROM events FORMAT Native" > events_backup.native

# Restore
clickhouse-client --host=159.69.6.132 --user=poptrade --password=XXX \
  --database=emban --query="INSERT INTO events FORMAT Native" < events_backup.native

Health and monitoring

*/5 * * * * curl -sf http://localhost:8092/health || echo "Emban down" | mail -s "ALERT" ops@example.com

Session cleanup

Expired embed sessions are cleaned automatically every hour by a background goroutine. No manual cleanup is normally required.

Common issues

SymptomLikely causeFix
Server refuses to start with a JWT secret errorDefault or missing JWT secretSet JWT_SECRET in .env to a real random value such as openssl rand -hex 32.
CORS errors in the browserOrigin not in allowlistAdd the real app origins to CORS_ORIGINS.
dashboard not published during embedThe dashboard is still draft-onlyPublish it in the builder or via POST /v1/dashboards/{id}/publish.
Empty dashboard right after registrationSeed still runningWait a few seconds and refresh. Seed is asynchronous.
Live demo page loads but cannot fetch a sessionDemo endpoint unavailable or stale backend binaryConfirm GET /v1/demo/embed-url returns 200 on the live API and restart the API if needed.
Unexpected 402 responsesPlan limit or entitlement gateCheck the response body for code, plan, upgrade_to, limit, and used.

Restarting

# Rebuild Go + embed + app + demo
./restart.sh --all

# Find process
pgrep emban

# Graceful stop
pkill emban

# Start
cd /var/www/emban && nohup ./emban > /tmp/emban.log 2>&1 &

# Verify
curl http://localhost:8092/health

Related docs