Operations runbook

Deployment, observability, and maintenance checklists for Livequest Studio.

Deploy

  • Production runs on the Cloudflare Container Worker project in `cf-container-worker/`.
  • Deploy with `cd cf-container-worker && npx wrangler deploy`.
  • Set required secrets (service role, billing keys, etc.) via `npx wrangler secret put` before first deploy.

Logs & scaling

  • Tail logs with `npx wrangler tail livequest-container-worker --format=pretty`.
  • Change `instance_type` in `cf-container-worker/wrangler.toml` (e.g. `standard-2`) and redeploy to scale.

Rollbacks

  • Keep previous images available so you can redeploy a known-good commit.
  • Confirm database migrations remain compatible before rolling back application code.

Database migrations

  • Apply schema changes with `supabase migration up` or `supabase db push`.
  • After migrating, sign into `/account/analytics` and ensure RPCs return data (check network tab).
  • If analytics look empty, run `select * from public.viewer_pings limit 1;` and `select public.account_analytics_summary();` in Supabase SQL to verify data flow.

Environment & secrets

  • Development env lives in `web/.env.local`; production secrets are injected via platform tooling.
  • Set `EMBED_ALLOW_ORIGINS` to restrict embed traffic.
  • Configure VAPID keys when enabling push notifications.

Troubleshooting checklist

  • SSE issues? Ensure upstream proxies don’t buffer responses and confirm CORS allowlists.
  • Embeds failing to refresh? Check `embed.js`, verify the feed endpoint returns 200 with ETags.
  • Cron jobs: confirm `pg_cron` is enabled and helper functions are installed.
  • Embed QA: run `npm run dev`, open `http://localhost:3000/embed-demo.html`, and confirm lazy loading, SSE updates, impressions, and link clicks all reach `/api/embed/:id/*`.