Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust limiting the php-fpm port to specific containers again #3427

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Containers/docker-socket-proxy/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Containers/docker-socket-proxy/start.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 13 additions & 0 deletions Containers/nextcloud/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
9 changes: 9 additions & 0 deletions Containers/nextcloud/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Containers/notify-push/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if ! nc -z "$NEXTCLOUD_HOST" 9000; then
if ! nc -z "$NEXTCLOUD_HOST" 9001; then
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion Containers/notify-push/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion php/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
"image": "nextcloud/aio-nextcloud",
"init": true,
"expose": [
"9000"
"9000",
"9001"
],
"internal_port": "9000",
"secrets": [
Expand Down
Loading