Skip to content
Yuxiang Huang edited this page Sep 5, 2026 · 16 revisions

Deployment

We use Railway for hosting services. Request per team basis to be added to a Railway project. Use Railway IaC.

Tip: lower your cost by enabling serverless

Example Secrets

DATABASE_URL="$${{Postgres.DATABASE_URL}}"
AUTH_ISSUER="https://idp.scottylabs.org/realms/labrador"
AUTH_JWKS_URI="https://idp.scottylabs.org/realms/labrador/protocol/openid-connect/certs"

ADMIN_GROUP="{slug}-admins"
SENTRY_DSN= # Need to be requested
BETTER_AUTH_URL= # frontend url
ALLOWED_ORIGINS_REGEX= # frontend url
SERVER_URL= 

# See https://github.com/scottylabs-labrador/ScottyStack/wiki/Auth
AUTH_CLIENT_ID=
AUTH_CLIENT_SECRET=

DB Migration

To be beginner friendly, we run database migration as a Railway pre-deploy command.

Note: if you enabled serverless, the pre-deploy might failed while waiting for the database to start up. In that case, simply redeploy would fix the issue.

However, following the 12th factor of the The Twelve Factors methodology, migrations should ideally run as a separate, one-off process. You can achieve that by SSH into Railway server and run

bun i drizzle-kit drizzle-orm pg 
bun x drizzle-kit migrate

User Analytics

PostHog

Error Logging

Sentry

Domains

Buy in Porkbun.com.

Onboard in Cloudflare.com.

Add to Google Search Console of ops@scottylabs.org.

Tip: If you run out of budget, you may use a CNAME of scottylabs.org (i.e. https://maps.scottylabs.org/) for free!

Clone this wiki locally