I wanted to be able to deploy this blog via git, onto a little Caddy server. Approach

  1. have a bare git repo to push to
git clone --bare $repo
  1. Have a hooks/post-update in that repo that rebuilds the site
export GIT_WORK_TREE=/home/psn/homelab
git checkout -f main
cd /home/psn/homelab
./copy.sh

This git checkout -f comes from these docs.

  1. Have the copy.sh rebuild the site with jekyll and copy it to a new dir.

  2. Fix up permissions in the directory.

  3. Have a symlink in the caddyfile config, change what the symlink is pointing to.

  4. delete the older copy. I only delete copies older than 1 day.

All I need to do is to push to the bare repo.

I also looked at having caddy change root with the caddy API. Below snippet looks promising, however I would need to patch one of several routes, which did not appeal.

curl localhost:2020/config/apps | jq | less