High Performance Backend for Files and Reverse Proxy on seperate Server


The wizard for the nextcloud high performance backend only shows how to do it for single server instances where the nextcloud server / web server / reverse proxy and push daemon are on the same server. It otherwise points to GitHub - nextcloud/notify_push: Update notifications for nextcloud clients.

In my setup the nginx reverse proxy is on it’s own server. I’m confused as to how to setup the high performance backend for this type of setup.

I’m mostly confused as to where to place this nginx code block?

Nginx

If you’re using nginx, add the following location block the the existing server block of the nextcloud server.

location /push/ {
proxy_pass http://127.0.0.1:7867/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Is the proper place on the nginx reverse proxy or on the nginx web server on my nextcloud server? Or both?

Perhaps, on the reverse proxy do this?
location / {
set $upstream_app ip_address_of_nc_server;
set $upstream_port 7867;

Thanks in advance!

I would say: you have one webserver up and running, and the new notify_push_service on the Nextcloud Server. So on the existing webserver you forward to the push_service. In your case the IP is then not 127.0.0.1 but the right IP from your existing Nextcloud server.

wagnbeu0, sorry I don’t quite understand what you’re saying. Can you please try again with additional detail. Thank you.

I have 2 nginx web servers running. One on the nextcloud server and another on the reverse proxy. They are two separate physical servers.

I would try the following:

On the Reverse Proxy Webserver

location /push/ {
proxy_pass http://IP_of_NC Webserver:7867/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

On the Nextcloud Webserver:
location /push/ {
proxy_pass http://127.0.0.1:7867/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Typically on the NC webserver the /push should not be needed because the incoming traffic for the nextcloud /push folder will be redirected to the running service. What looks your revery proxy like like?

Ufw, opened port 7867 on nc server. Also did a port scan and port is open and accessible from other hosts nc -zv 192.168.XXX.XX 7867 Connection to 192.168.XXX.XX 7867 port [tcp/*] succeeded!.

Then tried your suggested code blocks. Tested with Talk and User not receiving any notifications.

So, i changed the lines, there was a ip-entry which was marked out …
On the reverse proxy you forward to the NC server with its IP, and on the NC server to local IP. Can you try it?

I tried it with the line you changed. Yes, I noticed you omitted the ip of the nc server so I added it appropriately. Users still not receiving notifications.

which notification re you expecting?

When user 1 starts a conversation with user 2, user 2 should receive a notification. When user 1 sends a chat message to user 2 or vise versa, each user should receive a notification. When user 1 mentions user 2 or vice versa, they should receive notifications.

Are you using the android app?

Android app, IOS app and logged in on browser. No notifications on any device.

Afaik, the android and ios apps don’t use the high performance backend. They are using a different system for push notifications. But why it doesn’t work in your browser is a riddle. Sounds like something is misconfigured on your server to me.

That’s entirely possible, but all tests passed:

sudo -u www-data php occ notify_push:self-test
✓ redis is configured
✓ push server is receiving redis messages
✓ push server can load mount info from database
✓ push server can connect to the Nextcloud server
✓ push server is a trusted proxy
✓ push server is running the same version as the app

Yes, I believe you are correct that the mobile apps don’t use the notify push service. I had rec’d notifications prior to NC 21 and setting up the notify push service. All notifications broke upon NC 21 with notify push

I guess in this case you should report this on github to make sure that the testrun gets improved.

I have, but sadly the dev has been mostly unresponsive

Would you be able to link the issue so that it doesn’t get lost?

I didn’t link it to this post. This is the link to gibhub Setup successfullly, but users not receiving notifications · Issue #50 · nextcloud/notify_push · GitHub

1 Like

I think i have a similar problem too.

First my config
NC Server on cloudserver
ubuntu 20.04.2
PHP 8.0.3
PostgreSQL 13.2
Nginx 1.19.x

Reverse Proxy on RevProxy
RaspberryPi4 with ubuntu server 20.04.2
nginx 1.18.x

In RevProxy i entered the following lines to my /etc/nginx/conf.d/cloud.conf

location /push/ {
        proxy_pass http://$upstream:7867/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

set $upstream LOCAL-IP-OF-MY-NC-SERVER

In my /etc/nginx/conf.d/nextcloud.conf on my NC-Server i entered the following lines

location /push/ {
proxy_pass https://127.0.0.1:7867/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

I followed this instructure

But when enabling the service i got this error
(systemctl restart notify_push, systemctl status notify_push)

notify_push.service - Push daemon for Nextcloud clients
Loaded: loaded (/etc/systemd/system/notify_push.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-04-10 11:56:39 CEST; 11min ago
Process: 39178 ExecStart=/var/www/nextcloud/apps/notify_push/bin/x86_64/notify_push /var/www/nextcloud/config/config.php (code=exited, status=1/FAILURE)
Main PID: 39178 (code=exited, status=1/FAILURE)

Apr 10 11:56:39 cloud notify_push[39178]: 0: Failed to connect to Nextcloud database
Apr 10 11:56:39 cloud notify_push[39178]: 1: error occurred while attempting to establish a TLS connection: InvalidDNSNameError
Apr 10 11:56:39 cloud notify_push[39178]: 2: InvalidDNSNameError
Apr 10 11:56:39 cloud notify_push[39178]: Location:
Apr 10 11:56:39 cloud notify_push[39178]: /tmp/krankerl.CxmLAzrEoja5/notify_push/src/storage_mapping.rs:57
Apr 10 11:56:39 cloud notify_push[39178]: Backtrace omitted.
Apr 10 11:56:39 cloud notify_push[39178]: Run with RUST_BACKTRACE=1 environment variable to display it.
Apr 10 11:56:39 cloud notify_push[39178]: Run with RUST_BACKTRACE=full to include source snippets.
Apr 10 11:56:39 cloud systemd[1]: notify_push.service: Main process exited, code=exited, status=1/FAILURE
Apr 10 11:56:39 cloud systemd[1]: notify_push.service: Failed with result ‘exit-code’.

Does anybody knows what the error message

1: error occurred while attempting to establish a TLS connection: InvalidDNSNameError

and

2: InvalidDNSNameError

mean?

My /etc/systemd/system/notify_push.service looks like

[Unit]
Description = Push daemon for Nextcloud clients

[Service]
Environment = PORT=7867 # Change if you already have something running on this port
ExecStart = /var/www/nextcloud/apps/notify_push/bin/x86_64/notify_push /var/www/nextcloud/config/config.php
User=www-data

[Install]
WantedBy = multi-user.target

So in fact that i got errors with starting the service i got errors by activating the url

command sudo -u www-data php /var/www/nextcloud/occ notify_push:self-test

responsed with
🗴 no push server configured

What to do?

Update: I have to append that i have a working https://NC-Server config running secured by Let’s Encrypt Certificates (rsa and ecc)
And Port 7876 is not in use by another service as far i have checked.