Using update-alternatives along with "caddy add-package"

1. Output of caddy version:

v2.6.2

2. How I run Caddy:

a. System environment:

Ubuntu 20.04.5 LTS

b. Command:

caddy add-package github.com/darkweak/souin/plugins/caddy github.com/caddyserver/transform-encode

c. Service/unit/compose file:

Default unchanged.

d. My complete Caddy config:

Not relevant to question.

3. The problem I’m having:

I installed the stable release from cloudsmith as in Install — Caddy Documentation.

Then I added to packages which worked great.

In order to avoid the next caddy release removing the created binary with the two packages I found out there are already solutions to this:

My questions:

Do you think it would be ok to take the caddy binary that was created by add-package, put it in a special directory where update-alternatives then will symlink it, this way pretending it is my “custom binary”?

This will simply take care of avoiding caddy updates from the repo replacing the ones with the extra modules. A caddy upgrade might possibly re-build the latest caddy with the latest modules “in-place” on the default location which is also ok for me here.

If possible I want to avoid a local build system and some Ansible steps.

4. Error messages and/or full log output:

Not necessary.

5. What I already tried:

Installing caddy like recommended via cloudsmith, adding packages.

Yep, when you divert the binary, caddy upgrade and caddy add-package commands will replace the diverted binary and not the original one. It’s okay to run those commands after diverting. Just follow the steps outlined in the docs!

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