Serve commands
dpl serve is the long-running process for one base directory.
DPL_BASE=/opt/dpl dpl serveIn production, run it with systemd.
What serve does
Section titled “What serve does”dpl serve:
- holds
state/serve.pidas 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.
systemd example
Section titled “systemd example”[Unit]Description=dpl serviceWants=network-online.targetAfter=network-online.target
[Service]Type=simpleEnvironment="DPL_BASE=/opt/dpl"ExecStart=/usr/local/bin/dpl serveExecReload=/bin/kill -s HUP $MAINPIDKillMode=processTimeoutStopSec=300Restart=alwaysRestartSec=5
[Install]WantedBy=multi-user.targetOne daemon per base directory
Section titled “One daemon per base directory”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.