Hello Static World
I set out to refresh my portfolio and decided to document my journey to the realm of Static Site Generators. Gatsby was chosen as the initial route, as it is a popular modern option for those accustomed with the Node and React ecosystem. However, insurmountable memory issues during production deployment led me to reconsider that choice.
Then I reverted the course to trusty old Jekyll, which has kept this ship afloat for almost a year. But since lately I’ve been venturing into Go, Hugo offered a solution that is both lightweight and more streamlined, so I took the plunge.
In the first leg of my journey, I spent a couple of days getting accustomed to Gatsby’s intricacies while thinking about the design and navigation. Being familiar with JSX and React for templating, GraphQL was the only backend abstraction I had to dust off a bit. But its setup is done out of the box and the available plugins allow for painless implementations of features like image transformations, SEO, and so on.
Things were smooth until deployment. I had ran gatsby build
successfully on two different machines, but production was a different story. The task Building Rendering Engines ended with a cryptic error message: “Killed.” Investigating further, I found an Out of memory error in the dmesg
logs:
[4542229.417528] Out of memory: Killed process 944275 (node) total-vm:54149044kB, anon-rss:658952kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:13252kB oom_score_adj:0
My server has a meager 1gb ram, which had been enough so far for running my simple projects in Node, Ruby and Python. But apparently deploying Gatsby takes more than that, so I rewrote the project using Jekyll and it built on production without a hitch for more than a year.
Still, it felt like settling. So I decided to give Hugo a try since it’s written in Go, which is a language I’ve been learning of late, known for being lightweight and fast. The setup was a breeze, documentation is very thorough, and the build process is blazing fast. Also, it had this nice theme called Terminal, which I was able to adjust for my project in a matter of hours.
My odyssey from Gatsby to Jekyll and finally to Hugo has been both enlightening and fulfilling. Each platform has its merits, but Hugo struck the best balance of easiness, power and efficiency for me. It’s a testament to how finding the right tools can not only meet your requirements but also enrich your entire development experience.