2023-08-24 22:24:47 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-08-24 22:46:35 +08:00
|
|
|
# Only start container if nextcloud is accessible
|
|
|
|
while ! nc -z "$NEXTCLOUD_HOST" 9000; do
|
|
|
|
echo "Waiting for Nextcloud to start..."
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
|
2023-08-24 22:24:47 +08:00
|
|
|
set -x
|
|
|
|
IPv4_ADDRESS_NC="$(dig nextcloud-aio-nextcloud IN A +short | grep '^[0-9.]\+$' | sort | head -n1)"
|
|
|
|
sed -i "s|NC_IPV4_PLACEHOLDER|$IPv4_ADDRESS_NC|g"
|
2023-08-25 03:02:49 +08:00
|
|
|
sed -i "s# || { src NC_IPV4_PLACEHOLDER }##g" /conf/haproxy.cfg
|
2023-08-24 22:24:47 +08:00
|
|
|
|
|
|
|
IPv6_ADDRESS_NC="$(dig nextcloud-aio-nextcloud AAAA +short | grep '^[0-9a-f:]\+$' | sort | head -n1)"
|
|
|
|
sed -i "s|NC_IPV6_PLACEHOLDER|$IPv6_ADDRESS_NC|g"
|
2023-08-25 03:02:49 +08:00
|
|
|
sed -i "s# || { src NC_IPV6_PLACEHOLDER }##g" /conf/haproxy.cfg
|
2023-08-24 22:24:47 +08:00
|
|
|
set +x
|
|
|
|
|
2023-08-25 03:02:49 +08:00
|
|
|
haproxy -f /conf/haproxy.cfg -db
|