From 9d313608cf8ab1924f63f1f641495cfdc840d4af Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Wed, 28 Feb 2024 22:52:54 +0100 Subject: [PATCH] docker: Add helper scripts to gracefully stop / wait for proxy. --- docker/proxy/Dockerfile | 3 +++ docker/proxy/stop.sh | 26 ++++++++++++++++++++++++++ docker/proxy/wait.sh | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100755 docker/proxy/stop.sh create mode 100755 docker/proxy/wait.sh diff --git a/docker/proxy/Dockerfile b/docker/proxy/Dockerfile index 114ffe0..7747edc 100644 --- a/docker/proxy/Dockerfile +++ b/docker/proxy/Dockerfile @@ -19,9 +19,12 @@ RUN adduser -D spreedbackend && \ COPY --from=builder /workdir/bin/proxy /usr/bin/nextcloud-spreed-signaling-proxy COPY ./proxy.conf.in /config/proxy.conf.in COPY ./docker/proxy/entrypoint.sh / +COPY ./docker/proxy/stop.sh / +COPY ./docker/proxy/wait.sh / RUN chown spreedbackend /config RUN /usr/bin/nextcloud-spreed-signaling-proxy -version USER spreedbackend +STOPSIGNAL SIGUSR1 ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/docker/proxy/stop.sh b/docker/proxy/stop.sh new file mode 100755 index 0000000..fe479fb --- /dev/null +++ b/docker/proxy/stop.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Standalone signaling server for the Nextcloud Spreed app. +# Copyright (C) 2024 struktur AG +# +# @author Joachim Bauch +# +# @license GNU AGPL version 3 or any later version +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +set -e + +echo "Schedule signaling proxy to shutdown ..." +exec killall -USR1 nextcloud-spreed-signaling-proxy diff --git a/docker/proxy/wait.sh b/docker/proxy/wait.sh new file mode 100755 index 0000000..d48ced7 --- /dev/null +++ b/docker/proxy/wait.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Standalone signaling server for the Nextcloud Spreed app. +# Copyright (C) 2024 struktur AG +# +# @author Joachim Bauch +# +# @license GNU AGPL version 3 or any later version +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +set -e + +echo "Waiting for signaling proxy to shutdown ..." +while true +do + if ! pgrep nextcloud-spreed-signaling-proxy > /dev/null ; then + echo "Signaling proxy has stopped" + exit 0 + fi + sleep 1 +done