mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-21 10:50:10 +00:00
allow to adjust the log level globally (nextcloud)
Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
@@ -1,4 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
wait_for_cron() {
|
wait_for_cron() {
|
||||||
set -x
|
set -x
|
||||||
while [ -n "$(pgrep -f /var/www/html/cron.php)" ]; do
|
while [ -n "$(pgrep -f /var/www/html/cron.php)" ]; do
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ directory_empty() {
|
|||||||
[ -z "$(ls -A "$1/")" ]
|
[ -z "$(ls -A "$1/")" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
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
|
||||||
@@ -20,6 +24,14 @@ run_upgrade_if_needed_due_to_app_update() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NEXTCLOUD_LOG_LEVEL="$(case "$AIO_LOG_LEVEL" in
|
||||||
|
debug) printf '0' ;;
|
||||||
|
info) printf '1' ;;
|
||||||
|
warn) printf '2' ;;
|
||||||
|
error) printf '3' ;;
|
||||||
|
esac)"
|
||||||
|
export NEXTCLOUD_LOG_LEVEL
|
||||||
|
|
||||||
# Create cert bundle
|
# Create cert bundle
|
||||||
if env | grep -q NEXTCLOUD_TRUSTED_CERTIFICATES_; then
|
if env | grep -q NEXTCLOUD_TRUSTED_CERTIFICATES_; then
|
||||||
|
|
||||||
@@ -75,7 +87,9 @@ if env | grep -q NEXTCLOUD_TRUSTED_CERTIFICATES_; then
|
|||||||
cat "$CERTIFICATE_BUNDLE"
|
cat "$CERTIFICATE_BUNDLE"
|
||||||
|
|
||||||
# Disable debug mode
|
# Disable debug mode
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adjust DATABASE_TYPE to by Nextcloud supported value
|
# Adjust DATABASE_TYPE to by Nextcloud supported value
|
||||||
@@ -222,7 +236,9 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
|
|||||||
if grep -q appstoreurl /var/www/html/config/config.php; then
|
if grep -q appstoreurl /var/www/html/config/config.php; then
|
||||||
set -x
|
set -x
|
||||||
APPSTORE_URL="$(grep appstoreurl /var/www/html/config/config.php | grep -oP 'https://.*v[0-9]+')"
|
APPSTORE_URL="$(grep appstoreurl /var/www/html/config/config.php | grep -oP 'https://.*v[0-9]+')"
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# Default appstoreurl parameter in config.php defaults to 'https://apps.nextcloud.com/api/v1' so we check for the apps.json file stored in there
|
# Default appstoreurl parameter in config.php defaults to 'https://apps.nextcloud.com/api/v1' so we check for the apps.json file stored in there
|
||||||
CURL_STATUS="$(curl -LI "$APPSTORE_URL"/apps.json -o /dev/null -w '%{http_code}\n' -s)"
|
CURL_STATUS="$(curl -LI "$APPSTORE_URL"/apps.json -o /dev/null -w '%{http_code}\n' -s)"
|
||||||
@@ -289,7 +305,9 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
|
|||||||
"$SOURCE_LOCATION/custom_apps/" \
|
"$SOURCE_LOCATION/custom_apps/" \
|
||||||
/var/www/html/custom_apps/
|
/var/www/html/custom_apps/
|
||||||
done
|
done
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy these from Nextcloud archive if they don't exist yet (i.e. new install)
|
# Copy these from Nextcloud archive if they don't exist yet (i.e. new install)
|
||||||
@@ -442,7 +460,7 @@ EOF
|
|||||||
# Apply log settings
|
# Apply log settings
|
||||||
echo "Applying default settings..."
|
echo "Applying default settings..."
|
||||||
mkdir -p /var/www/html/data
|
mkdir -p /var/www/html/data
|
||||||
php /var/www/html/occ config:system:set loglevel --value="2" --type=integer
|
php /var/www/html/occ config:system:set loglevel --value="$NEXTCLOUD_LOG_LEVEL" --type=integer
|
||||||
if [ "$NEXTCLOUD_LOG_TYPE" = "errorlog" ]; then
|
if [ "$NEXTCLOUD_LOG_TYPE" = "errorlog" ]; then
|
||||||
php /var/www/html/occ config:system:set log_type --value="errorlog"
|
php /var/www/html/occ config:system:set log_type --value="errorlog"
|
||||||
php /var/www/html/occ config:system:set log_type_audit --value="errorlog"
|
php /var/www/html/occ config:system:set log_type_audit --value="errorlog"
|
||||||
@@ -764,7 +782,9 @@ if [ "$COLLABORA_ENABLED" = 'yes' ]; then
|
|||||||
if echo "$COLLABORA_HOST" | grep -q "nextcloud-.*-collabora"; then
|
if echo "$COLLABORA_HOST" | grep -q "nextcloud-.*-collabora"; then
|
||||||
COLLABORA_HOST="$NC_DOMAIN"
|
COLLABORA_HOST="$NC_DOMAIN"
|
||||||
fi
|
fi
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
# Remove richdcoumentscode if it should be incorrectly installed
|
# Remove richdcoumentscode if it should be incorrectly installed
|
||||||
if [ -d "/var/www/html/custom_apps/richdocumentscode" ]; then
|
if [ -d "/var/www/html/custom_apps/richdocumentscode" ]; then
|
||||||
php /var/www/html/occ app:remove richdocumentscode
|
php /var/www/html/occ app:remove richdocumentscode
|
||||||
@@ -885,7 +905,9 @@ if [ "$TALK_ENABLED" = 'yes' ]; then
|
|||||||
if [ -z "$TURN_DOMAIN" ]; then
|
if [ -z "$TURN_DOMAIN" ]; then
|
||||||
TURN_DOMAIN="$TALK_HOST"
|
TURN_DOMAIN="$TALK_HOST"
|
||||||
fi
|
fi
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
if ! [ -d "/var/www/html/custom_apps/spreed" ]; then
|
if ! [ -d "/var/www/html/custom_apps/spreed" ]; then
|
||||||
php /var/www/html/occ app:install spreed
|
php /var/www/html/occ app:install spreed
|
||||||
elif [ "$(php /var/www/html/occ config:app:get spreed enabled)" != "yes" ]; then
|
elif [ "$(php /var/www/html/occ config:app:get spreed enabled)" != "yes" ]; then
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# Set a default value for POSTGRES_PORT
|
# Set a default value for POSTGRES_PORT
|
||||||
if [ -z "$POSTGRES_PORT" ]; then
|
if [ -z "$POSTGRES_PORT" ]; then
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$EUID" = 0 ]]; then
|
if [[ "$EUID" = 0 ]]; then
|
||||||
COMMAND=(sudo -E -u www-data php /var/www/html/occ)
|
COMMAND=(sudo -E -u www-data php /var/www/html/occ)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$EUID" = 0 ]]; then
|
if [[ "$EUID" = 0 ]]; then
|
||||||
COMMAND=(sudo -E -u www-data php /var/www/html/occ)
|
COMMAND=(sudo -E -u www-data php /var/www/html/occ)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# Wait until the apache container is ready
|
# Wait until the apache container is ready
|
||||||
while ! nc -z "$APACHE_HOST" "$APACHE_PORT"; do
|
while ! nc -z "$APACHE_HOST" "$APACHE_PORT"; do
|
||||||
echo "Waiting for $APACHE_HOST to become available..."
|
echo "Waiting for $APACHE_HOST to become available..."
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# Set a default value for POSTGRES_PORT
|
# Set a default value for POSTGRES_PORT
|
||||||
if [ -z "$POSTGRES_PORT" ]; then
|
if [ -z "$POSTGRES_PORT" ]; then
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
@@ -53,7 +57,9 @@ if ! [ -f "/dev-dri-group-was-added" ] && [ -n "$(find /dev -maxdepth 1 -mindept
|
|||||||
usermod -aG "$GROUP" www-data
|
usermod -aG "$GROUP" www-data
|
||||||
touch "/dev-dri-group-was-added"
|
touch "/dev-dri-group-was-added"
|
||||||
fi
|
fi
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
|
|
||||||
# Check datadir permissions
|
# Check datadir permissions
|
||||||
sudo -E -u www-data touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null
|
sudo -E -u www-data touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null
|
||||||
@@ -170,6 +176,8 @@ if [ "$THIS_IS_AIO" = "true" ] && [ "$APACHE_PORT" = 443 ]; then
|
|||||||
sed -i "/^listen.allowed_clients/s/,$//" /usr/local/etc/php-fpm.d/www.conf
|
sed -i "/^listen.allowed_clients/s/,$//" /usr/local/etc/php-fpm.d/www.conf
|
||||||
grep listen.allowed_clients /usr/local/etc/php-fpm.d/www.conf
|
grep listen.allowed_clients /usr/local/etc/php-fpm.d/www.conf
|
||||||
fi
|
fi
|
||||||
set +x
|
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ pidfile=/var/run/supervisord/supervisord.pid
|
|||||||
childlogdir=/var/log/supervisord/
|
childlogdir=/var/log/supervisord/
|
||||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||||
logfile_backups=10 ; number of backed up logfiles
|
logfile_backups=10 ; number of backed up logfiles
|
||||||
loglevel=error
|
loglevel=%(ENV_AIO_LOG_LEVEL)s
|
||||||
user=root
|
user=root
|
||||||
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
|
|||||||
Reference in New Issue
Block a user