From 64ce8b053420e48c629367ee825f2c84e4db22e0 Mon Sep 17 00:00:00 2001 From: Saswat Padhi Date: Sun, 19 Nov 2023 13:35:47 +0000 Subject: [PATCH] notify_push (HPB) for nextcloud --- nextcloud/docker-compose.labels.yml | 10 ++++++++ nextcloud/docker-compose.yml | 38 ++++++++++++++++++++++++++++- nextcloud/env/nextcloud | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/nextcloud/docker-compose.labels.yml b/nextcloud/docker-compose.labels.yml index 1e9016f..36b267e 100644 --- a/nextcloud/docker-compose.labels.yml +++ b/nextcloud/docker-compose.labels.yml @@ -4,6 +4,7 @@ services: nextcloud: labels: traefik.enable: true + traefik.http.routers.push.priority: 1 traefik.http.middlewares.strip-nextcloud-prefix.stripPrefix.prefixes: "/nextcloud" traefik.http.middlewares.nextcloud-caldav-redirect.redirectRegex.permanent: true traefik.http.middlewares.nextcloud-caldav-redirect.redirectRegex.regex: "^https://(.+)/nextcloud/.well-known/(card|cal)dav" @@ -12,3 +13,12 @@ services: traefik.http.routers.nextcloud.entryPoints: wan-https # NOTE: Order of middlewares matters: redirect must be performed before stripping traefik.http.routers.nextcloud.middlewares: nextcloud-caldav-redirect@docker,strip-nextcloud-prefix + push: + labels: + traefik.enable: true + traefik.http.routers.push.priority: 2 + traefik.http.services.push.loadBalancer.server.port: 7867 + traefik.http.middlewares.strip-push-prefix.stripPrefix.prefixes: "/push" + traefik.http.routers.push.rule: PathPrefix(`/nextcloud/push`) + traefik.http.routers.push.entryPoints: wan-https + traefik.http.routers.push.middlewares: strip-push-prefix diff --git a/nextcloud/docker-compose.yml b/nextcloud/docker-compose.yml index d7aeaef..e9ed5a9 100644 --- a/nextcloud/docker-compose.yml +++ b/nextcloud/docker-compose.yml @@ -100,6 +100,7 @@ services: - env/nextcloud environment: TZ: ${TZ:?} + NEXTCLOUD_TRUSTED_DOMAINS: ${SERVER_WAN_FQDN:?} ${SERVER_LAN_FQDN:?} nextcloud healthcheck: test: "curl -fso /dev/null http://localhost:80" @@ -107,6 +108,42 @@ services: timeout: 3s start_period: 15s + push: + hostname: push + image: padhihomelab/nextcloud:27.1.3_19.24.2_1.1.0 + restart: unless-stopped + + security_opt: + - no-new-privileges:true + user: ${USER_ID:?} + + entrypoint: |- + /var/www/html/custom_apps/notify_push/bin/x86_64/notify_push /var/www/html/config/config.php + + depends_on: + - nextcloud + + networks: + - default + - proxy + volumes_from: + - nextcloud:rw + + env_file: + - env/mariadb + - env/redis + - env/nextcloud + environment: + TZ: ${TZ:?} + PORT: 7867 + NEXTCLOUD_URL: http://nextcloud/ + + healthcheck: + test: "pgrep notify_push" + interval: 15s + timeout: 3s + start_period: 5s + cron: hostname: cron image: padhihomelab/nextcloud:27.1.3_19.24.2_1.1.0 @@ -118,7 +155,6 @@ services: #NOTE: `crond` needs to run as `root` user. depends_on: - - redis - nextcloud networks: diff --git a/nextcloud/env/nextcloud b/nextcloud/env/nextcloud index 5722781..2f0df6b 100644 --- a/nextcloud/env/nextcloud +++ b/nextcloud/env/nextcloud @@ -6,3 +6,4 @@ OVERWRITEWEBROOT: '/nextcloud' # FIXME: See https://github.com/nextcloud/docker/issues/1494 #APACHE_DISABLE_REWRITE_IP: 1 NEXTCLOUD_DATA_DIR: '/data' +TRUSTED_PROXIES: 172.33.0.0/16 172.22.0.0/16