Cybernoise: Creating my notes with Hugo, Github Action and Azure
I have the last couple of years been reading a lot of articles, blogs and posts learning about the current subject I am curious about. That inspired me to have a go at it!
I have since this moved to a self developed SSG using Nuxt3 and the Content module.
Writing
Hugo is a open-source Static Site Generator (SSG) which takes my markdown files and converts them into pretty HTML files. So I write my markdown files in Visual Studio Code, running a local Hugo server on my laptop and can have a look at how it all will look when published.
After checking out many themes for Hugo I settled for Chunky Poster, not to flashy nor to simple. What I like with Hugo is that everything I write in markdown, can be combined with different themes to create a whole different look by changing one configuration variable.
As everything is folders and simple files (not any binaries), it can also be added to my personal private GitHub repo with a simple commit and push. This way I get version controll aswell as the possibility to use GitHub Actions.
GitHub
Now my plan is to use GitHub Actions to build the files with Hugo and upload them to Azure so that it can be access over the Internet. The steps were:
- Grab the repository.
- Grab my choise of theme and place it correctly under the themes directory.
- Grab and intall Hugo.
- Change directory to the correct one, so that Hugo can properly generate the website files.
- Let Hugo generate the files.
- Authenticate a Service Principal to Azure using the variables in GitHub Actions.
- All the permissions the SP has is contributor to a Storage Account.
- Delete everything in the websites Storage Account conteiner.
- Upload all the generated static site files.
Azure
To host the notes I'm using:
- Azure Storage Account - Cheap storage
- Azure CDN - Distributing the files across the world, and just making it all fancier
Storage Accounts lets us host simple static websites from a container called $web. You get to choose the index and 404 file and are given an URL for accessing the site. Azure CDN let's us deploy the containers website easily, obtain and force HTTPS on all traffic and use our own domain.
Final words
Since you are reading this, it all does work. I plan to make a note showing how all this was done and a note once I have automated the whole process so anybody can deploy it and see how it all works. Even tho we do all this fancy use of tools and resources, I love how dirt cheap it is (around 50¢ per month). Thanks for reading!
Itj fårrå nålles,
HB