gurucomputing / headscale-ui

A web frontend for the headscale Tailscale-compatible coordination server
BSD 3-Clause "New" or "Revised" License
1.59k stars 113 forks source link

Cannot get it to connect to server #106

Closed wisameldin closed 1 year ago

wisameldin commented 1 year ago

Browser: Mainly Firefox though tried on edge Headscale: To be honest not sure as I used the tag Latest (As of today 6/23/2023)

I installed Headscale via docker using the following command: docker run \ --name headscale \ --detach \ --volume ./config:/etc/headscale/ \ --publish 0.0.0.0:8180:8080 \ --publish 0.0.0.0:9191:9090 \ --network DockerNetwork \ headscale/headscale:latest \ headscale serve

I tested it via the curl command, created a user successfully and no issues there result for curl http://127.0.0.1:9191/metrics : '# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. '# TYPE go_gc_duration_seconds summary 'go_gc_duration_seconds{quantile="0"} 2.2467e-05 'go_gc_duration_seconds{quantile="0.25"} 3.2826e-05 'go_gc_duration_seconds{quantile="0.5"} 6.1649e-05 'go_gc_duration_seconds{quantile="0.75"} 0.000145271 'go_gc_duration_seconds{quantile="1"} 0.00022687 'go_gc_duration_seconds_sum 0.001344058 'go_gc_duration_seconds_count 15 '# HELP go_goroutines Number of goroutines that currently exist. '# TYPE go_goroutines gauge 'go_goroutines 24 '# HELP go_info Information about the Go environment. '# TYPE go_info gauge 'go_info{version="go1.20.4"} 1 '# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. '# TYPE go_memstats_alloc_bytes gauge 'go_memstats_alloc_bytes 2.697744e+06 '# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. '# TYPE go_memstats_alloc_bytes_total counter 'go_memstats_alloc_bytes_total 3.1710752e+07 '# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. '# TYPE go_memstats_buck_hash_sys_bytes gauge 'go_memstats_buck_hash_sys_bytes 1.457492e+06 '# HELP go_memstats_frees_total Total number of frees. '# TYPE go_memstats_frees_total counter 'go_memstats_frees_total 248489 '# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. '# TYPE go_memstats_gc_sys_bytes gauge 'go_memstats_gc_sys_bytes 8.776416e+06 '# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use. '# TYPE go_memstats_heap_alloc_bytes gauge 'go_memstats_heap_alloc_bytes 2.697744e+06 '# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. '# TYPE go_memstats_heap_idle_bytes gauge 'go_memstats_heap_idle_bytes 6.209536e+06 '# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. '# TYPE go_memstats_heap_inuse_bytes gauge 'go_memstats_heap_inuse_bytes 5.554176e+06 '# HELP go_memstats_heap_objects Number of allocated objects. '# TYPE go_memstats_heap_objects gauge 'go_memstats_heap_objects 18184 '# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. '# TYPE go_memstats_heap_released_bytes gauge 'go_memstats_heap_released_bytes 3.751936e+06 '# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. '# TYPE go_memstats_heap_sys_bytes gauge 'go_memstats_heap_sys_bytes 1.1763712e+07 '# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection. '# TYPE go_memstats_last_gc_time_seconds gauge 'go_memstats_last_gc_time_seconds 1.6875554343292418e+09 '# HELP go_memstats_lookups_total Total number of pointer lookups. '# TYPE go_memstats_lookups_total counter 'go_memstats_lookups_total 0 '# HELP go_memstats_mallocs_total Total number of mallocs. '# TYPE go_memstats_mallocs_total counter 'go_memstats_mallocs_total 266673 '# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. '# TYPE go_memstats_mcache_inuse_bytes gauge 'go_memstats_mcache_inuse_bytes 7200 '# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. '# TYPE go_memstats_mcache_sys_bytes gauge 'go_memstats_mcache_sys_bytes 15600 '# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. '# TYPE go_memstats_mspan_inuse_bytes gauge 'go_memstats_mspan_inuse_bytes 160480 '# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. '# TYPE go_memstats_mspan_sys_bytes gauge 'go_memstats_mspan_sys_bytes 179520 '# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. '# TYPE go_memstats_next_gc_bytes gauge 'go_memstats_next_gc_bytes 5.75964e+06 '# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. '# TYPE go_memstats_other_sys_bytes gauge 'go_memstats_other_sys_bytes 1.233572e+06 '# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator. '# TYPE go_memstats_stack_inuse_bytes gauge 'go_memstats_stack_inuse_bytes 819200 '# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. '# TYPE go_memstats_stack_sys_bytes gauge 'go_memstats_stack_sys_bytes 819200 '# HELP go_memstats_sys_bytes Number of bytes obtained from system. '# TYPE go_memstats_sys_bytes gauge 'go_memstats_sys_bytes 2.4245512e+07 '# HELP go_threads Number of OS threads created. '# TYPE go_threads gauge 'go_threads 12 '# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. '# TYPE process_cpu_seconds_total counter 'process_cpu_seconds_total 0.34 '# HELP process_max_fds Maximum number of open file descriptors. '# TYPE process_max_fds gauge 'process_max_fds 1.048576e+06 '# HELP process_open_fds Number of open file descriptors. '# TYPE process_open_fds gauge 'process_open_fds 14 '# HELP process_resident_memory_bytes Resident memory size in bytes. '# TYPE process_resident_memory_bytes gauge 'process_resident_memory_bytes 3.6913152e+07 '# HELP process_start_time_seconds Start time of the process since unix epoch in seconds. '# TYPE process_start_time_seconds gauge 'process_start_time_seconds 1.68755485812e+09 '# HELP process_virtual_memory_bytes Virtual memory size in bytes. '# TYPE process_virtual_memory_bytes gauge 'process_virtual_memory_bytes 7.68647168e+08 '# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes. '# TYPE process_virtual_memory_max_bytes gauge 'process_virtual_memory_max_bytes 1.8446744073709552e+19 '# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served. '# TYPE promhttp_metric_handler_requests_in_flight gauge 'promhttp_metric_handler_requests_in_flight 1 '# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code. '# TYPE promhttp_metric_handler_requests_total counter 'promhttp_metric_handler_requests_total{code="200"} 0 'promhttp_metric_handler_requests_total{code="500"} 0 'promhttp_metric_handler_requests_total{code="503"} 0'

