-
Hello, I'm running a PHP CronJob into a Kubernetes cluster and I would like to have the Prometheus Exporter during the execution. In my . # RR configuration version
version: "2.7"
rpc:
listen: tcp://127.0.0.1:6001
service:
some_service_1:
command: "php my-script.php"
process_num: 1
exec_timeout: 0
remain_after_exit: false
restart_sec: 0
metrics:
address: localhost:2112 And inside <?php
require "vendor/autoload.php";
use Spiral\RoadRunner\Environment;
use Spiral\Goridge\RPC\RPC;
use Spiral\RoadRunner\Metrics\Metrics;
$rpc = RPC::create(Environment::fromGlobals()->getRPCAddress());
$metrics = new Metrics($rpc);
$metrics->add('app_metric_counter', 1); This code works fine by starting the server with Now, I would like to stop Roadrunner to "delete" the container (because it is a Kubernetes CronJob). // Kill the job
$manager = new Manager($rpc);
$manager->terminate('some_service_1'); But this code just terminate the service and not all the server. Roadrunner has the Do you have an idea how to do it better? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey @Baiquette 👋🏻. RR accepts SIGINT or SIGTERM syscalls to stop. On the stop, k8s will send these signals to the pod with RR, and RR will stop itself. So, you don't need any additional commands. After receiving SIGINT/SIGTERM RR will gracefully stop all active plugins. To manage the EDIT: |
Beta Was this translation helpful? Give feedback.
Hey @Baiquette 👋🏻. RR accepts SIGINT or SIGTERM syscalls to stop. On the stop, k8s will send these signals to the pod with RR, and RR will stop itself. So, you don't need any additional commands. After receiving SIGINT/SIGTERM RR will gracefully stop all active plugins. To manage the
graceful
timeout, you may set this configuration option: https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml#L1596EDIT:
./rr stop
will land in thev2.10.3
.