Repository navigation
Mount Caddy's folder so a deploy's Caddyfile reaches it - #38
Merged
Merged
Conversation
The deploy replaces the Caddyfile with a new file, and Caddy saw it through a single-file bind mount, which stays on the old file: every reload read the first Caddyfile, so the Permissions-Policy from #36 never reached the site (ZAP's first run failed on it). Caddy now mounts deploy/caddy/, which shows the new file, and the monitoring job validates the Caddyfile.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The bug
The first ZAP run failed:
Permissions-Policy(#36) was in the Caddyfile on the server, but not in the site's answers.deploy/withtar, which replacesCaddyfilewith a new file (new inode)../Caddyfile:/etc/caddy/Caddyfile). A single-file bind mount stays on the inode it was given, so the container kept seeing the original file.caddy reloadindeploy.shhas re-read the first Caddyfile on every deploy. No Caddyfile change has ever reached the site.The fix
deploy/Caddyfilemoves todeploy/caddy/Caddyfile, and Caddy mounts the folder (./caddy:/etc/caddy:ro). A folder mount shows the new file, so the reload, which drops no connections, reads it.caddy/instead ofCaddyfile.monitoringjob now also runscaddy validateon the Caddyfile, with the Caddy version fromcompose.yaml.backup.sh,offsite.sh) are fine: their containers are restarted on each deploy, and a restart mounts the new file.Checks
docker:dind), doing what the deploy does (tar, thencaddy reload):caddy validate, actionlint and shellcheck pass.After the merge
Compose recreates the Caddy container, because its mount changed. That means a few seconds without the site. The old
/opt/extpulse/Caddyfilestays on the server unused and can be deleted. Once deployed, re-run the ZAP workflow.