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 = {
|
||||
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";
|
||||
RestartSec = "5s";
|
||||
User = "root";
|
||||
Group = "root";
|
||||
# Configure service to wait for network
|
||||
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";
|
||||
StandardError = "journal";
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue