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:
PORTAPP_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.
| Stack | Run command |
|---|---|
| Next.js | npm start (or yarn start) |
| Express / Node | node server.js (read process.env.PORT) |
| Django | gunicorn myproject.wsgi:application --bind 0.0.0.0:$APP_PORT |
| Flask | gunicorn app:app --bind 0.0.0.0:$APP_PORT |
| FastAPI | uvicorn main:app --host 0.0.0.0 --port $APP_PORT |
| Laravel | php 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
localhostonly. The app starts but visitors see a 502 page. Bind to0.0.0.0. - A hard-coded port such as 5000. Read the port from
PORTinstead. - 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).