diff --git a/src/docs/markdown/build.md b/src/docs/markdown/build.md index 15fab8c..17c07ba 100644 --- a/src/docs/markdown/build.md +++ b/src/docs/markdown/build.md @@ -64,3 +64,30 @@ Or similarly for Linux ARMv6 when you're not on Linux or on ARMv6: The same works for `xcaddy`. To cross-compile for macOS:
GOOS=darwin xcaddy build
+ +## Package support files for custom builds for Debian/Ubuntu/Raspbian + +This procedure aims to simplify running custom `caddy` binaries while keeping support files from the `caddy` package. + +This procedure allows users to take advantage of the default configuration, systemd service files and bash-completion from the official package. + +Requirements: +- Install `caddy` package according to these [instructions](https://caddyserver.com/docs/install#debian-ubuntu-raspbian) +- Build your custom `caddy` binary according to the procedure listed in this document. (see above) +- Your custom `caddy` binary should be located in the current directory. + +Procedure: +
dpkg-divert --divert /usr/bin/caddy.default --rename /usr/bin/caddy
+mv ./caddy /usr/bin/caddy.custom
+update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10
+update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50
+
+ + +`dpkg-divert` will move `/usr/bin/caddy` binary to `/usr/bin/caddy.default` and put a diversion in place in case any package want to install a file to this location. + +`update-alternatives` will create a symlink from the desired caddy binary to `/usr/bin/caddy` + +You can change between the custom and default `caddy` binaries by executing +
update-alternatives --config caddy
+and following the on screen information. diff --git a/src/docs/markdown/install.md b/src/docs/markdown/install.md index 77a8bdb..e42e471 100644 --- a/src/docs/markdown/install.md +++ b/src/docs/markdown/install.md @@ -61,6 +61,8 @@ Testing releases (includes betas and release candidates): [**View the Cloudsmith repos**](https://cloudsmith.io/~caddy/repos/) +If you wish to use the packaged support files (systemd services, bash completion and default configuration) with a custom Caddy build, instructions can be found [here](https://caddyserver.com/docs/build#package-support-files-for-custom-builds-for-debian-ubuntu-raspbian). + ## Fedora, RedHat, CentOS Fedora or RHEL/CentOS 8: