Node.js® Enterprise Support
New comprehensive plans availableLearn More
Thank you for contacting us. We will get back to you shortly.
May 05, 2016 - by Casey Bisson
WordPress, the user-friendly blog-oriented CMS that powers 25% of the web1, is famous for its 5-minute install2, but that's only for a single server with no scalability. Containerization and the Autopilot Pattern change that, however, and now we can deploy a WordPress website and scale it to meet any amount of traffic with a single command. This isn't a PaaS, this is your own WordPress install that you can completely customize with your own themes and plugins.
tl;dr: Try it for yourself right now.
Together with 10up, a digital agency with deep WordPress expertise (and some WP core committers), we developed a fully Dockerized implementation of WordPress that makes deploying and scaling WordPress on any compatible infrastructure a snap. Using the Autopilot Pattern and ContainerPilot, all the components automatically configure themselves on deploy and reconfigure themselves as you scale up and down.
The automated operation of the Autopilot Pattern makes running applications easy. When we demonstrated that ease of operation with a Node.js app backed by Couchbase that automatically configures itself on deploy and as you scale the components, many pressed us with the challenge that it was only possible because we were using modern applications. We took up that challenge when we Dockerized MySQL with the Autopilot Pattern and now again with WordPress.
In addition to the WordPress container, a complete site includes the following containers (all containers are launched automatically using Docker Compose):
You can run multiple instances of most containers to scale for any amount of traffic. The MySQL containers will automatically configure as a cluster with a single primary and multiple replicas, and the WordPress image includes HyperDB to best utilize the MySQL cluster. Everything is automatically configured when you launch the containers, and reconfigured as you scale (or if a container fails), so running a scalable WordPress site is no more complex than running without the scaling features.
The images will run anywhere you can run Docker, but you can run them on Triton without having to setup and manage Docker hosts. Here's how to get started:
docker-compose) on your laptop or other environment
triton profile createand
triton account update triton_cns_enabled=true, then
eval "$(triton env)"to configure your environment and connect to a Triton data center
./setup.sh ~/path/to/MANTA_SSH_KEYand edit the
_envfile to set the Manta object store configuration details for the MySQL backups
docker-compose up -dto launch WordPress
_envfile (powered by Triton CNS, see how to use a custom domain name)
docker-compose scale nginx=2 wordpress=3 memcached=3 mysql=3to scale
The full details on the configuration options are in Github.
The WordPress image includes WP-CLI. Using that in combination with
docker exec makes remote management especially easy. In the following examples,
wp_wordpress_1 is the name of a running WordPress container in this project.
Set the display name of the admin user (user ID
docker exec wp_wordpress_1 wp --allow-root user update 1 --display_name='<name>'
On a Mac, this will open a web browser with the front page of the web site:
open $(docker exec wp_wordpress_1 wp --allow-root option get home)
If you imported the sample content, this command will delete the sticky post at the top of the site:
docker exec wp_wordpress_1 wp --allow-root post delete 1241
Inserting posts is easy too. In this example,
sample-post.html is a file on my laptop with the content of the post I want to publish:
docker exec wp_wordpress_1 wp --allow-root post create \ --post_content="$(cat sample-post.html)" \ --post_title='<post title>' \ --post_status='publish' \ --post_author=1