Compare commits
2 commits
0119c52db6
...
2c45da4844
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c45da4844 | |||
| 16fa01ad7d |
2 changed files with 18 additions and 3 deletions
|
|
@ -50,9 +50,9 @@ in {
|
||||||
"${downloadsHostname},everest"
|
"${downloadsHostname},everest"
|
||||||
];
|
];
|
||||||
systemd = {
|
systemd = {
|
||||||
units.tailscaled.requiredBy = ["caddy.service"];
|
services.caddy.after = ["tailscaled.service"];
|
||||||
# We have somewhat frequent power outages, and our ISP router takes
|
# We have somewhat frequent power outages, and our ISP router takes
|
||||||
# ages to boot up. If I don't add a delay, traefik tries to bind to
|
# ages to boot up. If I don't add a delay, caddy tries to bind to
|
||||||
# the tailscale interface before it's ready, making it crash too much
|
# the tailscale interface before it's ready, making it crash too much
|
||||||
# in too little time
|
# in too little time
|
||||||
services.caddy.serviceConfig.RestartSec = lib.mkForce "120s";
|
services.caddy.serviceConfig.RestartSec = lib.mkForce "120s";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,21 @@
|
||||||
{...}: {
|
{pkgs, ...}: let
|
||||||
|
script = pkgs.writeShellApplication {
|
||||||
|
name = "tailscale-wait-for-ip";
|
||||||
|
runtimeInputs = [pkgs.iproute2];
|
||||||
|
text = ''
|
||||||
|
# Based on https://github.com/tailscale/tailscale/issues/11504#issuecomment-2113331262
|
||||||
|
echo Waiting for tailscale0 to get an IP adress..
|
||||||
|
for i in {1..15}; do
|
||||||
|
if ip addr show dev tailscale0 | grep -q 'inet '; then break; fi
|
||||||
|
echo "$i"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
# This is needed for being an exit node
|
# This is needed for being an exit node
|
||||||
useRoutingFeatures = "server";
|
useRoutingFeatures = "server";
|
||||||
};
|
};
|
||||||
|
systemd.services.tailscaled.postStart = "${script}/bin/tailscale-wait-for-ip";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue