Turntable

Deploy on Railway

Deploying Turntable on Railway with no shell: the CLI deploy, the volume, the variables, the first-boot key, the drop-privileges behaviour and the trusted-proxies setting.

This page describes a layout for Railway (or any platform that gives you environment variables, a volume per service and no shell). Names such as turntable.example.com are placeholders. The first sections follow a real deploy of one main service (API and web UI, then a worker); the release lane service is described from the code and the image, so check the volume limit below before you plan around two services.

Deploying from the CLI

Railway can build from a GitHub repository through its own GitHub app, but that app needs access to the repository. When it does not have it, deploy from your machine:

  1. Make a clean copy of the commit you want, with no .git and no untracked files: git archive --format=tar HEAD | tar -x -C /tmp/turntable-src (use git archive <tag> for a release).
  2. From that directory, with the Railway CLI logged in and linked to the project and service: railway up. Railway builds the repository’s Dockerfile (a distroless image that runs as root only long enough to take ownership of the volume, then drops privileges) and deploys it.
  3. Repeat for each update. The deploy is a build of whatever you archived, so tag or note the commit you shipped.

Set variables without redeploying. Every variable change redeploys the service by default. While you set several, pass --skip-deploys (railway variables --set NAME=value --skip-deploys), then run one railway up (or redeploy) when they are all in. Set secrets from a file or the dashboard, never on a command line you keep in shell history.

First boot with no shell

There is no shell to run turntable keys init or turntable token generate on the instance, so both are done ahead of time or by the image itself:

  • The master key. Set TURNTABLE_MASTER_KEY_FILE=/data/master.key and TURNTABLE_MASTER_KEY_AUTOINIT=1. On first boot the server creates the file on the volume (32 random bytes, private, written once, never overwritten). Back it up from the volume after the first start: without it stored secrets cannot be opened, and a volume that is lost takes the key with it. Remove TURNTABLE_MASTER_KEY_AUTOINIT afterwards if you prefer a missing key to be an error.
  • The first token. On your own machine run turntable token generate; keep the token and set only its sha256 as TURNTABLE_BOOTSTRAP_TOKEN_SHA256. On boot an org with no tokens gets one operator token with that hash, and the secret never touches the environment or the logs. Remove the variable once you have made real tokens.
  • The GitHub App. With TURNTABLE_GITHUB_APP_SETUP_TOKEN_SHA256 and TURNTABLE_PUBLIC_URL set, the instance creates its own App through GitHub’s manifest flow; see Hosted deployment.

Point the health check at /healthz. The service has no public admin shell, so everything after this goes through the API, MCP or the web UI with the token.

Layout

Main serviceRelease service
Imageghcr.io/turntable-ci/turntablethe same image
Start commandserve (the image default), with TURNTABLE_WORKER=1 to run jobs in itserve --roles release
Public networkingYes: one domainNo. It listens on nothing and needs no domain
VolumeMounted at /dataIts own volume, for its keys and attestations
Roleweb, and worker and poller if you set themthe release lane, alone

Run the release lane only when you sign or publish releases. Without it, leave the second service out.

Volumes

  • Main: mount a volume at /data and set TURNTABLE_DATA_DIR=/data. It holds turntable.db (and its -wal and -shm files) and, if you keep it there, the master key and its .audit-state directory (TURNTABLE_MASTER_KEY_FILE=/data/master.key, created on first boot with TURNTABLE_MASTER_KEY_AUTOINIT=1, or with turntable keys init elsewhere and uploaded).
  • Release: a separate volume, for example at /release, with TURNTABLE_RELEASE_DATA_DIR=/release/state and the lane’s key at TURNTABLE_RELEASE_MASTER_KEY_FILE=/release/master.key. The main service must not be able to read it.

Variables

Everything is configured from the environment (the full list is in Configuration).

Main service

