Browse all topics

Build & deploy

Ports and the run command

How your app must start and listen so Dadisiweb can reach it.

Your app is started by your run command inside its own container. For visitors to reach it, it must listen on all network interfaces (0.0.0.0, not only localhost) on the port we give it.

The port#

Every service receives two environment variables with the port your app must use:

  • PORT
  • APP_PORT (the same number)

The default depends on the run command: Node.js apps usually use 3000, Python apps (gunicorn, uvicorn, Django) 8000, php artisan serve 8000, and PHP-FPM 9000. Using the environment variable is always the safest choice.

StackRun command
Next.jsnpm start (or yarn start)
Express / Nodenode server.js (read process.env.PORT)
Djangogunicorn myproject.wsgi:application --bind 0.0.0.0:$APP_PORT
Flaskgunicorn app:app --bind 0.0.0.0:$APP_PORT
FastAPIuvicorn main:app --host 0.0.0.0 --port $APP_PORT
Laravelphp artisan serve --host=0.0.0.0 --port=$APP_PORT
Go./server (build it with go build -o server .)
Rust./target/release/your-binary (build it with cargo build --release)

Common mistakes#

  • Listening on localhost only. The app starts but visitors see a 502 page. Bind to 0.0.0.0.
  • A hard-coded port such as 5000. Read the port from PORT instead.
  • A run command that finishes straight away (for example a build step). The app must keep running.
  • Missing runtime packages. Install them in the build command (npm ci, pip install -r requirements.txt, composer install).