A Pingora server is a regular, unprivileged, multithreaded process. It doesn’t require a special supervisor or init system to run — it manages its own lifecycle, signal handling, and zero-downtime upgrades internally. The entry point is theDocumentation 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.
Server struct, which owns all services, handles OS signals, and coordinates shutdown or upgrade sequences.
Starting the Server
The minimal bootstrap sequence is three function calls: create the server, bootstrap it, then run it forever.run_forever() blocks the current thread indefinitely — it is the last statement in main(). The function may fork the process when daemonization is enabled (see Daemonization), so any threads you create before run_forever() may be lost.
Enabling CLI Argument Parsing
PassOpt::parse_args() to Server::new() to let Pingora read its standard command-line flags at startup:
CLI Arguments
| Argument | Effect | Default |
|---|---|---|
-d, --daemon | Daemonize the server (run in the background) | false |
-t, --test | Test the server configuration and then exit | false |
-c, --conf | Path to the YAML configuration file | empty string |
-u, --upgrade | Start as a graceful upgrade of a running server | false |
The
-t / --test flag is a work in progress. When set, calling server.bootstrap() exits the process without errors, which is useful for verifying that the new binary can start cleanly before you send SIGQUIT to the running server.Stopping the Server
A running Pingora process responds to three Unix signals, each with different shutdown semantics.SIGINT — Fast Shutdown
Sent by pressing Ctrl+C in a terminal. The server exits immediately with no delay. All in-flight requests are interrupted and their sockets are closed. This is the fastest way to stop a server but is the least graceful, because clients may receive connection resets mid-request.SIGTERM — Graceful Shutdown
The server notifies all its services to stop accepting new connections, then waits for a preconfigured grace period before exiting. Requests that complete within that window finish normally; any still in-flight after the timeout are interrupted.systemctl stop.
