Deploy the api to Render
Create the production api and its two scheduled jobs from the repo's render.yaml blueprint. About 15 minutes; it creates Render services and applies every database migration to the production Supabase project.
Before you start
- Everything from Prepare accounts and secrets
- A Render account with access to the GitHub repository
Steps
-
In Render, choose New → Blueprint and pick the repository. Render reads
render.yaml, which defines both environments:monark-api,monark-cron-deletions,monark-cron-webhook-sweepand themonark-cron-sharedgroup onmain, and the same names with-stagingondevelop. -
Fill the
monark-cron-sharedgroup:Key Value CRON_SECRETyour CRON_SECRETAPI_URLhttps://monark-api.onrender.com(a placeholder; fixed in step 6) -
Fill the
monark-apiprompts:Key Value DATABASE_URL,DIRECT_URLthe pooler and direct URLs SUPABASE_URL,SUPABASE_PUBLISHABLE_KEY,SUPABASE_SECRET_KEYfrom Supabase WEB_ORIGIN,APP_URLhttps://monark.vercel.app(placeholders; fixed in the next phase)SMTP_URLyour SMTP URL SMTP_FROMMonark <noreply@yourdomain.com>TOTP_ENCRYPTION_KEY,SECRETS_ENCRYPTION_KEYyour generated keys INITIAL_ORG_SLUG,INITIAL_ORG_NAMEyour organization's slug and display name INITIAL_ORG_PRIMARY_COLORyour brand colour, quoted: "#2563EB"Leave
SENTRY_DSN,WEBHOOK_SECRETS_JSONand theBRANDING_*keys blank for now; Rebrand an instance and Turn on error tracking cover them. Leave the-stagingservices for Add a staging environment; they fail to start until then. -
Click Apply. Render installs, runs
prisma generate, then runspnpm --filter @monark/db exec prisma migrate deploybefore starting the api. A failed migration aborts the deploy and leaves nothing running. -
Once
monark-apiis live, open it, go to Environment, and addEMAIL_ACTION_SECRETwith your generated value. It isn't in the blueprint, and without it the api signs email links with a public development value. Save; Render redeploys. -
Copy the service's public URL (for example
https://monark-api.onrender.com) and set it asAPI_URLin themonark-cron-sharedgroup.
Verify
curl -s https://<api-host>/health
Expect {"status":"ok","service":"api"}. The api's log shows webhook delivery worker started, Single-tenant bootstrap : created singleton organization and api listening.
If something goes wrong
| Symptom | Cause | Fix |
|---|---|---|
| Deploy stops at the pre-deploy step | prisma migrate deploy couldn't reach or migrate the database | Check DIRECT_URL and its password, then Manual Deploy. |
Log shows Invalid environment: and the process exits | a required variable is missing or malformed | Fix the key named in the message. |
Log shows INITIAL_ORG_SLUG / INITIAL_ORG_NAME not set | the org variables are empty | Set them and redeploy. |
INITIAL_ORG_PRIMARY_COLOR ignored | the hex value wasn't quoted | Re-enter it as "#2563EB". |
Cron runs fail with CRON_SECRET unset or status 401 | the group value is missing or differs from the api's | Make both read from monark-cron-shared. |