portler start
Run one local service in the foreground for a deployment platform.
portler start [service] [--prod] [--drain-ms <ms>]- Uses the service's
command(orprod.commandwith--prod) in itscwd. - Inherits stdin, stdout and stderr; forwards SIGINT/SIGTERM to the shell and its process group. Returns the child's exit code (or
128 + signal numberif the shell is terminated by a signal). - Returns only when the whole process group has exited. After the shell exits,
startwaits up to--drain-msmilliseconds (default 10000) for whatever the shell left running (a server itexec'd that is draining on SIGTERM, a process it backgrounded), then kills what is still there and returns the shell's exit code.--drain-mstakes whole milliseconds up to 2147483647 (about 24.8 days); a larger value is refused. A platform that watches Portler's pid therefore sees the app finish, not the shell. If something is still there after that (a member that survived SIGKILL),startsays so on stderr and returns anyway. On Linux a group that holds only zombies (left by a PID 1 that does not reap orphans) counts as exited, sostartdoes not wait out--drain-msfor them; seeportler down. - Keep the server in the foreground (
exec node server.js). A command that backgrounds or daemonizes is not supervised:startonly waits for the group to empty, then returns. Likesetup, the command has no controlling terminal (/dev/tty). - With
--prod,prod.requirekeys must be present and non-empty in what the deployment supplies, the platform environment or theuse_envfile;startfails before running the command otherwise. Valuesstartsets itself do not count: withrequire: [PORT]andport_env: PORT, a platform that sets noPORTfails instead of getting the declared or a free port. APORTin theuse_envfile does not count either:startfills itsport_envnames with the port it listens on, and only the platform'sPORTchooses that port. A service left out byprod.servicescannot be started. - Writes no state, starts no dependencies or proxy, performs no setup, and uses no supervisor. Run
portler setup --prodseparately as the build step. - If the service is omitted, selects the only local service with a command. Otherwise the error lists candidates. Docker services are rejected.
Ports and environment
The service port is PORT from the environment, otherwise the declared port, otherwise a free ephemeral port. Invalid PORT values are errors. The chosen port is exposed through the service's port_env names; add port_env: PORT for apps that read it. Unlike up, there is no global registry and no preferred-port probing for declared/platform ports.
Existing process environment values win over .env and config values, including production overrides. This lets platform secrets and settings override local development defaults. Generated PORTLER_* values, PORTLER_SERVICE_NAME and the port_env names stay Portler's own: the platform's PORT selects the port, and those values are derived from that choice, so a stale PORTLER_* value in the shell cannot reach the service. Below that, a use_env file (a missing file is skipped, since deploys rarely ship it) wins over root env and service env, so a file placed on the server also beats the config's development defaults; production env is merged at each respective level. File and platform values are used as written; only config values are Portler expressions, and a config key the file or the platform supplies is not resolved at all.
Service references resolve against declared ports/hosts, not saved development assignments. The selected service uses its chosen port. An unresolved reference fails with the variable's name, unless that variable is already provided by the platform. Services without declared ports cannot be reference targets (except the selected service); a proxy reference must be replaced by a platform env value because start runs no proxy.
services:
api:
cwd: apps/api
command: npm run dev
port: 4000
port_env: PORT
prod:
command: node dist/server.jsPORT=8080 portler start api --prod--file <path> selects another config. See Setup & production for platform mapping.