Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

WordPress DevOps

Strategies for developing and deploying with WordPress


Erik Torsner
This book is for sale at http://leanpub.com/wordpressdevops
This version was published on 2015-09-29

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing
process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and
many iterations to get reader feedback, pivot until you have the right book and build traction once
you do.
2015 Erik Torsner

Tweet This Book!


Please help Erik Torsner by spreading the word about this book on Twitter!
The suggested tweet for this book is:
WordPress and DevOps? Yes we can!
The suggested hashtag for this book is #wpdevops.
Find out what other people are saying about the book by clicking on this link to search for this
hashtag on Twitter:
https://twitter.com/search?q=#wpdevops

This book is dedicated to my wife Helene. Shes about as far from my target audience anyone can
get so chances are this is the only page shell really fully appreciate. Still love you just as much.
This book is also dedicated to my daughter Filippa. Perhaps shell grow up to be part of my target
audience and realize Im not a complete noob and that there are things I do get.
This book could also have been dedicated to Dennis. But hes a dog.

Contents
2. Building blocks for our environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2. Building blocks for our


environment
Before we get to do anything useful, we need to talk a little bit about the major building blocks were
going to use throughout this book.

WordPress
It should go without saying that were going to use WordPress as the main software component of
this application. Im going to assume that you as a reader are already familiar with WordPress and
its core concepts such as posts, pages, plugins and themes.

WordPress Plugins
As the application were building in this book is rather simple, the list of plugins were using are the
ones we need to create a web application.
WP-CFM is used to enable us to handle WordPress configuration during development and
make sure that WordPress configuration changes we make in development can easily be
deployed to test, staging and production.
If menu enables us to show different menu items for anonymous and logged in users.
BAW Login/Logout menu is a neat plugin that helps us put correct login and logout links in
the WordPress menues.
Restrict Content Pro is used to enable us to charge a monthly recurring fee from our users.
Mandrill is used to send external email without messing with SMTP
Google Analyticator is used to connect to Google Analytics
Thats it, not that many plugins at all for the core functionality. When you build your own
application, chances are that you will end up using a lot more plugins, after all, the purpose of
using WordPress as the platform is to be able to tap in to the nearly endless repository of great
plugins that helps you build functionality with ease.

2. Building blocks for our environment

Git
https://git-scm.com/
Were going to use git for version control for this project. There are lots of wonderful graphical tools
that helps you use git, but in this book were going to use a fairly basic set of git command on the
command line. Well be using git for version control of our own code and to download some of the
external dependencies that are published on github.

Github
https://github.com
The code samples for this book will be kept on github.com. There are plenty of other places where
you can host your code, but github is at the time of writing the most popular one. Some steps of this
book will be explained assuming that you keep your code on github, but it should be easy enough
to figure out how to do the same on other services such as bitbucket.org or beanstalkapp.com.

Npm
https://www.npmjs.com/
Npm is a package manager for JavaScript. In this project, its mainly used to get Grunt and its
depencencies into place.

Grunt
http://gruntjs.com/
Grunt is a javascript taks runner and we will use it to automate various repetitive steps. Most notably,
we will use it to install and setup WordPress in each environment so that we can ensure that the
WordPress installation installed the same way on every environment we need to have it in.

Wp-cli
http://wp-cli.org/
Wp-cli is used indirectly (via grunt) to do the actual heavy lifting of installing and configuring
WordPress, installing plugins and other WordPress specific automation.
https://git-scm.com/
https://github.com
https://www.npmjs.com/
http://gruntjs.com/
http://wp-cli.org/

2. Building blocks for our environment

Vagrant
https://www.vagrantup.com/
To make sure we have complete control over the development and testing environments, were going
to use the vagrant for virtualization. Vagrant is a layer on top of VirtualBox (or VM-Ware) that lets
us control virtual machines via the command line.
Vagrant lets us keep a file in the root of your project folder that defines the the configuration
of an entire virtual machine. The idea is that during development your application runs in an
environment that closely resembles the target production environment. It also makes it easy to
keep separate development environments for different projects so that requirements for one project
doesnt contaminate the environment for others. Vagrant can also make sure that every member of
a team develops and tests in the same technical environment without having to maintain their own
installations of web servers, php, databases and what not. This is not only a time saver, but will
work wonders with your teams ability to deliver quality code.

Rocketeer
http://rocketeer.autopergamene.eu/
For deployment, well be using Rocketeer. Rocketeer helps us manage deployments to the staging
and production environments. Rocketeer enables us to roll out new versions of the app with a single
command knowing that the update process works the same every time using tools like wp-cli and
Grunt.

Phpunit
https://phpunit.de/
All testing will be done using phpunit. Well be installing it as a development requirement via
composer. Well also be using the extention DBUnit so that we can automate some of the database
testing we need.

Composer
https://getcomposer.org/ When Composer entered the PHP world a few years ago, lots of things
changed to the better. In this project well use Composer to define and download some of the third
party components and to make auto loading some of our own PHP classes easier.

https://www.vagrantup.com/
http://rocketeer.autopergamene.eu/
https://phpunit.de/

You might also like