This blog is simple: some .md
files, generated to static HTML. No backend or complex
CMS. It’s light, loads fast, and readable-enough on mobiles (except code-blocks).
Versioning is done on git.
But it had one drawback: “high” cost to publish.
Building is done using Jekyll, and then pushing files to an FTP server. Since I publish rarely, I had no warm setup. Sometimes my ruby installation was broken, sometimes some dependency were broken. Once built, pushing to the FTP was a mix of FTP fuseFS + rsync (My OVH hosting had to ssh/sshfs access). As always with manual intervention, error could happen!
Anyway, I had some free credits on GCP, so tried Cloud Builder (used it in the past to setup CIs), and quickly stopped. Goal was to simplify the whole process, and using GCP is not going the good direction.
Found out about Firebase, decided to give it a try (spoiler: blog is hosted on Firebase as of today). And it had everything I need: It’s fast, simple, and absolutely cheap for my use-case!
Deploying the website was simple:
$ firebase deploy
This combined with a GitHub workflow, spinning a ruby
docker, building the website and pushing to firebase:
'on':
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare tree
run: 'mkdir build'
- name: Build docker image
run: 'cd docker && docker build -t builder . && cd ..'
- name: Build website
run: 'docker run -t --rm --mount type=bind,src=/home/runner/work/blog/blog,dst=/mnt/src --mount type=bind,src=/home/runner/work/blog/blog/build,dst=/mnt/output builder'
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '$'
firebaseServiceAccount: '$'
channelId: live
projectId: blog-1234
This also brings another advantage: Github becomes my CMS. I can write a new article as long as I have some Github access. Which is quite convenient!