From 726b0f063656ffe98a751fe25dd407b43bdcad70 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Tue, 21 May 2024 16:09:08 -0500 Subject: [PATCH] jibri: adds autoscaler sidecar hook to signal final shutdown (#1810) --- jibri/rootfs/defaults/autoscaler-sidecar.config | 2 +- jibri/rootfs/opt/jitsi/shutdown.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 jibri/rootfs/opt/jitsi/shutdown.sh diff --git a/jibri/rootfs/defaults/autoscaler-sidecar.config b/jibri/rootfs/defaults/autoscaler-sidecar.config index a83173f..d40d3f3 100644 --- a/jibri/rootfs/defaults/autoscaler-sidecar.config +++ b/jibri/rootfs/defaults/autoscaler-sidecar.config @@ -5,7 +5,7 @@ export SHUTDOWN_POLLING_INTERVAL={{ $SHUTDOWN_POLLING_INTERVAL }} export STATS_POLLING_INTERVAL={{ $STATS_POLLING_INTERVAL }} export PORT={{ .Env.AUTOSCALER_SIDECAR_PORT }} export GRACEFUL_SHUTDOWN_SCRIPT="/opt/jitsi/jibri/wait_graceful_shutdown.sh" -export TERMINATE_SCRIPT="/opt/jitsi/jibri/shutdown.sh" +export TERMINATE_SCRIPT="/opt/jitsi/shutdown.sh" export ENABLE_REPORT_STATS=true export POLLING_URL="{{ .Env.AUTOSCALER_URL }}/sidecar/poll" export STATUS_URL="{{ .Env.AUTOSCALER_URL }}/sidecar/status" diff --git a/jibri/rootfs/opt/jitsi/shutdown.sh b/jibri/rootfs/opt/jitsi/shutdown.sh new file mode 100755 index 0000000..1cc01e4 --- /dev/null +++ b/jibri/rootfs/opt/jitsi/shutdown.sh @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bash +# notify the sidecar of imminent shutdown +PORT=${AUTOSCALER_SIDECAR_PORT:-6000} +curl -d '{}' -v 0:$PORT/hook/v1/shutdown +sleep 10 + +# signal jibri to shutdown via rest api +/opt/jitsi/jibri/shutdown.sh + +# shutdown everything else +s6-svscanctl -t /var/run/s6/services