Since RR v2.5.0
version: "2.7" service: some_service_1: command: "php tests/plugins/service/test_files/loop.php" process_num: 10 exec_timeout: 0s remain_after_exit: true service_name_in_log: false env: - foo: "BAR" restart_sec: 1 some_service_2: command: "tests/plugins/service/test_files/test_binary" process_num: 1 remain_after_exit: true service_name_in_log: false restart_sec: 1s env: - foo: "BAR" exec_timeout: 10s
Service plugin supports any number of nested commands.
command - command to execute. There are no limitations on commands here. Here could be binary, PHP file, script,
process_num - default: 1, number of processes for the command to fire.
exec_timeout - default: 0s (unlimited), maximum allowed time to run for the process. Can be in the form of:
remain_after_exit - default: false. Remain process after exit. For example, if you need to restart process every 10
exec_timeout should be 10s, and
remain_after_exit should be set to true. NOTE: if you kill the process from
outside and if
remain_after_exit will be true, the process will be restarted.
restart_sec - default: 30 seconds. Delay between process stop and restart.
service_name_in_log - default: false, show the service name in the log in the form
env - environment variables to pass to the underlying process from the config.
v2.9 you have an ability to manage services via RPC interface.
All communication between PHP and GO made by the RPC calls with protobuf payloads. You can find versioned proto-payloads here: Proto.
Create(in *serviceV1.Create, out *serviceV1.Response) error- Create a new service.
Restart(in *serviceV1.Service, out *serviceV1.Response) error- Restart an exist service.
Terminate(in *serviceV1.Service, out *serviceV1.Response) error- Terminate (Kill) an exist service.
Status(in *serviceV1.Service, out *serviceV1.Status) error- Get status for an exist service.
List(_ *serviceV1.Service, out *serviceV1.List) error- Get list of available services.
If you need to manage RR services in your PHP project you can use composer package
spiral/roadrunner-services for that.