Alternative to building Caddy from source?

A general query…

I just happened to notice add-package and remove-package subcommands for caddy.

Rather than using xcaddy to build Caddy with plugins, is an alternative approach to start out with a static binary and then use the add-package subcommand to add a plugin? If so, this would seem like a much simpler and quicker approach than using xcaddy.

Yes, but it’s a little less flexible than xcaddy, which lets you build with local or development plugins, including performing replacements, etc. These subcommands only let you build using plugins that are registered on the Caddy website and are intended for modifying Caddy installs in-place. (Caddy will need the right permissions for this to work also.)

1 Like

The FreeBSD prebuilt binary package for Caddy uses the static binary. Using add-package would be an easy way to include registered plugins into Caddy installed via pkg, the binary package manager. I think this alternative approach will trivialise the set-up of Caddy with registered plugins on platforms that use package managers. This does not in any way undermine the importance of xcaddy and the additional flexibility it provides.

Package maintainers don’t like depending on external build dependencies (https://caddyserver.com would be a dependency in this case), so I think this is unlikely/not a good idea, for anything automated.

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