Deploy on Railway
We run Stockyard on Railway ourselves. Here is how to set it up.
Create the service
In your Railway project, create a new service from your GitHub repo (or from the Stockyard Docker image). Railway auto-detects the Dockerfile and builds the binary.
If deploying from the Docker image directly:
# Image reference for Railway ghcr.io/stockyard-dev/stockyard:latest
Add a persistent volume
Stockyard stores everything in SQLite at /data/stockyard.db. Without a persistent volume, your data is lost on every deploy.
In Railway: Service → Settings → Add Volume. Mount path: /data.
The volume must be mounted at
/data. This is where Stockyard writes the SQLite database by default. The volume survives deploys, restarts, and redeploys.Set environment variables
Add your provider keys and admin key in Railway's Variables tab:
OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-... STOCKYARD_ADMIN_KEY=sy_admin_your_secret
Add as many provider keys as you want. Stockyard auto-detects the provider from each key's prefix.
Port configuration
Stockyard listens on port 4200 by default. Railway auto-detects the port from the running process, but you can set it explicitly in Variables: PORT=4200.
Deploy
Push to your main branch. Railway builds and deploys automatically. Deploy times depend on Railway's build queue but are typically a few minutes for a Go binary build.
Once deployed, verify:
curl https://your-service.up.railway.app/health # {"status":"ok"} curl https://your-service.up.railway.app/api/platform/health \ -H "X-Admin-Key: sy_admin_your_secret" # {"status":"ok","products":29,"active":29,"healthy":29,...}
Auto-deploy from GitHub
Connect your GitHub repo to the Railway service. Every push to the main branch triggers a build and deploy. The persistent volume at /data survives each deploy, so your traces, costs, and configs carry forward.
Railway deploys typically take a few minutes from push to live. The Go build runs in Railway's build environment with no special configuration needed.
Backups on Railway
The persistent volume is not automatically backed up by Railway. Set up a scheduled backup by downloading the SQLite file periodically:
# From your local machine railway run cp /data/stockyard.db ./backups/stockyard-$(date +%Y%m%d).db
Or use the Railway CLI to access the volume directly. For more on backups, see How Stockyard backups work.