cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
9.36k stars 836 forks source link

🐛Package manager installation: systemd service not being restarted after update #799

Open blroot opened 2 years ago

blroot commented 2 years ago

If cloudflared is updated trough package manager, and it is installed as a systemd service, there is no mechanism to restart the service after the update.

To Reproduce Steps to reproduce the behavior:

  1. Install cloudflared from package manager
  2. Install cloudflared as service cloudflared service install, systemctl start cloudflared
  3. Update the package
  4. Observe that the service is never restarted, thus the old version remains running until reboot, etc.

Expected behavior There should be a mechanism to restart the service whenever an update is performed.

Environment and versions

blroot commented 2 years ago

I don't know about the rest of the platforms, but I've tried using systemd path: https://www.freedesktop.org/software/systemd/man/systemd.path.html

I've defined

cloudflared-restart.path

[Path]
PathChanged=/usr/bin/cloudflared

[Install]
WantedBy=multi-user.target

cloudflared-restart.service

[Service]
Type=OneShot
ExecStart=/usr/bin/systemctl restart cloudflared

Then systemctl enable cloudflared-restart.path. Now every changes in /usr/bin/cloudflared triggers a restart. Do you see this as a potential solution?