Managing wordpress environments

I have small team (4 developers) and we created a site, that has currently 500 users.

Our development cycle looks like this:

Read More
  1. We make changes (install plugins or customize code) on our localhost.
  2. We push it to development environment. We can do stress tests, we have a couple of test users and so on.
  3. We evaluate it.
  4. We push it to production.

Deploying new code is as simple as git pull, but the real problem is database.

Almost all plugins require me to click something in admin panel. What is more: some of them create new tables or update existing tables when I install them. For example add some new user metadata for every user.

I thought about some solutions:

  • Installing plugins manually on all environments:

I can install plugins manually, but this is error prone.
We had a couple of situations, where code was the same, but sites worked different because of some simple misconfigurations.

  • Exporting whole database:

    • Export production database and import to dev.
    • Install plugin on dev.
    • Migrate dev to production.

It has a real problem – it is not atomic. If user created a post while I was installing plugin on dev – it is gone.

  • Creating scripts from database changes:

I could record, what wordpress did, while I was installing plugin via MySQL binary log.

The problem is, that one can get all users in one database query and then add some metadata with another using ids. This means, that binary log records query with a bunch of ids. If new user registered during process – it is gone.

  • Recording configuartion changes with selenium IDE:

I can then export test suite to python and replay with changed host address. It could work, but it seems rather like workaround, then a solution.

  • Modifying all the plugins so that they are configured by php files:

This seems legit, but might create quite a lot work.

Can you tell me, how do you automate wordpress deployments with database changes?


There is a couple of similar questions on SO:

Managing WordPress blog on development and live environment

WordPress Dev Environment Migration

but these are rather basic questions and they do not solve my problem.

Related posts

Leave a Reply

1 comment