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?
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 So, only 2 minutes to fix.
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.
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.