Deploy to Railway
Railway builds the Docker image from your repo and runs it, with a Postgres alongside. Mostly point-and-click.
1. Create the service
Section titled “1. Create the service”- Push the container project to a GitHub repo: scaffold it with
npm create flaghoist@latest team-flags -- --platform container, or use a copy ofexamples/docker(or the whole Flaghoist repo). - In the Railway dashboard: New Project > Deploy from GitHub repo, and pick it.
- In the service Settings, set the Root Directory to
examples/dockerso Railway builds thatDockerfile.
2. Add Postgres
Section titled “2. Add Postgres”In the project: New > Database > PostgreSQL. Railway provisions it and exposes a DATABASE_URL
you can reference from the service.
3. Set the variables
Section titled “3. Set the variables”On the Flaghoist service, add these Variables:
FLAGS_STORAGE=postgresDATABASE_URL=${{Postgres.DATABASE_URL}}?sslmode=disableADMIN_TOKEN= a strong secret (openssl rand -hex 32)READ_API_KEY= a strong secret
${{Postgres.DATABASE_URL}} references the database’s private URL, which is not TLS, so the
?sslmode=disable tells the container not to negotiate SSL. Railway sets PORT for you, and the
container reads it.
4. Deploy and expose
Section titled “4. Deploy and expose”Railway builds and deploys on push. In the service Settings > Networking, click Generate
Domain to get a public HTTPS URL like https://<app>.up.railway.app.
5. Verify
Section titled “5. Verify”curl https://<app>.up.railway.app/healthCreate a flag from the dashboard at https://<app>.up.railway.app/admin (paste your ADMIN_TOKEN),
then read it back:
curl -X POST https://<app>.up.railway.app/ofrep/v1/evaluate/flags/new-checkout \ -H "x-api-key: $READ_API_KEY" -H "content-type: application/json" \ -d '{"context":{"targetingKey":"tester-1"}}'Everything container-specific is in Deploy with Docker; Railway just runs that image.