Docker Containers and Delphix Architecture

I use wordpress for my personal blog. Works fine on it's own. It is just me making a few posts here and there.

I use WordPress for my personal blog. Works fine on it’s own. It is just me making a few posts here and there. Occasionally there are problems like an upgrade that goes bad or a hack that gets some redirection code into the site. In those cases I have to go to a backup of my MySQL database that is used by WordPress on my site. The database is small so it’s pretty quick to backup, but I don’t back it up normally.  I know I should and occasionally it would be nice to have a backup in the event that data is corrupted somehow (like hacks into the contents of the database).

WordPress uses MySQL for the data store and the WordPress content changes are all stored in MySQL. MySQL data can be linked to Delphix which automate data management for MySQL (or any data) by providing backups, versioning and fast thin cloning of the data to be used in development and QA.

Using WordPress as an example there are a number of architectures we could use. First we don’t need Delphix or Docker and could just set it up, as have with my blog.

dockers and containers image 1

One weakness of this architecture is any changes to the wordpress website are being made on the source. Why is that a problem? It’s a problem if something goes wrong when deploying changes. How do you rollback any incorrect changes? What happens if multiple developers are working on the wordpress site? Is there any way to version changes to keep changes by one developer separate from another?

I just use wordpress for my personal blog but what if you used it for your business and what if multiple people were making changes. In this case, ideally I want to make changes on a staging site and when changes are validated then push them to the production site.

Ideally development on the wordpress site is done on a staging or development server.

dockers and containers image 2

Question is, how do you keep the data in the development host in sync with the source host and how would you roll changes from development into the source? One answer for deploying changes would be to use something like RAMP. So we can use something like RAMP to push the changes to production but how push changes in production back to the staging environment?  What about data coming into production such as comments, feedback, forms etc? How do we get that data back to the development environment? That’s were Delphix shines:

dockers and containers image 3

Delphix connects to the MySQL database on production and syncs all the data changes onto Delphix providing a timeline (down to second) of changes. These versions of the database can be provisioned out to a target host via what is called “thin cloning”. When a thin clone is made, data is not moved or changed. Instead we just make an image of the data at the point in time available to the database instance. The data is mounted over NFS or iSCSI. The only thing that gets stored in these thin clones are changes made to the thin clone and those changes are only visible to the clone that made the changes. This architecture provides two things

  1. Backups down to the second of production for a multiple weeks generally stored in less than the size of the original database thanks to compression and deduplication and accessible in a matter of minutes.

  2. Thin clones of the data providing as many copies to as many developers as we want for almost free.

Point 1, backups, is a huge piece of mind. Once Delphix is connected to the production/source database then backup is automatic  and recovery is a no stress few clicks of the mouse.

Point 2 supports a more robust development environment like:

dockers and containers image 4

In this environment I can have multiple target hosts where developers can each work on their own private copy of the production database and thus website. We can even have extra copies to test merging of changes from different developers. What happens though if we want all the developer copies on one machine like:

dockers and containers image 5

The problem with this, is I don’t know how to run multiple instances of wordpress on one machine. An easy solution would be to use Docker containers such that each instance of wordpress is separate from the others as in:

dockers and containers image 6

Docker containers are self contained and don’t impact each other (except potentially on a resource consumption level like CPU).

Docker containers are also quick to spin up allowing quick failover, when used in conjunction with Delphix, like:

dockers and containers image 7

Finally we could combine the architectures to support quick fail over, recovery, versioning, multiple developer environments like:

dockers and containers image 8

In this case, our production MySQL database is using data directly off of Delphix. This allows us to quickly rollback any changes by simply using Delphix to rollback to an earlier version of the database. Or we could promote a developer copy directly to production. And if the host went down, we could fail over to another machine quickly by starting up a docker wordpress container there and provisioning it with a thin clone in minutes from Delphix.