feat: updated logic in nextcloud push entrypoint file to check socket via curl

This commit is contained in:
coolnsx
2025-10-02 14:10:13 +05:30
parent 87d43313cd
commit 412d29f6ee
2 changed files with 18 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ set -eu
TARGET_UID="${PUID:-1000}" TARGET_UID="${PUID:-1000}"
# Overwrite /usr/local/etc/php-fpm.d/zz-docker.conf to make php-fpm listen on unix socket # Overwrite /usr/local/etc/php-fpm.d/zz-docker.conf to make php-fpm listen on unix socket
cat << EOF > /usr/local/etc/php-fpm.d/zz-docker.conf cat <<EOF >/usr/local/etc/php-fpm.d/zz-docker.conf
; Generated by /nextcloud-entrypoint.sh ; Generated by /nextcloud-entrypoint.sh
; DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN !! ; DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN !!
; please make changes in the /nextcloud-entrypoint.sh script ; please make changes in the /nextcloud-entrypoint.sh script

View File

@@ -14,6 +14,11 @@ cleanup() {
} }
trap 'cleanup' TERM INT trap 'cleanup' TERM INT
while ! curl -s --fail --max-time 15 "$NEXTCLOUD_URL/status.php" >/dev/null; do
echo "[*] Waiting for Nextcloud to start..."
sleep 5
done
echo "[*] Ensuring notify_push app is installed and enabled..." echo "[*] Ensuring notify_push app is installed and enabled..."
php occ app:install notify_push || true php occ app:install notify_push || true
php occ app:enable notify_push || true php occ app:enable notify_push || true
@@ -22,16 +27,22 @@ echo "[*] Starting notify_push binary..."
/var/www/html/custom_apps/notify_push/bin/x86_64/notify_push & /var/www/html/custom_apps/notify_push/bin/x86_64/notify_push &
NOTIFY_PID=$! NOTIFY_PID=$!
# Wait for the socket to appear, max 30 seconds # Wait for the socket to active and respond, max 30 seconds
i=1 i=1
while [ $i -le 6 ]; do while [ $i -le 6 ]; do
echo "[*] Waiting 5 seconds for notify_push to be ready... (try $i/6)"
sleep 5
if [ -S "$SOCKET_PATH" ]; then if [ -S "$SOCKET_PATH" ]; then
echo "[*] Socket found, running occ notify_push:setup" echo "[*] Socket file exists, testing HTTP response..."
if curl -s --max-time 5 --unix-socket "$SOCKET_PATH" http://localhost/ -o /dev/null; then
echo "[*] notify_push is ready, running occ notify_push:setup"
php occ notify_push:setup "${NEXTCLOUD_URL}/push" || true php occ notify_push:setup "${NEXTCLOUD_URL}/push" || true
break break
else
echo "[!] Socket exists, but no HTTP response yet"
fi fi
fi
echo "[*] Waiting 5 seconds for notify_push to be ready... (try $i/6)"
sleep 5
: $((i += 1)) : $((i += 1))
done done