Jekyll Gallery Hosting pt8: automated deploy with git-annex
Today has been a mixed bag of stuff. For the next two weeks you can find the stream on my twitch channel.
Automated updates: Created a quick
post-receive hook to update the site when git-annex syncs:
#!/usr/bin/env ruby require "open3" pushed_refs = $stdin.readlines output, status = Open3.capture2e("git annex post-receive", stdin_data: pushed_refs.join("\n")) Dir.chdir('/srv/cheesy.at/git') system("bundle config set path /srv/cheesy.at/gems") system("bundle install") system("JEKYLL_ENV=production bundle exec jekyll build --strict --trace --destination /srv/cheesy.at/site --verbose --incremental")
This does the
git annex post-receive default updates which (I assume) put all the files in place.
Afterwards it configures the gem cache,
installs the bundle,
and runs a incremental site build.
On my tests with
git annex sync --content this worked fine and updated the test site with the new files.
Public test site: I’ve also puttered around with adding a new site
test.cheesy.at to host the in-progress work, but screwed up the DNS configuration and am still waiting on Let’s Encrypt’s verification systems to refresh their cache.
Luckily this refresh happened while I was still here, so https://test.cheesy.at/ is now deployed and secured.
See the following commits for some more tweaking required to get it working.
The actual private keys are deployed through a separate private repo that is not shared.
Persistent SSH hostkeys: Finally I’ve added some code to the Dockerfile to preserve ssh host keys across rebuilds. The keys, again, are stored outside the published repo. Without this change, everytime a new version of the docker container is started, it would give nasty errors about the SSH host keys being changed.