I recently evaluated what how writing content and carving out a little personal space on the internet would look like for me and came up with a list of requirements:
- Own my content (No third party platforms as only distribution method. There was a time before medium and there will be a time after medium. Speaking of which, if you want to see the result "in action" you can find this article on my blog: https://rhazn.com/posts/deploy-a-personal-blog-with-hugo-firebase-and-gitlab/ ;))
- Easy to set up and maintain (I don't want to set up and host databases or complicated CMS systems and when I come back to this in a month it should be easy to update.)
- Long term secure storage (By not hosting my content with a third party but in git I can easily back it up, keep old revisions and there is no worry of the hosting provider going down.)
All these requirements are solved by using a static site generator and keeping the original files versioned in git. When setting up some for of continuous integration (for example with gitlab) it should be reasonably easy to maintaining for a long time.
I chose gohugo as a site generator due to the excellent setup article written by Fabian Gruber here: https://www.fabiangruber.de/posts/setup-and-deployment
I set up an automated build using gitlab using the following gitlab-ci.yml:
This uses a docker image for Hugo and builds the static page from the sources provided.
I chose firebase to host the website because I have previous experience with it. It is very easy to create and deploy a static website as well as wire it up with a HTTPS domain.
After creating a new project in firebase you'll need to get a token that allows gitlab to make deployments on your behalf:
Set it up as a secret variable in gitlab called "FIREBASE_TOKEN".
To add firebase to the gohugo project navigate to the directory in the CLI can call:
Armed with the token that allows gitlab to deploy in your name as well as a configured firebase project we can add the last step to the gitlab-ci file - deployment.
You can see the full gitlab-ci.yml file here:
I am a full stack developer and digital product enthusiast, I am available for freelance work and always looking for the next exciting project :).