From 54dc5387a72d9bd61bc46ffd1b7ff8fdddc42745 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Wed, 29 May 2024 13:48:00 +0200 Subject: [PATCH] nextcloud: wait for redis to start Signed-off-by: Simon L --- Containers/nextcloud/entrypoint.sh | 7 +++++++ Containers/redis/start.sh | 1 + 2 files changed, 8 insertions(+) diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index a144ce81..c1945e54 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -19,6 +19,13 @@ run_upgrade_if_needed_due_to_app_update() { fi } +# Only start container if redis is accessible +# shellcheck disable=SC2153 +while ! nc -z "$REDIS_HOST" "6379"; do + echo "Waiting for redis to start..." + sleep 5 +done + # Check permissions in ncdata touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then diff --git a/Containers/redis/start.sh b/Containers/redis/start.sh index 8cb3bb40..69764c1a 100644 --- a/Containers/redis/start.sh +++ b/Containers/redis/start.sh @@ -7,6 +7,7 @@ if [ "$(sysctl -n vm.overcommit_memory)" != "1" ]; then fi # Run redis with a password if provided +echo "Redis has started" if [ -n "$REDIS_HOST_PASSWORD" ]; then exec redis-server --requirepass "$REDIS_HOST_PASSWORD" --loglevel warning else