Systemd
Configuring the unit
Here you can find an example of a systemd unit file that can be used to run RoadRunner as a daemon on a server:
[Unit]
Description=High-performance PHP application server
Documentation=https://docs.roadrunner.dev/
[Service]
ExecStart=/usr/local/bin/rr serve -c /var/www/.rr.yaml
Type=notify
# Prevent systemd from terminating the worker processes
KillMode=mixed
# Adjust this to the value in jobs.pool.destroy_timeout
TimeoutStopSec=30
Restart=always
RestartSec=30
[Install]
WantedBy=default.target Where:
/usr/local/bin/rr- path to the RoadRunner binary file/var/www/.rr.yaml- path to the RoadRunner configuration file
These paths are just examples, and the actual paths may differ depending on the specific server configuration and file locations. You should update these paths to match the actual paths used in your server setup.
You should also update the ExecStart option with your own configuration and save the file with a suitable name, such as rr.service. Usually, such user unit files are located in the .config/systemd/user/ directory. To enable the service, you should run the following commands:
and
This will start RoadRunner as a daemon on the server.
For more information about systemd unit files, you can refer to the following link.
Status and logs
To ensure the systemd service has started successfully, use the command:
Example output:
To view logs in real time, use the command:
Example output with info-level logs (see levels):
sd_notify protocol
sd_notify protocolRoadRunner supports the sd_notify protocol. You can use it to notify systemd about the readiness of your application. Don't forget to add the Type=notify directive to the Service section; RoadRunner will automatically detect systemd and send the notification. The only option that can be configured is the watchdog timeout. By default, it is turned off. You can enable it by setting the following option in your .rr.yaml configuration file:
Last updated
Was this helpful?