conference wordpress site (part 1) – hosting and plugins

In May 2016, a well motivated group of Toastmasters in Prague and Brno, teamed up to organise a “Toastmasters Leadership Institute” conference, in less than 2 months. In this mini series I explain the steps I took to get the web site up and running.

Fact: with less than 2 months to go and a tight budget, you can’t get fancy with the web site! This is why we decided to adopt WordPress.

Hosting

For this particular event I used Windows Azure (cloud offer by Microsoft) creating a Virtual Machine size A2 Basic, based on CoreOS, in the Frankfurt datacenter (closest datacenter to our main audience).

The A2 Basic instance (2 cores, 3.5 Gb RAM, 60 Gb disk, about 70$ per month) might seem pricy and oversized, but the site needed to stay up only for 2 months, with bursts of traffic driven by our PR campaigns.

CoreOS is a linux distribution that comes with Docker preinstalled. It makes sense to use CoreOS only if you want to run dockerized applications (like in this case). Otherwise, rather go with Ubuntu or CentOS.

WordPress has an official docker image, and in its documentation it also features a docker-compose yaml file to spin a MySql (MariaDB) container together with the WordPress container, linked and configured. You might want to change your password, and if you have some time, figure out how to add SSL support.

Make sure to tune the restart policy of your docker containers. The 2 outages I experienced could have fixed themselves had I set –restart unless-stopped (or always) .

How to deploy WordPress using Docker on Azure

Plugins & Theme

  • Theme – Zerif Lite : Clean, with a captivating landing page. Customisations require you to know CSS and HTML, and to understand PHP. I know nearly nothing about PHP, but after years of web development I’m pretty comfortable with spotting logical constructs 🙂
  • Sucuri Security – Auditing, Malware Scanner and Hardening : this security plugin contains a number of functionalities to reduce the attack surface of your WordPress site. WP sites are far to vulnerable to scripted attack. Hardening your installation is a sensible move.
  • WordPress Backup to Dropbox : this plugin will backup your site (code files, media and database) seamlessly to your dropbox account. This way, should your site fall for an attack, you will be able to restore it without having to rebuild everything from scratch. Be sure to practice the restore on another installation of WP! Not having backups is bad…not knowing how to use your backups is stupid!
  • Google Analytics : this allows you to inject the tracking code that Google Analytics uses to monitor the traffic that goes through your site.
  • All-in-One WP Migration : this plugin is designed to migrate your entire site to a new installation, with just a couple clicks. It can be an effective backup strategy, with fairly easy recovery.

 

Part 2 – load testing and monitoring

how to deploy WordPress on Windows Azure using Docker

Step 1: Create a VM on Azure

In portal.azure.com click the “+ new” icon at the top of the left toolbox, and choose the CoreOS Linux (Stable) image.

CoreOS VM image

Create the VM using the Resource Manager wizard. I prefer to use an SSH key instead of a weak username + password. Find the IP address of your newly created VM, you will find it in the Properties tab of your VM object

Step 2: SSH into the VM 

On Windows I use PuTTY. This will give you a shell into your CoreOS machine.

Step 3: create the docker-compose yml file

The official WordPress Docker image documentation contains an example of yml file to start a MariaDB (MySql) container and a WordPress container, linked together, with passwords already configured.

Execute these commands

  1. touch docker-compose.yml
  2. vim docker-compose.yml

Now paste the content of the yml that you can find in the documentation, and “save and exit” from vim using :wq

Step 4: install docker-compose

just run this command to download the executable, and change its permission
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x ~/docker-compose

Step 5: run docker-compose

run this command to “compose” your containerized wordpress deployment. This will download the docker images of MariaDB and WordPress, will spin 2 configured containers, and link them together.

sudo ./docker-compose up -d

Step 6: open port 8080 on your VM

By default, you can only use port 22 to SSH into your VM. To be able to browse your WordPress site, you need to open the configuration of the “Network security group”, and create a new “inbound security rule” to allow all traffic to port 8080.

You probably want your WP site on port 80. To achieve this, in the yml file change 8080:80 to just 80:80 . This will map the port 80 of the container to the port 80 of the host.

Step 7: browse your newly created instance

Using the IPaddress of your VM on Azure, and the port defined on step 6, you can access the site you just launched!

Congrats 🙂