From e7cb0f4bcaf5fdde59b553b5809f079c8a0b11a0 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Tue, 17 Sep 2024 09:07:54 -0500 Subject: [PATCH] feat(jvb): autoscaler sidecar shutdown hook on finish (#1906) --- jvb/rootfs/etc/services.d/jvb/finish | 2 +- jvb/rootfs/opt/jitsi/shutdown.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jvb/rootfs/etc/services.d/jvb/finish b/jvb/rootfs/etc/services.d/jvb/finish index 9f7171a..85a5659 100644 --- a/jvb/rootfs/etc/services.d/jvb/finish +++ b/jvb/rootfs/etc/services.d/jvb/finish @@ -5,5 +5,5 @@ # services and shutdown the container. if [[ $1 -eq 0 ]]; then - s6-svscanctl -t /var/run/s6/services + /opt/jitsi/shutdown.sh fi diff --git a/jvb/rootfs/opt/jitsi/shutdown.sh b/jvb/rootfs/opt/jitsi/shutdown.sh index 0464acb..4821f60 100755 --- a/jvb/rootfs/opt/jitsi/shutdown.sh +++ b/jvb/rootfs/opt/jitsi/shutdown.sh @@ -1,8 +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 + +if [ -n "$AUTOSCALER_URL" ]; then + # notify the sidecar of imminent shutdown + PORT=${AUTOSCALER_SIDECAR_PORT:-6000} + curl -d '{}' -v 0:$PORT/hook/v1/shutdown + sleep 10 +fi # shutdown everything s6-svscanctl -t /var/run/s6/services