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:
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):
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:
- remove the
onOpendeclaration as I didn’t want a preview being opened in the in-browser version of VS Code when there is a valid URL that can be browsed to in a separate tab;
- add the
public_repopermission inside Gitpod’s integrations page to allow for committing straight back to the repository;
- add a VS Code
.vscode/settings.jsonfile in the root of the repository that among other things disables auto-saving4, which I didn’t want because I have the preview open in another tab and I don’t want it flashing all the time when I haven’t even saved the file yet;
- add a few extensions in the
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
Somewhat… it’s still (at the time of writing) not available to personal accounts. ↩︎
Actually I just want to pare down the various services I somewhat rely on, even if minimally. ↩︎
More information here: https://github.com/Homebrew/discussions/discussions/2941. ↩︎
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 ↩︎
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. ↩︎