notify_push icon indicating copy to clipboard operation
notify_push copied to clipboard

How do I verify that the desktop client is using the new client push capabilities?

Open despens opened this issue 3 years ago • 17 comments

After installing the push capabilities, it would be good to have instructions how to verify that the nextcloud desktop client is indeed using the new client push mechanism.

despens avatar Mar 08 '21 16:03 despens

I agree that sth. like a connection type icon would be great, but this is an issue which I guess would be better placed at https://github.com/nextcloud/desktop

What I did to verify a successful push connection:

  1. Load the metrics page, start the client and reload the metrics page. If your client is connected via push, the connection count increases.

  2. The other method is to start the client, go to your NC webinterface and upload a file. Right after upload your client should start the sync process without nearly any delay when it's connected via push. Although there might be a chance that the polling would have been triggered at same time. So maybe double check this :smile:

s644 avatar Mar 09 '21 17:03 s644

I used another possibility to at least check that the server sends something:

  1. Start the server with LOG=notify_push=trace and observe the log; in my case the server was started via systemd and I used journalctl -f --unit=notify_push

Now it would be helpful to have a simple possibility to check if the client (browser login) and/or nextcloud app on android gets / uses the messages ...

Edit: a notification would also helpful in the android app

syntron avatar Mar 09 '21 18:03 syntron

I agree that sth. like a connection type icon would be great, but this is an issue which I guess would be better placed at https://github.com/nextcloud/desktop

What I did to verify a successful push connection:

1. Load the metrics page, start the client and reload the metrics page. If your client is connected via push, the connection count increases.

2. The other method is to start the client, go to your NC webinterface and upload a file. Right after upload your client should start the sync process without nearly any delay when it's connected via push. Although there might be a chance that the polling would have been triggered at same time. So maybe double check this 😄

What is the metrics page?

whisperdancer avatar Mar 10 '21 04:03 whisperdancer

It is a website with some stats.

https://github.com/nextcloud/notify_push#metrics

s644 avatar Mar 10 '21 07:03 s644

Yes, I see that, but unsure how to set it up. If you have the time to provide detailed instructions on how you did it I would greatly appreciate it. Thanks!

whisperdancer avatar Mar 11 '21 00:03 whisperdancer

The easiest way from an admin's perspective would have the nextcloud app display the monitoring information instead of this being handled by a separate server.

despens avatar Mar 11 '21 06:03 despens

Yes, I see that, but unsure how to set it up. If you have the time to provide detailed instructions on how you did it I would greatly appreciate it. Thanks!

You have to add METRICS_PORT to your service configuration, e.g.:

[Unit]
Description = Push daemon for Nextcloud clients

[Service]
Environment = PORT=7867 METRICS_PORT=7868
ExecStart = /path/to/push/binary/notify_push /path/to/nextcloud/config/config.php
User=www-data

[Install]
WantedBy = multi-user.target

Restart your service and you should be able to see some stats at <your_nc_domain>:7868/metrics

s644 avatar Mar 11 '21 11:03 s644

Yes, I see that, but unsure how to set it up. If you have the time to provide detailed instructions on how you did it I would greatly appreciate it. Thanks!

You have to add METRICS_PORT to your service configuration, e.g.:

[Unit]
Description = Push daemon for Nextcloud clients

[Service]
Environment = PORT=7867 METRICS_PORT=7868
ExecStart = /path/to/push/binary/notify_push /path/to/nextcloud/config/config.php
User=www-data

[Install]
WantedBy = multi-user.target

Restart your service and you should be able to see some stats at <your_nc_domain>:7868/metrics

Thank you for this! Appreciate it.

Thanks!

whisperdancer avatar Mar 11 '21 16:03 whisperdancer

Yes, I see that, but unsure how to set it up. If you have the time to provide detailed instructions on how you did it I would greatly appreciate it. Thanks!

You have to add METRICS_PORT to your service configuration, e.g.:

[Unit]
Description = Push daemon for Nextcloud clients

[Service]
Environment = PORT=7867 METRICS_PORT=7868
ExecStart = /path/to/push/binary/notify_push /path/to/nextcloud/config/config.php
User=www-data

[Install]
WantedBy = multi-user.target

Restart your service and you should be able to see some stats at <your_nc_domain>:7868/metrics

I tried this and page times out. Perhaps that's why the notify_push service is not working. I thought maybe it's the port so opened it sudo ufw allow 7868/tcp. Tried again, but page times out. My nc server sits behind a reverse proxy so perhaps that's the issue. I surmise I may have to add a location block to the reverse proxy, but unsure what the correct block would be.

whisperdancer avatar Mar 12 '21 00:03 whisperdancer

You can on the server itself run e.g. curl http://localhost:7868/metrics which should return those stats without having to proxy them...

szaimen avatar Mar 12 '21 00:03 szaimen

You can on the server itself run e.g. curl http://localhost:7868/metrics which should return those stats without having to proxy them...

Thanks. That works and output this:

active_connection_count 0 total_connection_count 0 mapping_query_count 6 event_count_total 240 message_count_total 0

This certainly confirms why it's not working. No active connections.

whisperdancer avatar Mar 12 '21 00:03 whisperdancer

I tried a few things. Added this location block to my reverse proxy:

location /push/ { proxy_pass http://192.xxx.xxx.xx: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; }

Then opened the port on the nc server sudo ufw allow 7867/tcp

restarted the service sudo service notify_push restart

checked again and looking better:

curl http://localhost:7868/metrics
active_connection_count 3
total_connection_count 3
mapping_query_count 1
event_count_total 4
message_count_total 0

Though running the test_client still results in this output: Error: 0: capabilities response doesn't contain expect items, credentials are probably invalid

whisperdancer avatar Mar 12 '21 00:03 whisperdancer

Quoting per s644 comment above: What I did to verify a successful push connection: Load the metrics page, start the client and reload the metrics page. If your client is connected via push, the connection count increases.

I checked metrics and had active_connection_count 3

Then logged in with new user on a different browser, then checked again and: active_connection_count 4

Logged off the new user and tested again and dropped back to 3 active_connection_count 3

self test fine:

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

So all tests pass. Everything appears to be working. I see the connections. Yet...

Then did a test with the 2 users using Talk. Neither receives notifications when sending chat messages to one another. Both using browsers, not mobile.

whisperdancer avatar Mar 12 '21 00:03 whisperdancer

I set log level to debug: occ notify_push:log debug then, share files and initiate Talk chats. Checked log with sudo journalctl -eu notify_push

The log appears to show it's working, but users continue to not receive notifications. Is anyone else having this issue where the setup appears to be good, yet users not receiving notifications?

whisperdancer avatar Mar 13 '21 17:03 whisperdancer

Did you try any other notification than talk notifications? Maybe it is an issue with the talk app if all other work...

szaimen avatar Mar 13 '21 17:03 szaimen

Did you try any other notification than talk notifications? Maybe it is an issue with the talk app if all other work...

Yes, also with file share. And once again, seeing log activity, but no notifications.

whisperdancer avatar Mar 13 '21 18:03 whisperdancer

This may be a larger issue as I noticed a new issue $62 opened up. It appears the same issue happening with landryb, who has done extensive testing on setup.

whisperdancer avatar Mar 13 '21 18:03 whisperdancer