RoadRunner
  • 🟠General
    • What is RoadRunner?
    • Features
    • Quick Start
    • Installation
    • Configuration
    • Contributing
    • Upgrade and Compatibility
  • 👷PHP Worker
    • Worker
    • Workers pool
    • Developer mode
    • Code Coverage
    • Debugging
    • Environment
    • Manual workers scaling
    • Auto workers scaling
    • RPC
  • 🟢Customization
    • Building RR with a custom plugin
    • Integrating with Golang Apps
    • Writing a Middleware
    • Writing a Jobs Driver
    • Writing a Plugin
    • Events Bus
  • 🔌Plugins
    • Intro into Plugins
    • Centrifuge (WebSockets)
    • Service (Systemd)
    • Configuration
    • Server
    • Locks
    • gRPC
    • TCP
  • 🌐Community Plugins
    • Intro into Community Plugins
    • Circuit Breaker
    • SendRemoteFile
    • RFC 7234 Cache
  • 🔵App Server
    • Production Usage
    • RoadRunner with NGINX
    • RR as AWS Lambda
    • Docker Images
    • CLI Commands
    • Systemd
  • 🔐Key-Value
    • Intro into KV
    • Memcached
    • In-Memory
    • BoltDB
    • Redis
  • 📦Queues and Jobs
    • Intro into Jobs
    • Google Pub/Sub
    • Beanstalk
    • In-Memory
    • RabbitMQ
    • BoltDB
    • Kafka
    • NATS
    • SQS
  • 🕸️HTTP
    • Intro into HTTP
    • Headers and CORS
    • Proxy IP parser
    • Static files
    • X-Sendfile
    • Streaming
    • gzip
  • 📈Logging and Observability
    • OpenTelemetry
    • HealthChecks
    • Access Logs
    • AppLogger
    • Metrics
    • Grafana
    • Logger
  • 🔀Workflow Engine
    • Temporal.io
    • Worker
  • 🧩Integrations
    • Migration from RRv1 to RRv2
    • Spiral Framework
    • Yii
    • Symfony
    • Laravel
    • ChubbyPHP
  • 🧪Experimental Features
    • List of the Experimental Features
  • 🚨Error codes
    • CRC validation failed
    • Allocate Timeout
  • 📚Releases
    • v2025.1.1
    • v2025.1.0
    • v2024.3.5
    • v2024.3.4
    • v2024.3.3
    • v2024.3.2
    • v2024.3.1
    • v2024.3.0
Powered by GitBook
On this page
  • Configuring unit
  • Status and logs
  • sd_notify protocol

Was this helpful?

Edit on GitHub
  1. App Server

Systemd

Configuring unit

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:

systemctl status rr.service

Example output:

● rr.service - High-performance PHP application server
     Loaded: loaded (/lib/systemd/system/rr.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-03-12 19:20:55 UTC; 35min ago
     Docs: https://docs.roadrunner.dev/
     CGroup: /system.slice/rr.service
             ├─2835793 /usr/local/bin/rr serve -c /var/www/.rr.yaml
             ├─2895807 /usr/local/bin/php worker.php
             ├─2897198 /usr/local/bin/php worker.php
             ├─2897765 /usr/local/bin/php worker.php

To view logs in real time, use the command:

journalctl -f -u rr.service
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
PreviousCLI CommandsNextIntro into KV

Last updated 5 months ago

Was this helpful?

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:

🔵
link
sd_notify
level logs