VariableWhy
TURNTABLE_DATA_DIR=/dataWhere the volume is mounted.
TURNTABLE_PUBLIC_URL=https://turntable.example.comThe public base URL: check run links, WebAuthn and OIDC defaults.
TURNTABLE_BOOTSTRAP_TOKEN_SHA256Hash of a token from turntable token generate, so you can sign in with no shell. Remove it once real tokens exist.
TURNTABLE_MASTER_KEY_FILE=/data/master.keyNeeded for the vault, the GitHub App and OIDC.
TURNTABLE_MASTER_KEY_AUTOINIT=1Create that file on first boot when it is absent (see above).
TURNTABLE_TRUST_FORWARDED_PROTO=1Railway terminates TLS in front of the service: plain-http requests it forwards get a 301 to https, and secret values over x-forwarded-proto: https are accepted.
TURNTABLE_TRUSTED_PROXIESSee below.
TURNTABLE_WORKER=1, TURNTABLE_PROVIDER, TURNTABLE_PROVIDER_CONFIG_JSON, TURNTABLE_POLL_JSONOnly to run jobs in this service. Railway has no Docker socket, so use a remote provider such as daytona; its API key goes in a variable the provider config names (apiKeyEnv), never in the JSON.
TURNTABLE_HOSTED=1A multi-tenant instance: every job must run on a microvm or vm provider. Daytona sandboxes are containers, so TURNTABLE_HOSTED=1 refuses them unless TURNTABLE_ISOLATION_OVERRIDE gives a reason (audited, and shown at the top of each affected job’s log). A single-tenant or shadow instance leaves it off.
TURNTABLE_DATABASE_URLOptional: Postgres instead of the SQLite file on the volume. See Postgres.

Daytona on a shared account. Use the provider config’s fleet (for example longshore-shadow) so this instance only ever lists, counts and deletes its own sandboxes, maxLive (at most 5), and quotaMode: "own-fleet" when the API key cannot read the org’s usage. Give the poll config a token (tokenEnv) unless the repository is public and you accept anonymous polling: then set allowUnauthenticated: true and an intervalSeconds of at least 80 times the requests per cycle (240 seconds for 3, 320 for 4), because GitHub allows 60 anonymous requests an hour per address. See Quickstart and Configuration.

PORT is set by Railway and the server follows it. Point the health check at /healthz.

Release service (only when you run the lane; none of these go on the main service)

VariableWhy
TURNTABLE_RELEASE_MASTER_KEY_FILE, TURNTABLE_RELEASE_DATA_DIRIts own key and state, on its own volume.
TURNTABLE_RELEASE_GITHUB_TOKENRead-only token to re-check tags.
TURNTABLE_RELEASE_GITHUB_PUBLISH_TOKENOptional, to publish.
TURNTABLE_RELEASE_ARTIFACT_DIR, TURNTABLE_RELEASE_BUILDER_ID, TURNTABLE_RELEASE_POLL_MSArtifact bytes, the builder id in provenance, polling interval.
Signing backend and KMS credentialsHere only.

Running as root, and dropping it

Railway mounts volumes owned by root, which a non-root process cannot write. The image therefore starts as root with TURNTABLE_DROP_PRIVILEGES=65532:65532 already set: before it opens the database or any key file, it takes ownership of the files it expects in the data directory (only those names, each through an open descriptor, never following a link), then drops group, supplementary groups and user, and checks that root cannot be regained. A platform that cannot do a step refuses to start.

Do not set RAILWAY_RUN_UID=0 or any other run-as-root override, and do not set TURNTABLE_ALLOW_ROOT=1: the image does not need them, and a server still running as root after startup is refused unless you say so. If a volume was written by an older, root-run deployment, the first start with the drop takes it over; unexpected files in the data directory stop the start with a message naming them.

Trusted proxies

Behind Railway’s edge, the client address on a connection is the proxy’s. TURNTABLE_TRUSTED_PROXIES is a comma-separated list of the addresses and CIDR ranges of the proxies in front of the service. Only a request that arrives from one of them has its x-forwarded-for chain believed, and the webhook failure limiter then keys on the client the chain reports, instead of lumping every caller behind one address.

  • Unset: forwarded headers are ignored entirely. That is safe, and it means the limiter sees the proxy’s address for everyone. A burst of bad webhook calls from one source can then throttle legitimate ones.
  • Do not guess. Use the ranges your platform documents for its edge, and leave it unset if you cannot find them. An entry that is too wide lets a caller spoof its address.
  • TURNTABLE_TRUST_FORWARDED_FOR is no longer read (a warning is printed).

Checklist

  1. Volume at /data, TURNTABLE_DATA_DIR=/data, public domain, TURNTABLE_PUBLIC_URL, TURNTABLE_TRUST_FORWARDED_PROTO=1.
  2. A bootstrap token hash, then curl the API with the token to confirm access; remove the variable after creating real tokens.
  3. The master key at /data/master.key, created on first boot with TURNTABLE_MASTER_KEY_AUTOINIT=1, and backed up from the volume.
  4. No RAILWAY_RUN_UID, no TURNTABLE_ALLOW_ROOT.
  5. Health check /healthz.
  6. Release lane only if you can give it what it needs without weakening the split (see the warning above).

Type to search…

↑↓ navigate↵ openesc close