Skip to content

Commit a6c70d7

Browse files
committed
auto install plugin, add various checks
1 parent aba84fe commit a6c70d7

File tree

8 files changed

+40
-13
lines changed

8 files changed

+40
-13
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ This mod adds a service to start the [notify-push](https://github.com/nextcloud/
88

99
## Setup
1010

11-
1. Download and install the "client-push" (``notify-push``) app from the Nextcloud store.
11+
1. Add ``DOCKER_MODS=linuxserver/mods:nextcloud-notify-push`` to your env.
1212

13-
2. Add ``DOCKER_MODS=linuxserver/mods:nextcloud-notify-push`` to your env.
13+
2. Make sure that Redis is already configured with Nextcloud.
1414

15-
3. notify_push should be running and ``**** Starting notify-push ****`` appear in the log. Also check for errors.
15+
3. [Configure your reverse proxy for notify push.](https://github.com/nextcloud/notify_push#reverse-proxy)
1616

17-
4. [Configure your reverse proxy for notify push.](https://github.com/nextcloud/notify_push#reverse-proxy)
18-
19-
5. run ``occ notify_push:setup https://cloud.example.org/push`` to test and enable notify-push, replace "*cloud.example.org*" with your domain.
17+
4. notify_push should be running and ``**** Starting notify-push ****`` appear in the log. Also check for errors.
2018

2119
### SWAG configuration
2220

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
NOTIFY_PUSH_URL=$(echo "$(occ config:system:get overwrite.cli.url)/push")
5+
echo "**** Setting notify_push server URL to ${NOTIFY_PUSH_URL} ****"
6+
if ! occ notify_push:setup "${NOTIFY_PUSH_URL}"; then
7+
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 ****"
8+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/svc-mod-nextcloud-notify-push-set-url/run
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7867

root/etc/s6-overlay/s6-rc.d/svc-mod-nextcloud-notify-push/run

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,37 @@
22

33
export NEXTCLOUD_URL="https://localhost"
44
export ALLOW_SELF_SIGNED=true
5-
NEXTCLOUD_BASE="/config/www/nextcloud"
6-
NOTIFY_PUSH_BIN="$NEXTCLOUD_BASE/apps/notify_push/bin/$(arch)/notify_push"
5+
export NEXTCLOUD_BASE="/config/www/nextcloud"
6+
export NOTIFY_PUSH_BIN="$NEXTCLOUD_BASE/apps/notify_push/bin/$(arch)/notify_push"
7+
8+
installed_version=$(php -r "require '/config/www/nextcloud/config/config.php'; echo \$CONFIG['version'];" 2>/dev/null)
9+
if [ "${installed_version}" = "" ]; then
10+
echo "**** Nextcloud not installed yet. Please go through the wizard and restart the container. Then notify_push will be enabled. ****"
11+
sleep infinity
12+
fi
13+
# Check redis
14+
if ! occ config:system:get redis >/dev/null; then
15+
echo "**** Redis does not seem to be configued. Notify_push will not start ****"
16+
sleep infinity
17+
fi
18+
19+
echo "**** Making sure the Nextcloud Client Push plugin is installed and enabled ****"
20+
occ app:install notify_push
21+
occ app:enable notify_push
722

823
# Check if notify-push is installed
924
if [ ! -d "$NEXTCLOUD_BASE/apps/notify_push/" ]; then
10-
echo "**** Notify-push folder not found. Install the notify-push/client-push app and restart the container. ****"
11-
sleep infinity
25+
echo "**** Notify-push folder not found. Install the notify-push/client-push app and restart the container. ****"
26+
sleep infinity
1227
fi
1328
# Check cpu arch
1429
if [ ! -f "$NOTIFY_PUSH_BIN" ]; then
15-
echo "**** Did not find a matching notify-push binary for your cpu arch: $(arch) ****"
16-
sleep infinity
30+
echo "**** Did not find a matching notify-push binary for your cpu arch: $(arch) ****"
31+
sleep infinity
1732
fi
1833

1934
# run notify-push binary
2035
echo "**** Starting notify-push ****"
21-
s6-setuidgid abc "$NOTIFY_PUSH_BIN" "$NEXTCLOUD_BASE/config/config.php"
36+
exec \
37+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7867" \
38+
s6-setuidgid abc "$NOTIFY_PUSH_BIN" "$NEXTCLOUD_BASE/config/config.php"

root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-nextcloud-notify-push-set-url

Whitespace-only changes.

0 commit comments

Comments
 (0)