Daemonization moves a Pingora server to the background after it has finished bootstrapping. The process detaches from the controlling terminal, redirects its output to a configured log file, and optionally changes its working directory and running identity. This is the standard way to deploy Pingora in production environments where a process manager or init system is in charge.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/pingora/llms.txt
Use this file to discover all available pages before exploring further.
Enabling Daemonization
Daemonization can be activated in two equivalent ways: Via CLI flag — pass-d or --daemon when starting the binary:
daemon: true in the YAML configuration:
How Fork Works in run_forever()
Daemonization is implemented inside the run_forever() call using a fork() syscall. The parent process exits immediately after the fork; the child becomes the background daemon.
Privilege Dropping
Daemonization is the standard place to perform privilege separation. You can start the process asroot to perform privileged actions — loading TLS private keys, binding to port 443, reading secrets from protected files — and then have Pingora switch to an unprivileged user and group before it begins accepting network connections.
Configure the target identity in the YAML file:
run_forever(). After the switch, the process cannot regain elevated privileges.
Tracking the Process with pid_file
When running in the background, you need a reliable way to find the daemon’s PID in order to send it signals (SIGTERM, SIGQUIT, etc.). Set pid_file in the config and Pingora will write the daemon’s PID to that path after daemonization:
Readiness Signalling with daemon_wait_for_ready
By default, the parent process exits as soon as the fork succeeds, before the child has finished bootstrapping. For systemd-based deployments this is a problem: if the parent exits too early, systemd may send SIGQUIT to the old service before the new instance is ready to accept traffic.
Setting daemon_wait_for_ready: true makes the parent block until the daemon sends a SIGUSR1 signal back to it, indicating that bootstrap is complete:
| Setting | Effect | Default |
|---|---|---|
daemon_wait_for_ready | Parent waits for SIGUSR1 from daemon before exiting. | false |
daemon_ready_timeout_seconds | Seconds the parent will wait for readiness. Exits with non-zero code on timeout (causes systemd to abort reload). | 600 |
daemon_notify_timeout_seconds | Seconds the daemon retries sending SIGUSR1 when the attempt fails with a permission error (covers the brief post-fork window where UIDs haven’t settled). | 60 |
systemctl reload.