And the docker compose file I used for the UI : 'version: '3.5' 'services: '# headscale: '# image: headscale/headscale:latest '# container_name: headscale '# volumes: '# - ./container-config:/etc/headscale '# - ./container-data/data:/var/lib/headscale '# # ports: '# # - 27896:8080 '# command: headscale serve '# restart: unless-stopped ' headscale-ui: ' image: ghcr.io/gurucomputing/headscale-ui:latest ' restart: unless-stopped ' container_name: headscale-ui ' ports: ' - 9443:443 'networks: ' default: ' name: DockerNetwork ' external: true

The result logs upon creation : headscale-ui | no Caddyfile detected, copying across default config headscale-ui | Starting Caddy headscale-ui | {"level":"info","ts":1687555163.9691575,"msg":"using provided configuration","config_file":"/data/Caddyfile","config_adapter":"caddyfile"} headscale-ui | {"level":"info","ts":1687555163.971166,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//127.0.0.1:2019","//localhost:2019","//[::1]:2019"]} headscale-ui | {"level":"info","ts":1687555163.9713318,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0003aecb0"} headscale-ui | {"level":"info","ts":1687555163.9720645,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443} headscale-ui | {"level":"warn","ts":1687555163.9720807,"logger":"http","msg":"automatic HTTP->HTTPS redirects are disabled","server_name":"srv0"} headscale-ui | {"level":"warn","ts":1687555163.97209,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv1","http_port":80} headscale-ui | {"level":"info","ts":1687555163.9721808,"logger":"pki.ca.local","msg":"root certificate trust store installation disabled; unconfigured clients may show warnings","path":"storage:pki/authorities/local/root.crt"} headscale-ui | {"level":"warn","ts":1687555163.9722004,"logger":"tls","msg":"YOUR SERVER MAY BE VULNERABLE TO ABUSE: on-demand TLS is enabled, but no protections are in place","docs":"https://caddyserver.com/docs/automatic-https#on-demand-tls"} headscale-ui | {"level":"info","ts":1687555163.9723454,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"} headscale-ui | {"level":"info","ts":1687555163.9723797,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/home/appuser/.local/share/caddy"} headscale-ui | {"level":"info","ts":1687555163.972544,"logger":"tls","msg":"finished cleaning storage units"} headscale-ui | {"level":"info","ts":1687555163.972551,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]} headscale-ui | {"level":"info","ts":1687555163.9725723,"logger":"http.log","msg":"server running","name":"srv1","protocols":["h1","h2","h3"]} headscale-ui | {"level":"info","ts":1687555163.9726827,"msg":"autosaved config (load with --resume flag)","file":"/home/appuser/.config/caddy/autosave.json"} headscale-ui | {"level":"info","ts":1687555163.972691,"msg":"serving initial configuration"} headscale-ui | {"level":"info","ts":1687555191.4297562,"logger":"tls.on_demand","msg":"obtaining new certificate","remote_ip":"192.168.70.25","remote_port":"60166","server_name":"192.168.208.40"} headscale-ui | {"level":"info","ts":1687555191.4302828,"logger":"tls.obtain","msg":"acquiring lock","identifier":"192.168.208.40"} headscale-ui | {"level":"info","ts":1687555191.4311504,"logger":"tls.obtain","msg":"lock acquired","identifier":"192.168.208.40"} headscale-ui | {"level":"info","ts":1687555191.4313114,"logger":"tls.obtain","msg":"obtaining certificate","identifier":"192.168.208.40"} headscale-ui | {"level":"info","ts":1687555191.4334624,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"192.168.208.40"} headscale-ui | {"level":"info","ts":1687555191.4335208,"logger":"tls.obtain","msg":"releasing lock","identifier":"192.168.208.40"} headscale-ui | {"level":"warn","ts":1687555191.4340456,"logger":"tls","msg":"stapling OCSP","error":"no OCSP stapling for [192.168.208.40]: no OCSP server specified in certificate","identifiers":["192.168.208.40"]}

It loads but cannot connect to server I did generate API key via the command

docker exec headscale headscale apikeys create

What can I do to make it work? What am I missing?

IssueScreenshot

Note In the areas where I pasted the code I added ['] to preserve the line and not using ['#] as a formatting indicator

routerino commented 1 year ago

headscale ui is not tested using IPs, different ports, or http. I strongly suggest setting it up properly using a reverse proxy and re test. As per the documentation:

HS-UI has to be ran on the same subdomain or you need to configure CORS. Yes you need to use a reverse proxy to do this. Use a reverse proxy.

wisameldin commented 1 year ago

Sorry Seems I sent the screenshot from an older attempt before I read about that I did try and posted after fiddling with nginx proxy manager

But I figured it out I mixed up the location of the port meant in the pat added in the advanced and the original IP it was directing to In other words I swapt them out foolish me

Thank you for your help

routerino commented 1 year ago

closing as solved