Docker Compose Wordpress
Created at 2016-07-02T18:50:32.000Z

I've used wordpress as my Ops playground. Wordpress has interesting characteristics as web application (e.g. theme/plugins are persisted in file system), so that drives me to try more and more tools.

Actually, I've made three versions of production deployment setup:

  1. ansible and capistrano
  2. ansible and docker/docker-compose
  3. docker/docker-compose (https://github.com/hi-ogawa/docker-compose-wordpress)

Finally, it turned out docker/docker-compose (and a couple of 3rd-party docker images) suffices to do what I want, which is:

  • Provide almost same environment on local experiment and remote server production
    • Differences are made only by env.development and env.production files
  • Easy to update config files (e.g. wp-config.php or apache2.conf)
    • You only need docker-compose restart wordpress after those files are changed
  • Easy to add system dependency of php app
    • You only need docker-compose up --build wordpress after Dockerfile.wordpress is changed
  • Easy to backup/restore wordpress files and mysql data (and email notification email notification)

What I Learnt

I will list a couple of things I learnt from this experience.


Wordpress Theme Development

As another subject of wordpress, I like to customize theme and like to track those changes. I was using a wordpress plugin Revisr for this process.

As you can see from my old post about how to setup Revisr, it's kinda complicated. So, I've wanted to find a simpler way and here is my new approach:

  1. Create a fork of original theme
  2. Develop and preview on local with docker-compose
  3. Create a release from Github and download zip file
  4. On production, uploading zip file and replace old one

I forked theme twentyelven into my repository https://github.com/hi-ogawa/wordpress-theme-twentyeleven and I'm using this theme here in my blog.