How to deploy a hardened WordPress site to Kubernetes using Ansible.
Previously I’ve discussed the basics of init containers and shown how to deploy WordPress locally. But if you’ve already got a domain handy and are ready to move your WordPress site to a staging or production environment please continue. I’ll use Digital Ocean but you could use any hosting provider you like so long as you can use them to deploy some VPS instances for yourself during the setup below. I’ve been using this method to host Chicago Gang History for over three years.
Guide assumes you are not using a "managed" K8s solution or cloud provider and want to create your own cloud using VPS instances you manage yourself.
When you are finished you will have a hardened WordPress site deployed to Kubernetes using Ansible capable of handling up to 80K users per month.
Ported second generation Chicago Gang History website from Pantheon to a multi-node K3s cluster on Digital Ocean, saving Zach over $400 a month in fees after an
unexpected price hike from his hosting provider.
How to move a Pantheon WordPress site to K8s and save $400+ a month on hosting.
When I discovered Pantheon in early 2017 I thought I’d found an a hidden gem. The honeymoon ended when Pantheon hiked costs 40% (while taking away Redis) after about six months on their platform. That was a bummer, but not a deal breaker.
Fast-forward three years and Pantheon struck again. Only this time intead of instead of another 40% increase they went for the whole cookie jar with a jaw-dropping 1185.71% increase to $450 per month with a 10-day lead on the bill.
With little time to react to Pantheon’s change I did the most reasonable thing I could think of: let the site go down while I learned to move it to Kubernetes.
Get site back up-and-running with the least amount of effort
Eliminate visitor-based pricing imposed by hosting company
Use minimum possible resources to run WordPress at scale
Restore Redis cache Pantheon used to offer with $25 hosting
The rest of this post describes how I moved the Chicago Gang History WordPress website off Pantheon and onto Kubernetes. If you follow this guide, you can retrace my footsteps to migrate from Pantheon to Kubernetes too. At the outset you’ll have a 3-node WordPress cluster on
Digital Ocean for $30 a month.
How to create a hardened WordPress installation in Kubernetes using Init Containers and Helm on MacOS.
Last week Pantheon dealt the final blow to the website I drove from 100 visitors up to 80,000 per month. By the time I heard the death knell we had a 10-day advance notice the price of hosting was increasing 1025% to $450/month.
I quickly spun up a Plesk instance on
Digital Ocean and installed WordPress on a $10/month VPS but realized Plesk was too bloated for our needs and probably not going to cut the mustard in the scale department should traffic decide to climb.
After initially attempting to deploy Wordpress using the Helm chart by Bitnami via the App Marketplace in Rancher 2.5 I found the chart difficult to use, kept looking and eventually found a
an alternative chart on a self-hosted VCS.
Like the Bitnami chart the independent chart includes optional database set-up. Unlike the Bitnami chart, however, the self-hosted chart also includes a Redis object cache, OpenID Connect authentication. It also builds a hardened WordPress Pod using WP CLI from scratch with Ansible inside an
Init Container. And in this tutorial I’m going to show you how you install it on macOS with K3D.
Prepare for Ludicrous Speed with a 300% improvement in page load time.
After giving a talk once in Bali – where I showed how to use a $5 Vultr box and Redis with
Load Impact to support up to 7000 concurrent WordPress users – I was asked to help turn some of the performance optimization work demoed into a WordPress plug-in.
It’s the first of it’s kind — and like no other performance plugin to precede it. Based on initial tests it speeds up the stock Twenty Seventeen theme about 300% and I suspect time will show even greater gains for other themes. It builds on top of a performance optimization technique called Fetch Injection, enabling external scripts to download asynchronously in parallel while preserving execution order.
Jekyll migration to WordPress, premium hosting, custom relational database, newsletter, contact form and AdSense integration.
:: WordPress / Pantheon / Route 53 / CloudFront
After 7-8 months the Jekyll version of Chicago Gang History we started seeing some scaling issues with media assets on
CloudCannon. Rather than hacking it I instead worked with CGH author Zach Jones to perform a complete site redesign, leveraging existing ad revenue to migrate them to WordPress self-hosting.
The redesign was very successful and inbound search traffic continued to lift. A year following the redesign homepage hits are now greater than 70K per month.
Create your own web-based chat app using Redis, Docker and Go.
For several weeks I’ve been thinking about how to go about creating a chat application. After a knowledge drop from
Kent Safranski I was inspired to stand-up the chat app using
Redis. For the experiment I decided to use Go given the
concurrency affordances baked into the language. So I took
A Tour of Go and hit the blogs to see what I could find in the open source community.
Redis, Go, & How to Build a Chat Application made me aware of
Redigo, a Go client for Redis, and helped demystify use of Redis’
PubSub with Go. The article was a solid introduction and did a great job breaking things down, but ultimately left me wanting a prototype to try things out on the Web. After some more sleuthing on
DuckDuckGo I discovered an
open source demo app meeting my requirements and providing a great sandbox for experimentation.
In this article I’ll cover how to create a chat application which uses Redis and Go by leveraging open source software and Docker, and use Ngrok to expose the app to the Web over HTTPS.