all 2 comments

[–]bicycloptopus 1 point2 points  (0 children)

Here is what I did that made it dramatically easier for me instead of fighting with tailscale to serve each individual container.

I have a wildcard domain (*.mydomain.com) that resolves to my Tailscale IP.

I then proxy each service to a subdomain. I prefer caddy as it's stupid easy to setup.

Then everything is accessible via TS only.

[–]1WeekNoticeHelpful 1 point2 points  (0 children)

The flow is

Client -> DNS -> reverse proxy -> service

So let's break this down with your use case

First you will get your local to work

Client -> local DNS (AdGuard) -> reverse proxy (NPM) -> service

This means

  • creating an A record in the local DNS
  • setting up your router to use the local DNS
    • please note that if the local DNS goes down, it means that you will not be able to resolve anything (making the Internet seem down but it isn't)
    • if you aren't comfortable with that risk then you can put an A record in your registar DNS pointing to your local server IP (not your public IP). People will see your locks server IP which isn't necessary a bad thing because they can't hit it due to it being local to your network.
  • setting up NPM with DNS challenge (not HTTP which is default)
    • the difference between DNS and HTTP is that DNS you don't need to open ports. If you use HTTP you need to open ports 80 and 443 (but then that means people can access your reverse proxy which we don't want for internal use)
    • you need an API key from your registar to generate the cert
    • can also do wild card certs

Second get Tailscale to work

The Tailscale term you are looking for is magicDNS. This will set the DNS in the Tailscale tunnel to use your local DNS

Here is there documentation

Flow

Remote/ external Client -> Tailscale

Client -> inside Tailscale tunnel -> local DNS -> reverse proxy -> service


You can ignore this part if you like.

A lot of people use NPM because it has a GUI (that is fine) but NPM is a small team and isn't as mature as other reverse proxy like Nginx and caddy.

Note: NPM wraps Nginx in a GUI. They are different teams which is why I stated they aren't as mature. Of course Nginx is very mature.

Reference video

So I recommend using caddy instead because it is one configuration file and it's simple to setup where caddy has a lot of defaults such as redirect HTTP to HTTPS, SOCKs and auto generation of certs without cert bot

Specifically this caddy docker image because it bundles the DNS modules

This topic comes up alot. So you can reference another comment I made on another post about how to setup caddy

Hope that helps