Upgrading via the new Repository

I’ve just used the “sudo apt install caddy” method to install caddy on a new environment (I’m switching from Windows to Raspberry PI). It worked like a charm, and I was up and running in 5 minutes.

A quick question… When V2.0 Final is released, what’s the best was to upgrade? Will ‘sudo apt update’ pick up the new version, or will I need to remove and re-install?

Thanks!

Yep, just sudo apt update then sudo apt upgrade! It will update the binary then restart the service on upgrade.

2 Likes

Perfect. Thanks!

1 Like

OK - I did the upgrade and it worked (sort of!)

The only issue was that it overwrote the /lib/systemd/system/caddy.service file. I’d got this set to :-

ExecStart=/usr/bin/caddy run --environ --resume

After the upgrade, it was set to :-

ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile

This, of course, then overwrote my settings with the defaults from the Caddyfile. Not a big issue, as I have the JSON file backed up :grinning: So, only 2 minutes to fix.

Thanks

I’d say that’s currently as expected, because if we change the defaults for the service file, we’d want it to use the latest. I’ll take a closer look to see if there’s anything available in the .deb pipeline to deal with this though, I’m still new to .deb packaging.

For now, I recommend you make a copy of the service file like caddy-custom.service, disable caddy.service, then enable your custom one. This should make it survive upgrades.

Thanks for trying it so quickly! :tada:

Even better, use systemctl edit --full caddy.service to create an override file in /etc/systemd/system that takes precedence over the file in /lib/systemd/system.

https://www.freedesktop.org/software/systemd/man/systemctl.html#edit%20UNIT…

3 Likes

Thanks @carlwgeorge I wasn’t aware of that! Perfect.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.