Uptime kuma - post-install?

Hi all,

My YunoHost server

Hardware: laptop or computer
YunoHost version:
- yunohost version: 11.2.5 (stable)
- yunohost-admin version: 11.2.3 (stable)
- moulinette version: 11.2 (stable)
- ssowat version: 11.2 (stable)

I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I just installed uptime-kuma (via the public catalag, I still like to browse the apps there and then just press the install button and enter my server, and there it goes :slight_smile: )

Installation did not give any error, but the kuma stays down. It says:

Cannot connect to the socket server. [Error: websocket error] Reconnecting…
Using a Reverse Proxy? Check how to config it for WebSocket

The app page in the web admin says:

Uptime Kuma uptime-kuma

Installed version: 1.23.9~ynh1

Admin doc

  • node_modules folder is backed up and shouldn’t be (600Mo…)
  • This app needs a manual post-install
  • We could pre-configure mail notifications with YunoHost mail server as an improvement. See comments in file to try to do it with Curl and WebSockets or Sqlite.

I don’t know which post-install is needed.

Checking uptime kuma’s Git pages, there is mention of an Nginx configuration.

Browsing /etc/nginx/conf.d/ for the domain / app, there are some configurations, one mentions the proxy that’s on the Git page.

uptime-kuma.conf

#sub_path_only rewrite ^/$ / permanent;
location / {

    proxy_pass http://127.0.0.1:12716;
    # https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy#nginx
    # proxy_set_header   X-Real-IP $remote_addr;
    # proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
    
    # Common parameter to increase upload size limit
    #client_max_body_size 50M;

    # Include SSOWAT user panel.
    include conf.d/yunohost_panel.conf.inc;
}

but I have no idea whether I should change something here, and if so, what.

Did anyone succeed?

PS: I installed uptime-kuma in its own (sub)domain, as mentioned on Github, not in a directory. The app admin page does allow to move the installation to a directory though.
PPS: I usually run diagnosis to get the current version of YNH etc when starting a thread, but because it takes some time to complete the whole diagnosis, I tend to forget to go back to it. Do the values get cached somewhere (other than on the forum :stuck_out_tongue: )?

// edit: create and add tag ‘uptime-kuma’ (pressing the ‘forum’-button on the management page gave a 404 in the forum, see if it works now…)

/// edit: in addition to uncommenting the two lines mentioned by @gildas, I also had to add the line
proxy_set_header Host $host; in the same file

Ok, sorry, that was too easy

# yunohost diagnosis show basesystem

You can edit the nginx configuration file (/etc/nginx/conf.d/<YOUR_DOMAIN>/uptime-kuma.conf) and uncomment these lines :

proxy_set_header   X-Real-IP $remote_addr;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

Then check the nginx configuration with nginx -t and reload nginx if everything is ok : systemctl reload nginx.

EDIT : Pull request created to fix the app (Fix : Websocket issue after install (see #92) by Gildas-GH · Pull Request #96 · YunoHost-Apps/uptime-kuma_ynh · GitHub)

1 Like

Hi Gildas,

Thank you for the suggestion!

Is that all? Only uncommenting, testing and restarting?

I did, but the error persists.

image

The link leads to the Github wiki for UK, where it has 3 conf examples for nginx. All three of these have

        proxy_pass         http://localhost:3001;

but the configuration on my Yunohost does not have that line.

Another difference between ‘our’ config and those on the wiki, is that we only have a location / block, where the wiki examples have a server block with proxy_set_header-options.

In the directory above there is another config file related to this domain, that has the server blocks, but that also does not have the line with localhost:3001 ; these are the two config files related to UK:

/etc/nginx/conf.d$ ls uptime.domain.tld.*
uptime.domain.tld.conf

uptime.domain.tld.d:
uptime-kuma.conf

When I visit the UK page, these lines are appended to /var/log/nginx/uptime.domain.tld-error.log :


2023/12/13 20:03:26 [error] 583176#583176: *594 open() "/usr/share/nginx/html/ynh_portal.js" failed (2: No such file or directory), client: 172.26.1.1, server: uptime.domain.tld, request: "GET /ynh_portal.js HTTP/2.0", host: "uptime.domain.tld", referrer: "https://uptime.domain.tld/dashboard"
2023/12/13 20:03:26 [error] 583176#583176: *594 open() "/usr/share/nginx/html/ynh_overlay.css" failed (2: No such file or directory), client: 172.26.1.1, server: uptime.domain.tld, request: "GET /ynh_overlay.css HTTP/2.0", host: "uptime.domain.tld", referrer: "https://uptime.domain.tld/dashboard"
2023/12/13 20:03:26 [error] 583176#583176: *594 open() "/usr/share/nginx/html/ynhtheme/custom_portal.js" failed (2: No such file or directory), client: 172.26.1.1, server: uptime.domain.tld, request: "GET /ynhtheme/custom_portal.js HTTP/2.0", host: "uptime.domain.tld", referrer: "https://uptime.domain.tld/dashboard"
2023/12/13 20:03:26 [error] 583176#583176: *594 open() "/usr/share/nginx/html/ynhtheme/custom_overlay.css" failed (2: No such file or directory), client: 172.26.1.1, server: uptime.domain.tld, request: "GET /ynhtheme/custom_overlay.css HTTP/2.0", host: "uptime.domain.tld", referrer: "https://uptime.domain.tld/dashboard"

I visit from inside the LAN. The IP in the log, 172.26.1.1, is my gateway, so some kind of proxying or redirecting is going on.

When I visit from outside the LAN, the error on the web page is the same, only the actual IP of the client is printed in the log, like so:

2023/12/13 20:10:18 [error] 583176#583176: *1232 open() "/usr/share/nginx/html/ynh_portal.js" failed (2: No such file or directory), client: 178.224.106.160, server: uptime.domain.tld, request: "GET /ynh_portal.js HTTP/2.0", host: "uptime.domain.tld", referrer: "https://uptime.domain.tld/dashboard"

Edit : I replaced the port number in my Yunohost-config ( proxy_pass http://127.0.0.1:12716;) with the one in the Github wiki (3001) ; now I get a friendly Yunohost notice of a naughty gateway,

image

When I revert to the original configuration (12716), and add

    proxy_set_header   Host $host;

test the config, restart nginx and visit the site… Nothing happens, for quite a while. Then I get the red bar with the error notice :frowning: , but THEN after a couple of seconds, it continues on to the login page of Uptime Kuma! :slight_smile:

Login does not seem to be integrated into SSO, also not after re-login to Yunohost. Perhaps as a result of the proxy_set_header Host $host ?

Anyway, I can start adding monitors.

Would you have another suggestion for the nginx-configuration ?

I just found the same solution as you, to add the Host header

No the login is not integrated into SSO as Uptime Kuma doesn’t support it. You need to create a separate account.

I just read UK’s changelogs , especially the previous version (three days ago) is interesting:

Caution

If you are using a reverse proxy, the security fix may cause connection issue to the WebSocket server. You should add ProxyPreserveHost on in your <VirtualHost> for Apache, and proxy_set_header Host $host; for Nginx. Read more: #4210 (comment)

That explains why it was not in your first tip!

OK :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.