diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 463633c..a70b28e 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -19,9 +19,12 @@ RUN adduser -D spreedbackend && \ COPY --from=builder /workdir/bin/signaling /usr/bin/nextcloud-spreed-signaling COPY ./server.conf.in /config/server.conf.in COPY ./docker/server/entrypoint.sh / +COPY ./docker/server/stop.sh / +COPY ./docker/server/wait.sh / RUN chown spreedbackend /config RUN /usr/bin/nextcloud-spreed-signaling -version USER spreedbackend +STOPSIGNAL SIGUSR1 ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/docker/server/stop.sh b/docker/server/stop.sh new file mode 100755 index 0000000..d55c857 --- /dev/null +++ b/docker/server/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 server to shutdown ..." +exec killall -USR1 nextcloud-spreed-signaling diff --git a/docker/server/wait.sh b/docker/server/wait.sh new file mode 100755 index 0000000..6a80016 --- /dev/null +++ b/docker/server/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 server to shutdown ..." +while true +do + if ! pgrep nextcloud-spreed-signaling > /dev/null ; then + echo "Signaling server has stopped" + exit 0 + fi + sleep 1 +done