Here you can find an example of systemd unit file that can be used to run RoadRunner as a daemon on a server:
rr.service
[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:
systemctl enable --user rr.service
and
systemctl start rr.service
This will start RoadRunner as a daemon on the server.
Status and logs
Make sure that the systemd service has started successfully, use the command:
Mar 12 20:12:53 server systemd[1]: Starting PHP application server...
Mar 12 20:12:55 server rr[2936506]: [INFO] RoadRunner server started; version: 2023.3.10, buildtime: 2024-02-01T22:33:17+0000
Mar 12 20:12:55 server rr[2936506]: [INFO] sdnotify: notified
Mar 12 20:12:55 server systemd[1]: Started PHP application server.
sd_notify protocol
.rr.yaml
endure:
log_level: error
watchdog_sec: 60 # watchdog timeout in seconds
For more information about systemd unit files, the user can refer to the following .
Example output with info :
Roadrunner supports protocol. You can use it to notify systemd about the readiness of your application. Don't forget to add Type=notify directive to the Service section, Roadrunner will automatically detect systemd and send the notification. The only one option which might be configured is watchdog timeout. By default, it's turned off. You can enable it by setting the following option in your .rr.yaml config: