Deploying to Railway
Railway detects your Dockerfile and builds it automatically. PostgreSQL is provisioned as a first-class addon with variables that can be referenced directly in your service config.
Official docs: docs.railway.com
PostgreSQL
Section titled “PostgreSQL”Add a Postgres database from the Railway dashboard (New → Database → Add PostgreSQL) or via CLI:
railway add --database postgresRailway injects these variables into the Postgres service:
DATABASE_URL— full connection stringPGHOST,PGPORT,PGUSER,PGPASSWORD,PGDATABASE
Reference them in your app service using Railway’s variable reference syntax:
${{Postgres.DATABASE_URL}}
railway.toml
Section titled “railway.toml”A ready-to-use railway.toml is included in the repo root:
# railway.toml — Procella on Railway[build] builder = "DOCKERFILE" dockerfilePath = "Dockerfile"
[deploy] healthcheckPath = "/healthz" healthcheckTimeout = 30 # seconds numReplicas = 1 restartPolicyType = "ON_FAILURE" restartPolicyMaxRetries = 5Environment Variables
Section titled “Environment Variables”Set these in the Railway dashboard under Variables, or commit a .env file (for non-secrets):
| Variable | Value |
|---|---|
PROCELLA_LISTEN_ADDR | :9090 |
PROCELLA_DATABASE_URL | ${{Postgres.DATABASE_URL}} |
PROCELLA_AUTH_MODE | descope or dev |
PROCELLA_BLOB_BACKEND | s3 |
PROCELLA_BLOB_S3_BUCKET | your bucket name |
PROCELLA_BLOB_S3_ENDPOINT | your S3 endpoint |
Sensitive secrets (set in dashboard, never in railway.toml):
railway variables set \ PROCELLA_DEV_AUTH_TOKEN="your-token" \ PROCELLA_ENCRYPTION_KEY="$(openssl rand -hex 32)" \ PROCELLA_DESCOPE_PROJECT_ID="P..." \ PROCELLA_DESCOPE_MANAGEMENT_KEY="..." \ AWS_ACCESS_KEY_ID="..." \ AWS_SECRET_ACCESS_KEY="..."Deploy
Section titled “Deploy”# Install CLInpm install -g @railway/clirailway login
# Link to existing projectrailway link
# Deployrailway up
# Tail logsrailway logsScaling
Section titled “Scaling”Railway supports horizontal scaling via numReplicas (Pro plan):
[deploy] numReplicas = 3Or set it in the dashboard under Settings → Deploy → Replicas.
Bun / Docker Notes
Section titled “Bun / Docker Notes”- Railway builds using your
Dockerfileas-is. Thebun build --compilebinary runs inside a distroless final stage — no shell, no package manager, no Node.js runtime. - The compiled binary listens on
PROCELLA_LISTEN_ADDR(default:9090). Set this explicitly in your Railway variables. Railway’s proxy routes public HTTPS traffic to it automatically. - Railway injects a
PORTvariable, but Procella does not readPORT. Always setPROCELLA_LISTEN_ADDRexplicitly (e.g.,:9090). Do not attemptPROCELLA_LISTEN_ADDR=:$PORT— env vars are not interpolated inside other values.