Skip to main content
Railway is the recommended production host for Cognisafe. Each service is deployed as an independent Railway service from this monorepo, giving you per-service scaling, logs, and metrics.

One-time setup

1

Create a Railway project

Go to railway.app and create a new project.
2

Add managed services

In your Railway project, add:
  • PostgreSQL — use the TimescaleDB plugin
  • Redis — standard Redis service
Copy the connection strings Railway provides — you’ll need them for the service env vars below.
3

Create the four application services

Create one Railway service per component. Use the settings from the table below:
4

Set environment variables

Configure the env vars for each service as shown in the sections below.
5

Connect your GitHub repo

In Railway: SettingsSource → connect your GitHub repository. Set the target branch (main or platform). Railway redeploys all services on every push to that branch.
The api service must run alembic upgrade head before it starts serving traffic. This is configured as a pre-deploy command in api/railway.toml. Do not remove or skip it — the API will crash on startup if migrations have not been applied.

Environment variables per service

api

proxy

web

safety_worker

Custom domains

In Railway: SettingsNetworkingGenerate Domain (or add your own CNAME). Recommended mapping:

Scaling

Scale the safety_worker service by increasing its replica count in Railway’s service settings. The workers are stateless — each reads independently from the Redis queue.

Bare Kubernetes (Helm)

A Helm chart is available for teams running their own Kubernetes cluster.
The chart deploys all four application services as separate Deployment resources, plus Service and Ingress objects. PostgreSQL and Redis are expected to be provided externally (managed cloud databases or separate Helm releases).

Values reference

Running migrations on Kubernetes

The Helm chart includes a pre-upgrade Job that runs alembic upgrade head:
To run migrations manually: