A lot of people think I don’t like Docker, and I’m here to tell you that’s not true. In fact, I feel like a magician about to show his huge magic trick of the show. In the next couple hours this blog post will be live along with a huge framework… Let me tell you about it.
You’re currently reading an html webpage, generated with the power of Hugo and golang. It’s served to you by Caddy, a modern http2 server with built in hugo/fpm support.
This content was originally written in WordPress and rendered via a custom plugin through a tight feedback loop using Docker, gitlab CI, and Rancher. Any updates to the underlying configuration goes through the same CI steps. It currently takes about 2-5mins from the push of the publish button to seeing it live on the site.
The site is hosted on Bare Metal with a cluster size of 2 (about to be 5), running Rancher and Docker.
Originally, when I thought I was going to make WordPress scale to epic proportions, I thought it would be a regular scaling problem… man was I wrong. Scaling WordPress isn’t hard, it’s scaling it on a budget that’s hard. One thing that scales really well though, is scaling static files.
I looked at several different implementations, and with some good guidance from a coworker, I found Hugo. Hugo is amazingly fast and has some awesome capabilities built in. For example, it knows how to talk JSON to retrieve content, how to highlight source code, and some other cool things I can’t remember right now.
WordPress allows me to use a WYSIWYG editor to create my post. When the post gets published, it goes through an html-to-markdown conversion, via a small api using rethinkdb. Then the api calls a webhook in gitlab to rebuild the images. Using some Dark Docker Magic, the images are rebuilt in a Docker In Docker (docker:dind) and cached throughout the cluster. After the build, gitlab starts a rolling update throughout the cluster and the post goes live.
If you’re reading this, then it was moderately successful. I’m about to push the publish button and will likely spend some time manually pushing it through the process… nothing ever works the first time in production!
2 responses to “Husband + Dad + Docker + WP + Hugo == this”