git deploy
I wanted to be able to deploy this blog via git, onto a little Caddy server. Approach
- have a bare git repo to push to
git clone --bare $repo
- 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.
-
Have the
copy.sh
rebuild the site with jekyll and copy it to a new dir. -
Fix up permissions in the directory.
-
Have a symlink in the
caddyfile
config, change what the symlink is pointing to. -
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