Fix cloudflared service to ensure it runs persistently
This commit is contained in:
parent
0c2f06bd72
commit
8646e5a9f8
1 changed files with 11 additions and 2 deletions
|
|
@ -35,10 +35,19 @@ in {
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.cloudflared}/bin/cloudflared access tcp --hostname ${tunnel.remoteHost} --url ${tunnel.remoteTarget} --port ${toString tunnel.localBindPort} --logfile ${tunnel.logPath}";
|
ExecStart = "${pkgs.cloudflared}/bin/cloudflared access tcp --hostname ${tunnel.remoteHost} --url ${tunnel.remoteTarget} --port ${toString tunnel.localBindPort} --logfile ${tunnel.logPath}";
|
||||||
|
# The key setting to ensure the service stays running
|
||||||
|
Type = "simple";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
User = "root";
|
# Configure service to wait for network
|
||||||
Group = "root";
|
After = [ "network-online.target" ];
|
||||||
|
Wants = [ "network-online.target" ];
|
||||||
|
# Run as dedicated user for better security
|
||||||
|
DynamicUser = true;
|
||||||
|
# Configure systemd runtime directory
|
||||||
|
RuntimeDirectory = "cloudflared";
|
||||||
|
RuntimeDirectoryMode = "0700";
|
||||||
|
# Standard outputs
|
||||||
StandardOutput = "journal";
|
StandardOutput = "journal";
|
||||||
StandardError = "journal";
|
StandardError = "journal";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue