Compare commits

..

2 Commits

Author SHA1 Message Date
coolnsx
8ca1d21f51 Fix: nextcloud notify script issues 2025-09-17 16:22:20 +05:30
coolnsx
269f944dd2 Pro Tip: Read Copilot output before pushing it 2025-09-17 14:14:49 +05:30
5 changed files with 75 additions and 22 deletions

View File

@@ -4,3 +4,5 @@ MARIADB_DATABASE=nextcloud
MARIADB_USER=nextcloud
TZ=Asia/Kolkata
EXTERNAL_DIR=/media/vault/nextcloud
SOCKET_PATH=/tmp/docker/notify_push.sock
NEXTCLOUD_URL=https://cloud.example.com

View File

@@ -0,0 +1,38 @@
#!/bin/sh
NC_PATH="/var/www/html"
CONFIG="$NC_PATH/config/config.php"
NOTIFY_BIN="$NC_PATH/apps/notify_push/bin/x86_64/notify_push"
SOCKET_PATH="${SOCKET_PATH:-/tmp/docker/notify_push.sock}"
# Clean shutdown handler
cleanup() {
echo "[*] Stopping notify_push..."
kill -TERM "$NOTIFY_PID" 2>/dev/null && echo "[*] notify push stopped.." || echo "Unable to Kill Notify Push.."
echo "[*] Bye"
}
trap 'cleanup' TERM INT
echo "[*] Ensuring notify_push app is installed and enabled..."
php occ app:install notify_push || true
php occ app:enable notify_push || true
echo "[*] Starting notify_push binary..."
"$NOTIFY_BIN" "$CONFIG" &
NOTIFY_PID=$!
# Wait for the socket to appear, max 30 seconds
i=0
while [ $i -lt 6 ]; do
echo "[*] Waiting 5 seconds for notify_push to be ready... (try $i/6)"
sleep 5
if [ -S "$SOCKET_PATH" ]; then
echo "[*] Socket found, running occ notify_push:setup"
php occ notify_push:setup "${NEXTCLOUD_URL}/push" || true
break
fi
: $((i += 1))
done
# Keep container alive while notify_push runs
wait

View File

@@ -1,17 +0,0 @@
[Unit]
Description=Push daemon for Nextcloud clients
Documentation=https://github.com/nextcloud/notify_push
Requires=nextcloud.service
After=nextcloud.service
PartOf=nextcloud.service
[Service]
Type=simple
ExecStart=/usr/bin/podman exec -u 1000 nextcloud \
/var/www/html/apps/notify_push/bin/x86_64/notify_push \
/var/www/html/config/config.php
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target

View File

@@ -28,13 +28,9 @@ Environment=PHP_MEMORY_LIMIT=2G
Environment=PHP_UPLOAD_LIMIT=100G
Environment=PHP_OPCACHE_MEMORY_CONSUMPTION=256
# Nextcloud Notify Push socket
Environment=SOCKET_PATH=/tmp/docker/notify_push.sock
Volume=%h/podman/nextcloud/html:/var/www/html
Volume=%h/nextcloud:/var/www/html/data
Volume=%h/.config/containers/systemd/nextcloud/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf
Volume=./zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf
Volume=${EXTERNAL_DIR}:${EXTERNAL_DIR}
[Service]

View File

@@ -0,0 +1,34 @@
[Unit]
Description=Nextcloud Notify Push Container
Requires=nextcloud_db.service nextcloud_valkey.service nextcloud.service
After=nextcloud_db.service nextcloud_valkey.service nextcloud.service
[Container]
Pod=nextcloud.pod
ContainerName=nextcloud_push
Image=docker.io/library/nextcloud:fpm-alpine
Entrypoint=/nextcloud-notify-push-entrypoint.sh
User=1000
Group=1000
# Enable auto-update container
AutoUpdate=registry
Environment=TZ=${TZ}
# Nextcloud Notify Push socket
Environment=SOCKET_PATH=${SOCKET_PATH}
Environment=NEXTCLOUD_URL=${NEXTCLOUD_URL}
Volume=%h/podman/nextcloud/html:/var/www/html
Volume=./nextcloud-notify-push-entrypoint.sh:/nextcloud-notify-push-entrypoint.sh
Volume=%h/nextcloud:/var/www/html/data
[Service]
# pass this to autofill above variables
EnvironmentFile=%h/.config/containers/systemd/nextcloud/.env
Restart=always
TimeoutStartSec=300
[Install]
WantedBy=default.target