Skip to content

Latest commit

 

History

History
134 lines (95 loc) · 3.75 KB

File metadata and controls

134 lines (95 loc) · 3.75 KB

Deployment

Before deploying, set environment variables directly in Render/Vercel or in your shell. Do not commit env files to the repository.

Recommended Production Combo: Render (API) + Vercel (Web)

This repo now supports a more production-ready topology:

  • API on Render via render.yaml
  • managed Postgres provisioned from the same Render blueprint
  • optional S3-compatible artifact storage
  • Next.js web app on Vercel with same-origin proxying for browser requests

1) Deploy API on Render

  1. Open Render Dashboard.
  2. Click New + -> Blueprint.
  3. Connect this repo and deploy using /render.yaml.
  4. After deploy, copy your API URL (for example https://worldmodel-gym-api.onrender.com).
  5. Create a scoped writer key:
.venv/bin/python -m worldmodel_server.cli create-api-key \
  --name production-writer \
  --scope runs:write
  1. Store that secret in your submission workflow or benchmark runner.

Optional bootstrap path:

  • WMG_BOOTSTRAP_API_KEY can create the first admin/writer key automatically on startup when no API keys exist yet.
  • Treat it as a one-time escape hatch, not the long-term auth mechanism.
  • Remove it from the Render dashboard after a durable production API key is in place.

Notes:

  • render.yaml enables migrations, JSON logging, and seeded demo runs.
  • WMG_DB_URL is normalized automatically for SQLAlchemy when Render injects a Postgres connection string.
  • For real artifact durability, switch to WMG_STORAGE_BACKEND=s3 and provide the S3-compatible bucket credentials below.

Optional: enable S3-compatible artifact storage

Add these Render environment variables:

  • WMG_STORAGE_BACKEND=s3
  • WMG_S3_BUCKET=<bucket-name>
  • WMG_S3_REGION=<region>
  • WMG_S3_ENDPOINT_URL=<endpoint-url> if using Cloudflare R2, MinIO, or another S3-compatible endpoint
  • WMG_S3_ACCESS_KEY_ID=<access-key>
  • WMG_S3_SECRET_ACCESS_KEY=<secret-key>
  • WMG_S3_PREFIX=runs

2) Deploy Web on Vercel

  1. Open Vercel Dashboard and import this GitHub repo.
  2. Set Root Directory to web.
  3. Add environment variable:
    • NEXT_PUBLIC_API_BASE=https://<your-render-api-url>
    • INTERNAL_API_BASE=https://<your-render-api-url>
  4. Deploy.

Optional CLI deploy:

make deploy-vercel

If you previously pulled web/.env.local from Vercel CLI, move it aside before running a local production build because it may contain deployment-only values:

mv web/.env.local web/.env.local.bak
cd web && npm run build
mv web/.env.local.bak web/.env.local

Local Production Mode

Run API + web on your machine:

make deploy

Stop local services:

make stop

Public No-Card Tunnel Mode

This mode does not require cloud accounts or credit card setup. It runs services locally and exposes temporary public URLs through localtunnel.

make deploy-public

Stop:

make stop-public

Health Checks

  • Liveness: /healthz
  • Readiness: /readyz
  • Metrics: /metrics

The readiness endpoint now returns per-component checks for database, storage, and auth, and responds with 503 if database or storage is not ready.

Verification Commands

Create a benchmark run against a deployed API:

.venv/bin/python scripts/demo_run.py \
  --api-base https://worldmodel-gym-api.onrender.com \
  --api-key "$WMG_API_KEY"

Verify the full public deployment:

.venv/bin/python scripts/verify_deployment.py \
  --api-base https://worldmodel-gym-api.onrender.com \
  --web-base https://world-model-gym.vercel.app

References