WordPress the Easy Way
All it takes is VersionPress
26th Feb 2019
WordPress the Easy Way
As many agencies do, Isobar uses WordPress for a number of its internal sites and for client work. Developing and administering WordPress can be painful, especially when it requires us to have a team of developers and the ability for a developer to run the site, content included, on their system, so they can reproduce issues caused by content or configuration. However, it doesn’t end there. We also need multiple content authors, multiple environments, such as staging and production, and the ability to roll back any problematic changes that might occur — content, code, or configuration — with ease.
In order to circumnavigate this painful process, I developed a solution to make things easier: VersionPress on AWS. It uses Docker to allow developers to run the site locally and an assortment of AWS services to host the site.
So, first things first, what is VersionPress?
VersionPress stores content and code (themes, plugins, configuration, etc.) in source control. By using this approach, you only need to check one place for all changes: the git log. Since everything is in git, the hosting environment can be wiped out and recreated at any time, without data loss because it can all be restored with data from git. Because of this, there’s no need to worry about backing up MySQL/MariaDB database, files or, anything else, for that matter.
Another advantage of VersionPress is that you can easily produce a test site by creating and deploying a git branch. Thesite can also be run locally on a developer system with ease as an exact mirror of the production site, making debugging and development far easier – no more “works on my machine” situations.
Now that you know what VersionPress is, we need to think about the hosting environment…
That’s where AWS comes into play.
Need a small, cheap staging site, but also a full fledged scalable production site with a Content Delivery Network (CDN)? Use the same stack for both. All you need to do is specify different parameter values. And, you can change parameter values whenever you want without downtime or data loss. For example, when starting out, leave the CloudFront CDN off to save money. When the site becomes more popular, add in the CloudFront CDN to better handle the load and improve performance for end users.
AWS features leveraged include:
- Elastic Beanstalk for dynamic scalability, self healing, and rolling deployments
- Multiple available zones within a region for high availability
- Amazon RDS for MariaDB as a low maintenance, high performance, highly scalable database
- Elastic File System for file storage shared among any number of servers as scaling demands
- Route 53 for DNS management
- AWS Certificate Manager for HTTPS certificate management
- CloudFormation for deployment and updating of the stack
- Optional CloudFront CDN
Having established WordPress+VersionPress+AWS as a solution, the next questions we need to look at are “How is AWS hosting actually implemented?” and “How do developers run this on their systems?” The key to those answers is with Docker..
Docker is used to run WordPress in AWS Elastic Beanstalk as well as by developers running the site locally. This consistency reduces the occurrences of “it works on my machine” situations and gets new developers on-boarded quicker.
Of course, while this is a solution for many instances, it isn’t always the right answer to run VersionPress on AWS.
Because VersionPress commits all content changes to git, these changes can become a good bit slower. Therefore, if the site is content-change-heavy, such as a forum with many frequent comments being made, VersionPress on AWS may not be the right solution. In that case, hosting on AWS without VersionPress and incurring the more traditional manual database and code synchronization complexities is warranted.
That said, the vast majority of WordPress sites have very infrequent content changes, so the slightly slower writes are rarely an issue.
Now, it’s time to get started!
Check out the VersionPress on AWS documentation to get going. To note, setup on AWS involves configuring Route 53, setting up HTTPS certificate from AWS, and deploying the providing CloudFormation stack.
I think you’ll find that life becomes a little bit easier with this solution.
VersionPress on AWS is Free Software under the GPLv3 hosted at gitlab. Contributions in the forms of issue reports and pull request are very much welcome.