Merge pull request #3427 from nextcloud/enh/noid/adjust-limiting

This commit is contained in:
Simon L 2023-10-02 15:12:51 +02:00 committed by GitHub
commit 14266469c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 5 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash
nc -z "$NEXTCLOUD_HOST" 9000 || exit 0
nc -z "$NEXTCLOUD_HOST" 9001 || exit 0
nc -z localhost 2375 || exit 1

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Only start container if nextcloud is accessible
while ! nc -z "$NEXTCLOUD_HOST" 9000; do
while ! nc -z "$NEXTCLOUD_HOST" 9001; do
echo "Waiting for Nextcloud to start..."
sleep 5
done

View file

@ -131,4 +131,17 @@ if ! sudo -E -u www-data bash /entrypoint.sh; then
exit 1
fi
while [ -z "$(dig nextcloud-aio-apache A +short)" ]; do
echo "Waiting for nextcloud-aio-apache to start..."
sleep 5
done
IPv4_ADDRESS_APACHE="$(dig nextcloud-aio-apache A +short | grep '^[0-9.]\+$' | sort | head -n1)"
IPv6_ADDRESS_APACHE="$(dig nextcloud-aio-apache AAAA +short | grep '^[0-9a-f:]\+$' | sort | head -n1)"
IPv4_ADDRESS_MASTERCONTAINER="$(dig nextcloud-aio-mastercontainer A +short | grep '^[0-9.]\+$' | sort | head -n1)"
IPv6_ADDRESS_MASTERCONTAINER="$(dig nextcloud-aio-mastercontainer AAAA +short | grep '^[0-9a-f:]\+$' | sort | head -n1)"
sed -i "s|^;listen.allowed_clients|listen.allowed_clients|" /usr/local/etc/php-fpm.d/www.conf
sed -i "s|listen.allowed_clients.*|listen.allowed_clients = 127.0.0.1,::1,$IPv4_ADDRESS_APACHE,$IPv6_ADDRESS_APACHE,$IPv4_ADDRESS_MASTERCONTAINER,$IPv6_ADDRESS_MASTERCONTAINER|" /usr/local/etc/php-fpm.d/www.conf
grep listen.allowed_clients /usr/local/etc/php-fpm.d/www.conf
exec "$@"

View file

@ -32,3 +32,12 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/run-exec-commands.sh
user=www-data
# This is a hack but no better solution is there
[program:is-nextcloud-online]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=nc -lk 9001
user=www-data

View file

@ -1,6 +1,6 @@
#!/bin/bash
if ! nc -z "$NEXTCLOUD_HOST" 9000; then
if ! nc -z "$NEXTCLOUD_HOST" 9001; then
exit 0
fi

View file

@ -12,7 +12,7 @@ elif [ -z "$REDIS_HOST" ]; then
fi
# Only start container if nextcloud is accessible
while ! nc -z "$NEXTCLOUD_HOST" 9000; do
while ! nc -z "$NEXTCLOUD_HOST" 9001; do
echo "Waiting for Nextcloud to start..."
sleep 5
done

View file

@ -130,7 +130,8 @@
"image": "nextcloud/aio-nextcloud",
"init": true,
"expose": [
"9000"
"9000",
"9001"
],
"internal_port": "9000",
"secrets": [