How to access Yunohost apps using Tailscale MagicDNS

What type of hardware are you using: Raspberry Pi 3, 4+
What YunoHost version are you running: 12.0.16
How are you able to access your server: The webadmin
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: No

Describe your issue

I am connecting to my Yunohost instalation in a home Rasperberry Pi using Tailstcale magicDNS (eg. “raspberrypI[DOT]bird-tail[DOT]ts[DOT]net”). I currenty have 2 apps installed in Yunohost (eg. “app1” and “app2”).

I have added the “raspberrypi[DOT]bird-tail[DOT]ts[DOT]net” domain in Yunohost admin and I can reach it via this tailscale address but I need a way to access directly each of the apps.

I have tried adding a prefix to the subdomain (“app1[DOT]raspberrypi[DOT]bird-tail[DOT]ts[DOT]net” and “app2[DOT]raspberrypi[DOT]bird-tail[DOT]ts[DOT]net”) but I don’t know how to make yunohost redirect these requests to the corresponding apps.

Can someone help?
Thank you.

Share relevant logs or error messages

General dns error

There are two ways:

  • installing or moving each app to a path: app1 at raspberrypi.bird-tail.ts.net/app1 and app2 at raspberrypi.bird-tail.ts.net/app2

  • adding app1.raspberrypi.bird-tail.ts.net to YunoHost domains and installing or moving the app to this domain. Same for app2.

Thanks for reaching out. I have already tried both: #1 is not possible because the apps require to be installed in the domain root (grist and n8n) and I tried #2: the app is apparently moved to that sub-sub-domain but the app is not found afterwards. I am not sure if I need to change something in Yunohost or Tailscale but Tailscale finds Yunohost admin. And if I install one app to the same Tailscale domain (without “app1”) the app does work. But that means I can only have one app running. Bottomline: I think it is a redirecting issue that I need to address in Yunohost.

Tailscale works with hostname and not domain name, right ?

It gives several options, but domain name via magicDNS is one of them. I can access yunohost admin if I configure it to use Tailscale domain.

It seems that ‘‘domain name’’ means ‘‘hostname+tailsdomain.tld’’. So you can reach main domain but no others. Can you set a ‘‘custom’’ DNS in tailscale?

This guide might help you:

You should be able to use e.g. app1.yourtail.internal

Thanks, I will check the info. It must really be a routing issue I guess. But now I am not sure if it’s a limitation in Tailscale. Will check.

Maybe I can use PiHole with tailscale and use it as dns. I was doing it via openVPN previously. Will check

Don’t use Pihole because it’s no longer supported (on Yunohost at least), but you can use Adguard Home, or Technitium DNS.

Thanks for the suggestion. Will check it out asap, meawhile, got it working with PiHole (I’ll post the how-to) because I have it already installed and been using it for a few years.

In case anyone has this requirement, here’s how I’ve done it. This article pointed me to the right solution: Block ads on all your devices from anywhere using a Raspberry Pi · Tailscale Docs

Basically I’ve added a custom nameserver in Tailscale admin pointing to the machine where I had PiHole running (100.x.x.x). Then, in PiHole admin I added Local DNS records (app1.local, app2.local) and pointed them to the IP of the other machine hosting Yunohost (100.x.x.x).

Then, in Yunohost admin / Apps, I’ve chosen to serve each app from the respective local domain (app1.local, app2.local).

Now, using Tailscale, I can reach each Yunohost app and get ad blocking. Each DNS query goes to PiHole, gets blocked for ads, and then checked if it should resolve to a local machine (i.e. the apps installed in Yunohost) or the broader internet.

Thanks everyone!

:+1:

Great that you could solve it! just be aware that PiHole won’t have updates in Yunohost, and also I don’t know if you managed to use self-signed certs in case you need https, in that case it’s always a good idea to use “.internal” instead of “.local”

I guess he runs pihole on a dedicated server, otherwise, the problem would be the same.

yes, been using it on a raspberry pi.

Hi everyone. First of all, happy new year!

Folowing this topic I got into another problem which I have been trying to solve but with no luck, and I don’t know if its a configuration issue I should tackle in Yunohost, in Tailscale or in n8n app inside Yunohost.

Problem is: i have Grist running on grist.local and n8n running on n8n.local addresses. I can reach both from inside my home network and away from it using Tailscale. Tailscale is using my DNS resolver from my raspberry pi, which is running the resolver via PiHole.

What I am trying to do: backup my grist databases with n8n, saving them to a nextcloud instance hosted online. For that I am doing an http request in n8n using the address n8n.local but that address can’t be found. I think it may be due to it being .local and having some limitations on that aspect.

An alternative I have tried was to use my Tailscale tailnet DNS name, eg. consider it being “tail-name”). I can make Grist in yunohost use the domain “yunohostMachine[dot]tail-name[dot]ts[dot]net” and it will open fine. Or I can use n8n use the exact same address and it works fine. But I need to separate them adding a prefix, for example:

  • grist.yunohostMachine[dot]tail-name[dot]ts[dot]net
  • n8n.yunohostMachine[dot]tail-name[dot]ts[dot]net

I can add those subdomains in Yunohost but they don’t resolve to anything, even if I add them to PiHole local DNS resolver.

I am completely lost, all help welcome. Thanks!

And yet again solved it after digging into Yunohost nginx config.

Turns out grist was using port 8485 instead of default 8484 because I had a previsous instalation that used 8484. As such, one of my earlier attemps failed since I was using the wrong port.

Solution was to fetch grist data via http request using localhost:8485.

See ya!