auto install plugin, add various checks

This commit is contained in:
aptalca
2024-03-26 11:08:27 -04:00
parent aba84fe07c
commit a6c70d706e
8 changed files with 40 additions and 13 deletions
+4 -6
View File
@@ -8,15 +8,13 @@ This mod adds a service to start the [notify-push](https://github.com/nextcloud/
## Setup
1. Download and install the "client-push" (``notify-push``) app from the Nextcloud store.
1. Add ``DOCKER_MODS=linuxserver/mods:nextcloud-notify-push`` to your env.
2. Add ``DOCKER_MODS=linuxserver/mods:nextcloud-notify-push`` to your env.
2. Make sure that Redis is already configured with Nextcloud.
3. notify_push should be running and ``**** Starting notify-push ****`` appear in the log. Also check for errors.
3. [Configure your reverse proxy for notify push.](https://github.com/nextcloud/notify_push#reverse-proxy)
4. [Configure your reverse proxy for notify push.](https://github.com/nextcloud/notify_push#reverse-proxy)
5. run ``occ notify_push:setup https://cloud.example.org/push`` to test and enable notify-push, replace "*cloud.example.org*" with your domain.
4. notify_push should be running and ``**** Starting notify-push ****`` appear in the log. Also check for errors.
### SWAG configuration
@@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
NOTIFY_PUSH_URL=$(echo "$(occ config:system:get overwrite.cli.url)/push")
echo "**** Setting notify_push server URL to ${NOTIFY_PUSH_URL} ****"
if ! occ notify_push:setup "${NOTIFY_PUSH_URL}"; then
echo "**** There was an error setting the notify_push server URL. Please double check your reverse proxy settings as well as the overwrite.cli.url entry in Nextcloud's config.php ****"
fi
@@ -0,0 +1 @@
oneshot
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-mod-nextcloud-notify-push-set-url/run
@@ -2,20 +2,37 @@
export NEXTCLOUD_URL="https://localhost"
export ALLOW_SELF_SIGNED=true
NEXTCLOUD_BASE="/config/www/nextcloud"
NOTIFY_PUSH_BIN="$NEXTCLOUD_BASE/apps/notify_push/bin/$(arch)/notify_push"
export NEXTCLOUD_BASE="/config/www/nextcloud"
export NOTIFY_PUSH_BIN="$NEXTCLOUD_BASE/apps/notify_push/bin/$(arch)/notify_push"
installed_version=$(php -r "require '/config/www/nextcloud/config/config.php'; echo \$CONFIG['version'];" 2>/dev/null)
if [ "${installed_version}" = "" ]; then
echo "**** Nextcloud not installed yet. Please go through the wizard and restart the container. Then notify_push will be enabled. ****"
sleep infinity
fi
# Check redis
if ! occ config:system:get redis >/dev/null; then
echo "**** Redis does not seem to be configued. Notify_push will not start ****"
sleep infinity
fi
echo "**** Making sure the Nextcloud Client Push plugin is installed and enabled ****"
occ app:install notify_push
occ app:enable notify_push
# Check if notify-push is installed
if [ ! -d "$NEXTCLOUD_BASE/apps/notify_push/" ]; then
echo "**** Notify-push folder not found. Install the notify-push/client-push app and restart the container. ****"
sleep infinity
echo "**** Notify-push folder not found. Install the notify-push/client-push app and restart the container. ****"
sleep infinity
fi
# Check cpu arch
if [ ! -f "$NOTIFY_PUSH_BIN" ]; then
echo "**** Did not find a matching notify-push binary for your cpu arch: $(arch) ****"
sleep infinity
echo "**** Did not find a matching notify-push binary for your cpu arch: $(arch) ****"
sleep infinity
fi
# run notify-push binary
echo "**** Starting notify-push ****"
s6-setuidgid abc "$NOTIFY_PUSH_BIN" "$NEXTCLOUD_BASE/config/config.php"
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7867" \
s6-setuidgid abc "$NOTIFY_PUSH_BIN" "$NEXTCLOUD_BASE/config/config.php"