iFargle / headscale-webui

A simple Headscale web UI for small-scale deployments.
Other
647 stars 62 forks source link

Cannot open /machines, /routes or /overview #131

Open esticle opened 9 months ago

esticle commented 9 months ago

Hi - this issue appears a bit like #84 - a unclean reboot has ensured my UI is broken whilst headscale appears to be operating OK. I can see /users however the machines and routing pages do not work.

Here's the logs in debug mode for hitting /machines:

[2024-01-09 17:18:55,746] INFO in helper: All startup checks passed.
[2024-01-09 17:18:55,751] INFO in helper: Testing API key validity.
[2024-01-09 17:18:55,974] INFO in helper: Key check passed.
[2024-01-09 17:18:55,978] INFO in headscale: Getting API key information
[2024-01-09 17:18:56,152] INFO in headscale: Looking for valid API Key...
[2024-01-09 17:18:56,154] INFO in headscale: Key found.
[2024-01-09 17:18:56,158] INFO in renderer: Rendering machine cards
[2024-01-09 17:18:56,159] INFO in headscale: Getting machine information
[2024-01-09 17:18:56,329] ERROR in app: Exception on /machines [GET]
Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/server.py", line 114, in decorated
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/server.py", line 207, in machines_page
    cards = renderer.render_machines_cards()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/renderer.py", line 490, in render_machines_cards
    num_threads = len(machines_list["machines"])
                      ~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'machines'
