V2: auto-update feature in the future?

With the Caddy v2 rewrite, is there any chance that auto-update will be added as a feature?

This Github issue beginning in 2016 suggests no: Feature-request: Auto-update Caddy · Issue #576 · caddyserver/caddy · GitHub

While this thread from 2017 suggests it is planned to be implemented someday: Auto-updating Caddy

I’ll be honest, I don’t actually need auto-update, all I really need is an Ubuntu apt repository that isn’t woefully outdated, but that may also be a pipe dream. I have not figured out a better way to update Caddy v2 on a production server than to manually download the binary from Github every time I see there is a new version. (Homebrew for Linux or Snaps probably won’t cut it.)

Regardless, auto-update would be a really cool feature that sets Caddy apart from other web servers, and I wouldn’t mind seeing it.

1 Like

Yeah, it’s part of the plans, but it’s all dependent on whether @matt gets enough funding and time to make it happen!

There are some package managers that will have Caddy v2, so far we have Fedora (RPM), and Arch (pacman) is in the works. Debian (apt) would be nice to have but no significant work has gone into making it happen yet. See GitHub - caddyserver/dist: Resources for packaging and distributing Caddy for all this. Also packaging for Debian ecosystem (Debian/Ubuntu) · Issue #2789 · caddyserver/caddy · GitHub is open for Debian.

There’s also an official Docker image here GitHub - caddyserver/caddy-docker: Source for the official Caddy v2 Docker Image which is still being improved.

3 Likes

So, yeah, I love the idea of auto-updates. Been a dream of mine for years now.

In general, package/distro maintainers are opposed to what I want to do, however I still want to do it. :smiley:

My plan is to have Caddy (v2) manage its own plugins, which is much easier now with modules and the soon-to-be-written (?) v2 build server.

Basically, you’d use your package manager or whatever dist mechanism to install Caddy, then it would actually manage a separate binary that you could manipulate with commands like caddy add-plugin or caddy upgrade. This would cause an HTTPS request that downloads the updated binary and simply plops it down. Basically, the system-installed caddy command would flow through to a secondary binary that is managed by the first, which acts as an updater. Then you can just update the updater whenever you are able.

Auto-upgrades fit nicely into this model too, since a running Caddy instance could easily see when a new patch release is available, download the binary, run some user-defined tests, then restart with zero downtime. As in Caddy 1, if the new config fails to take on the updated binary, it would roll back with no interruptions and log an error.

That’s my vision… I want to make it happen… and as @francislavoie said, it definitely depends on funding and availability, but I think this is hugely important so I want to make sure we do it. I will be pushing for it as soon as I can.

1 Like

Distro rules don’t allow the type of behavior you are describing. As @skyfaller noted in his original post, the main reason he is asking about auto-updating is because their isn’t an apt repository that would allow him to update caddy along with the rest of the system (e.g. apt upgrade). Having caddy repositories available (or getting added into the default repositories) is the correct way to solve this problem. Users that install caddy with their system package manager don’t want caddy to auto-update itself. They want normal packages that get updated with the rest of their system, optionally with the package manager’s native automatic functionality.

I know you want this type of behavior, and I probably won’t be able to convince you otherwise. All I ask is that if you implement it you make it simple disable. Otherwise you’ll risk caddy being blocked from distro repositories, which will significantly hurt adoption.

+1 for availability on a package manager, definitely is the route to go instead of an auto-updater which could break production builds. On the subject of cross-platform, an official Caddy Snappy pacakge on https://snapcraft.io/ could be a great way to get Caddy out onto as many linux distros as possible. Then users could install it quickly with sudo snap install caddy.

A quick search reveals that 2 versions of Caddy are already on the Snap Store but they’re quite out of date. Would be awesome to see an official one.

@noelforte We’d love to be on as many distros/platforms as possible, but we need help from the community from people who are more knowledgeable in packaging!

I’ve been doing some work to try and set up a .deb to potentially ship via https://gemfury.com, but we’ll need help to get it in official distro repositories.

@noelforte Would you be willing to maintain our official snap and/or deb packages? We could use some help.

I could look into it— have no experience with Go or packaging in general but could try giving it a shot. Happy to start a separate discussion but I think for snap you have to have an Ubuntu One account and I’m not sure if that should be tied to my personal credentials for fallbacks if I can’t maintain the packages indefinitely. Feel free to DM me.

I’m interested in helping with Arch (and maybe Ubuntu) packaging, but I have zero experience. I have successfully compiled Caddy2 though :slight_smile:

@noelforte @skyfaller It’s not going to be quick or easy probably, but if you can commit to getting it finished and then to a point where others can maintain it, we’d gladly accept both your help. Can I use your forum email address to invite you to our dev Slack?

2 Likes

Go for it!

I spent about 3 hours today trying to get snapcraft running on Mac OS but can’t seem to get it working. Since @skyfaller seems like he’s got the time, he’s probably a better bet for getting debian or snap packages going at the moment since I don’t really have the bandwidth to get into other projects at this time. Happy to join the slack though and pitch in when I can.

1 Like

Sounds good – do let us know if you make any progress though or if you find some time! The community would be happy to have and benefit from any contributions.

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