Healthchecks
Healthchecks can be used to guarantee zero-downtime deployments of your service by ensuring the new version is live and able to handle requests.
First, make sure your webserver has an endpoint (e.g. /health
) that will return a response with HTTP status code 200 when your application is live and ready. If your application needs to do some initialization on startup (running database migrations, populating cache, etc.), it's a good idea to return a non-200 status code from your endpoint until the initialization completes.
Under Service → Settings, input your health endpoint. Railway will wait for this endpoint to serve a 200
status code before switching traffic to your new deployment.
Timeout
The default timeout on healthchecks is 300 seconds (5 minutes) - if your application fails
to serve a 200
status code during this allotted time, the deploy will be marked
as failed. To increase the timeout, change the number of seconds on the service settings page.
Debugging
Build Logs include detailed healthcheck failure logs.
We also maintain Deploy logs for failed deployments, allowing healthcheck debugging.
Edit this file on GitHub