add a more generous solution to starting containers while backup still running

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-02-19 23:21:04 +01:00
parent 7058cf2090
commit 491693f402
5 changed files with 15 additions and 36 deletions

View file

@ -11,10 +11,5 @@ RUN set -ex; \
; \
rm -rf /var/lib/apt/lists/*
COPY start.sh /
RUN chmod +x /start.sh
ENTRYPOINT ["/bin/tini", "--", "/start.sh"]
HEALTHCHECK CMD nc -z localhost 9200 || exit 1
LABEL com.centurylinklabs.watchtower.monitor-only="true"

View file

@ -1,18 +0,0 @@
#!/bin/bash
# Only start container if database is accessible (needed for backup to work correctly)
while ! nc -z "$POSTGRES_HOST" 5432; do
echo "Waiting for database to start..."
sleep 5
done
# Show wiki if vm.max_map_count is too low
if [ "$(sysctl -n vm.max_map_count)" -le 65530 ]; then
echo "max_map_count is too low and needs to be adjusted."
echo "See https://github.com/nextcloud/all-in-one/discussions/1775 how to change max_map_count"
fi
# Run initial entrypoint
/usr/local/bin/docker-entrypoint.sh
exec "$@"

View file

@ -38,9 +38,10 @@ if [ "$AUTOMATIC_UPDATES" = 1 ]; then
fi
# Wait for watchtower to stop
if [ "$AUTOMATIC_UPDATES" = 1 ] && ! docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; then
echo "Something seems to be wrong: Watchtower should be started at this step."
else
if [ "$AUTOMATIC_UPDATES" = 1 ]; then
if ! docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; then
echo "Something seems to be wrong: Watchtower should be started at this step."
fi
while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; do
echo "Waiting for watchtower to stop"
sleep 30
@ -58,6 +59,13 @@ fi
if [ "$DAILY_BACKUP" = 1 ]; then
echo "Creating daily backup..."
sudo -u www-data php /var/www/docker-aio/php/src/Cron/CreateBackup.php
if ! docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-borgbackup$"; then
echo "Something seems to be wrong: the borg container should be started at this step."
fi
while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-borgbackup$"; do
echo "Waiting for backup container to stop"
sleep 30
done
fi
# Execute backup check