/ Üllar Seerme

Replacing a CMS using Gitpod

October 26, 2022

For a while now I’ve been using Forestry as a simple CMS that hooks into this website’s repository as a way to nicely be able to write blog posts when I am not near my main machine. The benefits where that I had a fairly good WYSIWYG interface for writing Markdown and then being able to directly preview it by having Forestry build the changes immediately using Hugo. For sites that rely on multiple people editing a single site or a site with sub-sites it’s probably way better than what I’m about to introduce here, but for me it was time to sunset its usage.

As far as I know Gitpod is the OG in the space of remote development platforms with GitHub’s Codespaces hot on its heels1. While it definitely makes most sense for projects where the process to set up should be abstracted away as much as possible to make collaboration between people easier, I still felt I could use this service to improve upon my own workflow as well. While I would have actually liked to use GitHub’s solution for this to keep myself in its walled garden (/s)2, this was so simple to set up that I figured it was worth it anyway.

To get started just add a .gitpod.yml to the root of the repository, as such:

1
2
3
4
5
6
7
8
tasks:
  - name: Install Hugo dependencies
    before: brew install hugo
    init: echo "Your version of Hugo is `hugo version`"
    command: hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
ports:
  - port: 1313
    onOpen: open-preview

This is seemingly the official template, but right out of the gate I wanted to use the same version of Hugo that I use for my live website and doing that with brew was a chore on top of being awfully slow to install everything3. So here is what I came up with instead (shown as a diff):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 tasks:
-  - name: Install Hugo dependencies
-    before: brew install hugo
+  - name: Install Hermit and Hugo
+    before: |
+      curl -fsSL https://github.com/cashapp/hermit/releases/download/stable/install.sh | /bin/bash
+      export PATH="/home/gitpod/bin:${PATH}"
+      pushd ~
+      mkdir hermit-packages && cd hermit-packages
+      hermit init
+      . ./bin/activate-hermit
+      hermit install hugo-0.88.1
+      popd
     init: echo "Your version of Hugo is `hugo version`"
     command: hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
 ports:

I’m using Hermit as the package manager as I know that is extremely straight-forward because it heavily relies on just pulling binaries instead of resolving any dependencies, installing those, etc. By the time the workspace has booted up everything is already set up and running.

After saving that YAML file just authenticate Gitpod and create a new workspace. It will then discover that file, set everything up accordingly, and present you with VS Code in your browser (other options are available as well). It really is that easy! After that I just had to make some minor modifications:

1
2
3
4
vscode:
  extensions:
    - Catppuccin.catppuccin-vsc
    - file-icons.file-icons

While I’m fine with just writing in VS Code, I am sure there are extensions out there that turn VS Code more into what an actual writer might use so there’s tons of potential here. Now I, myself, can just hop in any browser, fire up a workspace in Gitpod, enter Zen mode in VS Code and get cracking!5


  1. Somewhat… it’s still (at the time of writing) not available to personal accounts. ↩︎

  2. Actually I just want to pare down the various services I somewhat rely on, even if minimally. ↩︎

  3. More information here: https://github.com/Homebrew/discussions/discussions/2941↩︎

  4. This is just a subset of the configuration I have locally as other things don’t make sense to have (i.e. Python-specific settings): https://github.com/usrme/website/blob/master/.vscode/settings.json ↩︎

  5. The entirety of this post was written using the power of the cloud; how very modern! Though I weep inside that I my shitty little blog takes up some extra amount of physical hardware somewhere… I may just scrap this sooner than I think. ↩︎

Page history