From aaf81459cc6d3f9757f055c317158ac32c0cec39 Mon Sep 17 00:00:00 2001 From: wchargin Date: Wed, 13 Dec 2023 19:45:02 -0800 Subject: [PATCH] build: Suggest restarting service to load custom modules (#350) I followed these instructions on a fresh Debian 12 box, seemingly successfully. But `systemctl reload caddy` would reject my Caddyfile that tried to use those custom modules, logging "unknown module" errors, even though `caddy list-modules` reported that they were installed. After reading [a comment on `caddyserver/cache-handler`][c], I tried running `systemctl restart caddy`, which immediately fixed the issue. In retrospect, it makes sense that since `apt install caddy` starts the systemd service, replacing the binary on the filesystem does nothing to change the running server. But the instructions didn't suggest this, and I'm used to only `reload`ing Caddy, so I didn't think of it myself. [c]: https://github.com/caddyserver/cache-handler/issues/33#issuecomment-1234457086 wchargin-branch: custom-build-systemctl-restart wchargin-source: 91f0cc15ae1eb8143fccc271e7aa2ecae5bc3da8 --- src/docs/markdown/build.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/docs/markdown/build.md b/src/docs/markdown/build.md index ecc8ef7..78429bf 100644 --- a/src/docs/markdown/build.md +++ b/src/docs/markdown/build.md @@ -85,6 +85,7 @@ Procedure: sudo mv ./caddy /usr/bin/caddy.custom sudo update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10 sudo update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50 +sudo systemctl restart caddy @@ -92,6 +93,8 @@ Procedure: `update-alternatives` will create a symlink from the desired caddy binary to `/usr/bin/caddy` +`systemctl restart caddy` will shut down the default version of the Caddy server and start the custom one. + You can change between the custom and default `caddy` binaries by executing
update-alternatives --config caddy
-and following the on screen information. +and following the on screen information, then restarting the Caddy service.