CloudJod

Fixing itVibe coder

My app works on my laptop but never answers after I deploy it. Why?

The answer

Almost always the app listens on a fixed port, or on localhost only. In a container it must listen on 0.0.0.0 and on the port in the PORT environment variable, which the platform sets. Read PORT at start-up (process.env.PORT in Node, os.environ['PORT'] in Python) and bind to 0.0.0.0, then check the app's Logs for the line where it says it started.

Why doing it by hand hurts

On a server of your own you guess the port, open it in a firewall, put a reverse proxy in front and keep its config in step with the app. Bind to 127.0.0.1 by habit and the proxy sees nothing; hard-code 3000 and the next app collides with it. None of it errors loudly: the request just hangs.

How CloudJod handles it

CloudJod always gives an app PORT and routes its HTTPS address there. Every deploy makes a release whose new copies must pass the health check, on the path you choose (/ unless you say otherwise), before they get traffic, and only then are the old copies stopped: a deploy that never answers does not take a working app down, and its Logs say why. The trade-off: the app has to read PORT and listen on every address, not on localhost alone.

sealed settings opened at start container starting running PORT=8080 DATABASE_URL=••• API_KEY=•••
PORT and your settings are handed to each container as it starts.
Under the hood

the old copies keep serving until the new ones pass their health check. What would a rolling deploy look like without that check?

Read more in the documentation