Deploying Roots WordPress tools on Binary Lane

5 May 2016 #Code

After coding WordPress sites the same way for a few years now (MAMP + BlankSlate theme) I decided it was time for a change.

The Trellis, Bedrock and Sage projects from Roots took my interest. These allow you to build sites on reliable-old WordPress but using all the wonderful new development tools that I’ve never had a good reason to play with.

Trellis creates a virtual machine to develop your site in and allows you to deploy it to your host. It’s designed to work out-of-the-box with SSD cloud hosts DigitalOcean, and it does!

I started this as a complete novice to the world of Git, LEMP stacks, Ansbile … let’s just say pretty much everything Trellis is built on. So I found it challenging enough to just get a site deployed to DigitalOcean as intended. This tutorial, though slightly outdated helped, combined with some great help from the folks in the Roots forum.

The problem is, as of writing, DigitalOcean don’t have a server here in Australia. Which isn’t great for my Australian clients” Search Engine Optimisation and page load times.

The local alternative is Binary Lane, with servers in Brisbane and Sydney. But not all hosts are created equal so I had to make some modifications to Trellis to get it all to work. Once the below changes were made I deployed a WordPress site via Git to local SSD cloud servers with an A+ SSL certificate and super-fast page load times, with a smile!

Again, I am no expert, but the following got my site up and going. For Trellis-specific help you’re still better off asking the Roots forum. But these may help you on your way.

1. Follow the Roots Example Project

Combined with the tutorial above, I found the Roots Example Project page simpler to follow than the official docs. The official docs go into every conceivable configurable detail. You really only need the basics setup to be able to do your first deploy.

If this is your first time using these Roots tools, try getting a deploy up and going on DigitalOcean first. Then start a completely new project but make these edits to deploy to Binary Lane.

2. Add extra bits to Ubuntu

The standard Ubuntu install on Binary Lane is missing some necessary components. Again, I’m no expert, so I can’t explain to you why they’re missing or what they do. But add these two lines to this file and the deploy should work.

Open ansible/roles/common/tasks/main.yml

Under with_items: add:

systems-services fixes a timezone error, util-linux fixes a “fallocate” error.

3. Disable Port Blocking and add rules

Login to the Binary Domain “mPanel” and from the sidebar disable Port Blocking. It is enabled by default and blocks SSH Agent Forwarding, which Trellis needs to copy your GitHub repo to the server.

After consulting with Binary Lane’s support they directed me to the mPanel Firewall page where you can add custom rules. Insert the following below as a new rule and it will add all the default Port Blocking rules while allowing SSH Agent Forwarding.


4. Edit “sudoers” to solve “Reload php-fpm” issue

The last problem I had with deployment was the deployment script getting stuck on this command. Turns out Trellis is configured attempt this as a user which does not have permission to do so by default. It writes a exception rule, but this wasn’t being included by default on my Binary Lane server.

You need to edit the file etc/sudoers by SSH”ing into the server as root and typing visudo

Add the following line to the end of the file…

#includedir /etc/sudoers.d

…ensuring there isn’t a space between the # and includedir, otherwise it will be treated like a comment.

…it worked for me!

One last time, I’m no expert, but hopefully these updates should help you deploy a WordPress site with Roots awesome tools, right here in Australia.