Trying to set Headscale up in a Debian VPS.

When I do

$ sudo headscale serve

I get the following error

failed to bind to TCP address: listen TCP 127.0.0.1:8080: bind: address already in use

Bit of a noob with crowdsec but I think its doing something that obstructs Headscale. If I stop crowdsec and do ‘headscale serve’ it seems to run without an issue.

I’m setting it up so that headscale listens on my domain using Caddy. This is the caddyfile:

sub.domain.com {
   reverse_proxy localhost:8080
   tls [email protected]
}

Any ideas?

  • solrize@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 hours ago

    generally, use “netstat -lpn | grep 8080” (or whatever port number) to find out what process is already listening on that port. This kind of thing happens all the time.

    • irmadlad@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 hour ago

      netstat -lpn | grep 8080

      That’s a bit cleaner than sudo lsof -i :8080. It always amazes me tho, how many different commands/ways there are in Linux to get to the same spot.

  • irmadlad@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    edit-2
    4 hours ago

    I don’t run Headscale but it appears that there is a conflict.

    Who is using port 8080: sudo lsof -i :8080

    Have you tried either changing Crowdsec’s port or Headscale’s port?

    Change Crowdsed’s port

    Change Headscale port:

    /etc/headscale/config.yaml

    headscale:
      listen_addr: 127.0.0.1:8081
    

    sudo headscale serve

  • just_another_person@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    2
    ·
    edit-2
    3 hours ago

    Just change the port Headscale is running on.

    You also don’t want a reverse proxy out in front of Headscale. It doesn’t serve a purpose, and does nothing but introduce added complexity and performance degradation.

    Just make an A record in your DNS that points to ‘vpn.whatever.com’ if you just want to treat it as a named host.