10up partners with Joyent to bring WordPress to Docker
We’re proud to announce that 10up has partnered with Joyent to bring WordPress to their Docker infrastructure.
Joyent, an Infrastructure-as-a-Service (IAAS) company providing software to power their—and their clients’—cloud platforms, knows the difficulties in prepackaging software installations that can be readily moved across server environments. To solve this, Joyent uses Docker, a technology which packages an application with all of its dependencies into a standardized unit for software development. In plain terms, it creates a fully assembled, preconfigured, and portable software environment.
Docker offers several practical benefits for teams building websites and applications using repeatable configurations and industry best practices like testing environments. First, as simple as the WordPress famous 5-minute install is, it results in a default, out-of-the-box configuration; Docker helps engineers fast forward past the remaining configuration. Second, it ensures that multiple installations (local, staging, production, separate servers) mirror each other, so as to allow worry-free code deployments. We made inroads in solving this problem with Varying Vagrant Vagrants, and Docker takes that solution a step further.
Docker works by creating modular snapshots of preconfigured applications, called containers, that enable easily scalable hosting. If a site built with Docker containers experiences a spike in traffic, a host like Joyent can replicate any overtaxed container, such as a database server or web server, “horizontally” scaling the infrastructure to weather increased load. When the spike subsides, the virtual servers can be scaled back down just as simply. Because Joyent offers a “pay per minute” hosting model, this empowers site administrators to quickly and temporarily scale up their infrastructure during a surge without incurring a longer term cost increase.
10up created a Docker Compose project, housing several Docker containers which work together to create a scalable, complete WordPress stack, which includes the following containers:
- Nginx: load balancer to spread traffic between all backend WordPress containers;
- WordPress: based on the official Docker PHP 5.6 container image and extended to install and configure WordPress;
- Memcached: caches often-used data in memory. Based on the official Docker memcached image and integrates into ContainerPilot so memcached can announce its location to the rest of the cluster;
- NFS: single store for uploaded files, accessible from multiple WordPress containers;
- MySQL: database for WordPress;
- Consul: service discovery platform through which containers register and communicate with one another to build the project.
The open source project is available on GitHub. If you’re looking for expert consulting on integrating WordPress with Docker, get in touch.
Zach Russell on
This is awesome! I was working on a project using docker-compose w/ docker swarm (and colsul) a few months ago. One problem I ran into was that I couldn’t add a new app server to the app without having to reload HAProxy (which I was using for the load balancer). How does that work with this project – will their be any downtime/dropped requests on docker-compose scale?
Jason DeWitt on
I am not an expert on HAProxy, but I assume it works similarly to the nginx load balancer we are using in this project. We use Consul, Consul Template and Container Pilot to detect that a new app server has been scaled out. ContainerPilot watches the Consul service category for a configurable set of services on each Docker container. In this example when the nginx container detects a new WordPress app container has been scaled out, it fires a script that calls Consul Template to rewrite the nginx config to include the new server and reloads. The downtime/dropped requests would be dependent on your load balancing layer, in this project there is none because we do a graceful reload of the nginx config, rather than a full restart.