health endpoint
digi604
PROOP

a month ago

we have a project with a backend and 5 workers nodes. they all use the same checkout path from the git repo. the backend should have a health endpoint... but if i enable this: all workers get this endpoint as well and fail deployment. I can also not select the "Service" here as it is Zenline App service.. and i am not admin there.

$30 Bounty

1 Replies

Railway
BOT

a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open Railway about 1 month ago


hyper674
PRO

a month ago

Easiest fix is to wrap the health endpoint behind an env var check. Something like:

```javascript

if (process.env.SERVICE_TYPE === 'backend') {

app.get('/health', (req, res) => res.status(200).send('ok'));

}

```

Then just set SERVICE_TYPE=backend on the backend service in Railway and leave it unset on the workers. Workers won't spin up the endpoint, so the health check won't apply to them.

For the workers themselves, go into each one's settings and set the health check to "None" since they're not running an HTTP server anyway.

If you don't have access to change the health check settings, the env var approach alone should work just make sure the workers aren't trying to bind to a port at all.


Loading...