Skip to content

Serve commands

dpl serve is the long-running process for one base directory.

Terminal window
DPL_BASE=/opt/dpl dpl serve

In production, run it with systemd.

dpl serve:

  • holds state/serve.pid as a PID file and lock
  • starts containers for deployed runtime units
  • restarts ready units with backoff if they exit
  • stops supervised containers on shutdown
  • runs app timers when they are due
  • re-reads deploy state and starts newly deployed units when a deploy command sends it SIGHUP

Deploy commands do not act as supervisors. They update state and notify dpl serve.

[Unit]
Description=dpl service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
Environment="DPL_BASE=/opt/dpl"
ExecStart=/usr/local/bin/dpl serve
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=process
TimeoutStopSec=300
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target

Run one dpl serve process for each DPL_BASE.

If another instance is already running for the same base directory, the PID lock stops the second daemon from starting.