[2024-01-09 17:18:56 +0000] [8] [ERROR] Error handling request /favicon.ico
Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
    self.handle_request(listener, req, client, addr)
  File "/app/.venv/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 169, in handle_request
    resp, environ = wsgi.create(req, client, addr,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/gunicorn/http/wsgi.py", line 183, in create
    path_info = path_info.split(script_name, 1)[1]
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

For /routes and /overview the same error occurs on the same KeyError of 'machines'.

root@3236c4f5fc02:/# headscale machines ls
2024-01-09T17:20:55Z TRC DNS configuration loaded dns_config={"Domains":["lan.redcated.net","redcated.net"],"Nameservers":["1.1.1.1"],"Proxied":true,"Resolvers":[{"Addr":"1.1.1.1"}],"Routes":{"lan.redcated.net":[{"Addr":"192.168.3.1"}]}}
ID | Hostname  | Name             | MachineKey | NodeKey | User      | IP addresses                   | Ephemeral | Last seen           | Expiration          | Connected | Expired
1  | device1   | device1          | [2monD]    | [udw6D] | user1     | 100.64.0.1, fd7a:115c:a1e0::1  | false     | 2024-01-09 14:38:25 | 0001-01-01 00:00:00 | offline   | no
2  | tailscale | device2          | [BGGVi]    | [KurFF] | user2     | 100.64.0.2, fd7a:115c:a1e0::2  | false     | 2024-01-09 17:20:52 | 0001-01-01 00:00:00 | online    | no
4  | device3   | device3          | [5zyE0]    | [HdbqD] | user1     | 100.64.0.4, fd7a:115c:a1e0::4  | false     | 2024-01-09 17:20:52 | 0001-01-01 00:00:00 | online    | no
5  | tailscale | device4          | [c+I4J]    | [5uC+B] | user2     | 100.64.0.3, fd7a:115c:a1e0::3  | false     | 2024-01-09 17:20:52 | 0001-01-01 00:00:00 | online    | no
6  | tailscale | device5          | [nVgKv]    | [am3ir] | hosted15  | 100.64.0.5, fd7a:115c:a1e0::5  | false     | 2024-01-09 17:20:51 | 0001-01-01 00:00:00 | online    | no
8  | localhost | device6          | [vpup1]    | [8D0NL] | user1     | 100.64.0.7, fd7a:115c:a1e0::7  | false     | 2024-01-09 14:38:15 | 0001-01-01 00:00:00 | offline   | no
9  | device7   | device7          | [aGYSx]    | [tuwRG] | device7   | 100.64.0.6, fd7a:115c:a1e0::6  | false     | 2024-01-09 17:20:52 | 0001-01-01 00:00:00 | online    | no
10 | device8   | device8          | [MA4kM]    | [cj74G] | device8   | 100.64.0.8, fd7a:115c:a1e0::8  | false     | 2024-01-09 17:20:54 | 0001-01-01 00:00:00 | online    | no
11 | device9   | device9          | [KWZOT]    | [jhQno] | device9   | 100.64.0.9, fd7a:115c:a1e0::9  | false     | 2024-01-09 17:20:52 | 0001-01-01 00:00:00 | online    | no
12 | device10  | device10         | [kNFV7]    | [oAQY3] | device10  | 100.64.0.10, fd7a:115c:a1e0::a | false     | 2024-01-09 17:20:54 | 0001-01-01 00:00:00 | online    | no

And here's the routes and machines ls:

root@3236c4f5fc02:/# headscale routes ls
2024-01-09T17:21:23Z TRC DNS configuration loaded dns_config={"Domains":["lan.redcated.net","redcated.net"],"Nameservers":["1.1.1.1"],"Proxied":true,"Resolvers":[{"Addr":"1.1.1.1"}],"Routes":{"lan.redcated.net":[{"Addr":"192.168.3.1"}]}}
ID | Node               | Prefix         | Advertised | Enabled | Primary
1  | device2            | 0.0.0.0/0      | true       | true    | -
2  | device2            | ::/0           | true       | true    | -
13 | device3            | 0.0.0.0/0      | true       | true    | -
14 | device3            | ::/0           | true       | true    | -
15 | device3            | 10.10.102.0/24 | false      | false   | false
16 | device3            | 10.10.103.0/24 | false      | false   | false
17 | device3            | 10.10.104.0/24 | false      | false   | false
18 | device3            | 192.168.3.0/24 | false      | false   | false
19 | device3            | 10.10.101.0/24 | false      | false   | false
20 | device4            | 0.0.0.0/0      | true       | true    | -
21 | device4            | ::/0           | true       | true    | -
22 | device4            | 192.168.3.0/24 | true       | true    | true
23 | device4            | 10.10.101.0/24 | true       | true    | true
24 | device4            | 10.10.102.0/24 | true       | true    | true
25 | device4            | 10.10.103.0/24 | true       | true    | true
26 | device4            | 10.10.104.0/24 | true       | true    | true
27 | device5            | 0.0.0.0/0      | true       | true    | -
28 | device5            | ::/0           | true       | true    | -
29 | device7            | 0.0.0.0/0      | true       | true    | -
30 | device7            | ::/0           | true       | true    | -
31 | device4            | 10.42.42.0/24  | true       | true    | true
32 | device8            | 0.0.0.0/0      | true       | true    | -
33 | device8            | ::/0           | true       | true    | -
34 | device9            | 0.0.0.0/0      | true       | true    | -
35 | device9            | ::/0           | true       | true    | -

Any ideas?

Kurty00 commented 8 months ago

I am having the same issue.

wenco commented 5 months ago

yes,i try to compatible with headscale:v0.23.0-alpha8, other ditn't test. view this url https://github.com/iFargle/headscale-webui/compare/main...wenco:headscale-webui:main

Sinister646 commented 4 months ago

can you specify exactly where you change that for a super beginner ?

Enissay commented 1 month ago

Anyway to push a new image with the fix please ?

wenco commented 1 month ago

yes, fllow step for this demo

1、exec bash in container

docker exec -it headscale-webui sh

2、download files cd /app wget -nc https://raw.githubusercontent.com/wenco/headscale-webui/main/headscale.py wget -nc https://raw.githubusercontent.com/wenco/headscale-webui/main/renderer.py cd /app/static/js && wget -nc https://raw.githubusercontent.com/wenco/headscale-webui/main/static/js/custom.js

3、now, restart container docker restart headscale-webui

if you not use container, plase replace these files to run app.

Enissay @.***> 于2024年8月10日周六 07:25写道:

Anyway to push a new image with the fix please ?

— Reply to this email directly, view it on GitHub https://github.com/iFargle/headscale-webui/issues/131#issuecomment-2278873366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATEWHLTJJZ2O7NBU73B2VTZQVFVBAVCNFSM6AAAAABBTPN6QWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZYHA3TGMZWGY . You are receiving this because you commented.Message ID: @.***>