mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-21 02:40:09 +00:00
fix: prevent mastercontainer race condition and add AIO_LOG_LEVEL defaults in container scripts
Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/1b34e6db-7e7c-426e-addf-cce3ef7c5944 Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0a553459ab
commit
1f86bc2aae
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
if [ "$AIO_LOG_LEVEL" = "warn" ]; then
|
if [ "$AIO_LOG_LEVEL" = "warn" ]; then
|
||||||
BORG_LOG_LEVEL_FLAG="--warning"
|
BORG_LOG_LEVEL_FLAG="--warning"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
if [ "$AIO_LOG_LEVEL" = "warn" ]; then
|
if [ "$AIO_LOG_LEVEL" = "warn" ]; then
|
||||||
COLLABORA_LOG_LEVEL="warning"
|
COLLABORA_LOG_LEVEL="warning"
|
||||||
elif [ "$AIO_LOG_LEVEL" = "info" ]; then
|
elif [ "$AIO_LOG_LEVEL" = "info" ]; then
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
ELASTIC_LOG_LEVEL="$(echo "$AIO_LOG_LEVEL" | tr '[:lower:]' '[:upper:]')"
|
ELASTIC_LOG_LEVEL="$(echo "$AIO_LOG_LEVEL" | tr '[:lower:]' '[:upper:]')"
|
||||||
|
|
||||||
exec env "logger.level=$ELASTIC_LOG_LEVEL" /usr/local/bin/docker-entrypoint.sh "$@"
|
exec env "logger.level=$ELASTIC_LOG_LEVEL" /usr/local/bin/docker-entrypoint.sh "$@"
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
GOLANG_LOG="$(case "$AIO_LOG_LEVEL" in
|
GOLANG_LOG="$(case "$AIO_LOG_LEVEL" in
|
||||||
debug) printf 'info' ;;
|
debug) printf 'info' ;;
|
||||||
info) printf 'info' ;;
|
info) printf 'info' ;;
|
||||||
warn) printf 'warning' ;;
|
warn) printf 'warning' ;;
|
||||||
error) printf 'error' ;;
|
error) printf 'error' ;;
|
||||||
|
*) printf 'warning' ;;
|
||||||
esac)"
|
esac)"
|
||||||
export GOLANG_LOG
|
export GOLANG_LOG
|
||||||
if [ "$AIO_LOG_LEVEL" = "debug" ]; then
|
if [ "$AIO_LOG_LEVEL" = "debug" ]; then
|
||||||
|
|||||||
@@ -59,6 +59,15 @@ fi
|
|||||||
|
|
||||||
# Wait for watchtower to stop
|
# Wait for watchtower to stop
|
||||||
if [ "$AUTOMATIC_UPDATES" = 1 ]; then
|
if [ "$AUTOMATIC_UPDATES" = 1 ]; then
|
||||||
|
# Give Docker time to register the container as running before checking for it.
|
||||||
|
# Without this, there is a race condition where the check below runs before watchtower
|
||||||
|
# appears in `docker ps`, causing the script to skip the wait and continue with
|
||||||
|
# the potentially outdated mastercontainer code while watchtower is still updating it.
|
||||||
|
count=0
|
||||||
|
while ! docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$" && [ "$count" -lt 12 ]; do
|
||||||
|
sleep 5
|
||||||
|
count=$((count + 1))
|
||||||
|
done
|
||||||
if ! docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; 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."
|
echo "Something seems to be wrong: Watchtower should be started at this step."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
run_upgrade_if_needed_due_to_app_update() {
|
run_upgrade_if_needed_due_to_app_update() {
|
||||||
if php /var/www/html/occ status | grep maintenance | grep -q true; then
|
if php /var/www/html/occ status | grep maintenance | grep -q true; then
|
||||||
php /var/www/html/occ maintenance:mode --off
|
php /var/www/html/occ maintenance:mode --off
|
||||||
@@ -29,6 +32,7 @@ NEXTCLOUD_LOG_LEVEL="$(case "$AIO_LOG_LEVEL" in
|
|||||||
info) printf '1' ;;
|
info) printf '1' ;;
|
||||||
warn) printf '2' ;;
|
warn) printf '2' ;;
|
||||||
error) printf '3' ;;
|
error) printf '3' ;;
|
||||||
|
*) printf '2' ;;
|
||||||
esac)"
|
esac)"
|
||||||
export NEXTCLOUD_LOG_LEVEL
|
export NEXTCLOUD_LOG_LEVEL
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
export RUST_LOG="$AIO_LOG_LEVEL"
|
export RUST_LOG="$AIO_LOG_LEVEL"
|
||||||
|
|
||||||
if [ -z "$NEXTCLOUD_HOST" ]; then
|
if [ -z "$NEXTCLOUD_HOST" ]; then
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
POSTGRES_LOG_MIN_MESSAGES="$(case "$AIO_LOG_LEVEL" in
|
POSTGRES_LOG_MIN_MESSAGES="$(case "$AIO_LOG_LEVEL" in
|
||||||
debug) printf 'debug1' ;;
|
debug) printf 'debug1' ;;
|
||||||
info) printf 'info' ;;
|
info) printf 'info' ;;
|
||||||
warn) printf 'warning' ;;
|
warn) printf 'warning' ;;
|
||||||
error) printf 'error' ;;
|
error) printf 'error' ;;
|
||||||
|
*) printf 'warning' ;;
|
||||||
esac)"
|
esac)"
|
||||||
export POSTGRES_LOG_MIN_MESSAGES
|
export POSTGRES_LOG_MIN_MESSAGES
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
# Redis only supports [debug, verbose, notice, warning, nothing] as log level
|
# Redis only supports [debug, verbose, notice, warning, nothing] as log level
|
||||||
if [ "$AIO_LOG_LEVEL" = "warn" ] || [ "$AIO_LOG_LEVEL" = "error" ]; then
|
if [ "$AIO_LOG_LEVEL" = "warn" ] || [ "$AIO_LOG_LEVEL" = "error" ]; then
|
||||||
REDIS_LOG_LEVEL="warning"
|
REDIS_LOG_LEVEL="warning"
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
TALK_RECORDING_LOG_LEVEL="$(case "$AIO_LOG_LEVEL" in
|
TALK_RECORDING_LOG_LEVEL="$(case "$AIO_LOG_LEVEL" in
|
||||||
debug) printf '10' ;;
|
debug) printf '10' ;;
|
||||||
info) printf '20' ;;
|
info) printf '20' ;;
|
||||||
warn) printf '30' ;;
|
warn) printf '30' ;;
|
||||||
error) printf '40' ;;
|
error) printf '40' ;;
|
||||||
|
*) printf '30' ;;
|
||||||
esac)"
|
esac)"
|
||||||
export TALK_RECORDING_LOG_LEVEL
|
export TALK_RECORDING_LOG_LEVEL
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
if [ "$AIO_LOG_LEVEL" = "warn" ]; then
|
if [ "$AIO_LOG_LEVEL" = "warn" ]; then
|
||||||
ETURNAL_LOG_LEVEL="warning"
|
ETURNAL_LOG_LEVEL="warning"
|
||||||
else
|
else
|
||||||
@@ -15,6 +18,7 @@ JANUS_LOG_LEVEL="$(case "$AIO_LOG_LEVEL" in
|
|||||||
info) printf '4' ;;
|
info) printf '4' ;;
|
||||||
warn) printf '3' ;;
|
warn) printf '3' ;;
|
||||||
error) printf '1' ;;
|
error) printf '1' ;;
|
||||||
|
*) printf '3' ;;
|
||||||
esac)"
|
esac)"
|
||||||
export JANUS_LOG_LEVEL
|
export JANUS_LOG_LEVEL
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
# Check if socket is available and readable
|
# Check if socket is available and readable
|
||||||
if ! [ -e "/var/run/docker.sock" ]; then
|
if ! [ -e "/var/run/docker.sock" ]; then
|
||||||
echo "Docker socket is not available. Cannot continue."
|
echo "Docker socket is not available. Cannot continue."
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Defensive default: ensure AIO_LOG_LEVEL is never empty so log-level mappings below always resolve correctly
|
||||||
|
AIO_LOG_LEVEL="${AIO_LOG_LEVEL:-warn}"
|
||||||
|
|
||||||
export LOG_LEVEL="$AIO_LOG_LEVEL"
|
export LOG_LEVEL="$AIO_LOG_LEVEL"
|
||||||
|
|
||||||
# Only start container if nextcloud is accessible
|
# Only start container if nextcloud is accessible
|
||||||
|
|||||||
Reference in New Issue
Block a user