Many companies I know use DTAP in their website development process. DTAP is an acronym for “Development, Testing, Acceptance and Production” and is used as a release management cycle in software development. If you are building complex websites – or rebuilding them – the use of a so called “DTAP street” is very useful. Over the past few years I’ve been working a lot with DTAP and WordPress, of course. Here’s my experiences and the choices I made.
A DTAP street
Using a DTAP street is all about managing the development and release of entirely new software or just for a newer release of the software already in production. When using a DTAP street in web development you are in fact using at least four environments and versions/copies of your website:
-
Development — (for example, http://projectname.development.companyname.com)
This is a true developers’ environment and the place where the actual code is written. Are more developers working simultaneously on the same project? If so, you can have several simultaneous development environments. Just use SVN of Git for version control and for merging code. The main purpose of this environment is to implement the code which can be tested by the developer himself. -
Testing — (for example, http://projectname.testing.companyname.com)
The test environment is the next station for new code. Here, a tester (an interaction designer, for instance), tests the product and checks whether it works according to specifications; for this reason, this person should preferably not be the same person who wrote the code. -
Acceptance — (for example, http://projectname.acceptance.companyname.com)
It should be fully identical to the production environment, and even run on the same server. All integrations with back end systems, third party systems and cache systems (and settings) should match the live website. This environment is often used to perform tests prior to taking the software into production. This too, is the station where your customer ‘accepts’ the changes; in other words, it serves as the customer’s test environment as well. -
Production — (for example, http://projectname.com)
The production environment is your actual live website, to be used by your customer and his visitors. The main difference with acceptance is that there is no room for error here, and there should be no downtime.
One codebase to rule them all
Working with WordPress under DTAP means that you will have to run four separate installs of WordPress for every project and also running four databases. I’ve tried using fewer databases than four, for example using one database for development and testing; it really does not work well, since WordPress uses absolute URIs for your assets like Javascripts and CSS, and user generated content, such as images inside posts, will be scattered all over the place. Hence, I strongly recommend that you use a separate database for each install.
I want to keep my code completely portable between these environments; I hate deploying a site to another environment and have to fill out new database credentials in the wp-config.php
or in any other setting. Since you are bound to forget it at some point, I use this simple code fragment in my wp-config.php
for my (database) settings.
Migrating WordPress
Now that you have your program code portable between the environments, you will only need to concern yourself with the database. It’s not often that you will have to deploy an entire site to another environment – usually only at the first deploy, but since you are bound to run into this at least once, let me try to explain this a little further.
wp-config is now set up in such a way that WP_HOME
and WP_SITEURL
are already defined for you. This means that WordPress will use these values instead of any values taken from the wp_options table. The result is that after having deployed to another environment and after having executed a database import, WordPress should already be able to run. However, as mentioned before, WordPress uses absolute URLs inside posts and these must be changed too.
There are several ways to migrate WordPress, such as the Backup Buddy plugin. I like to use a database search and replace script (Daniël van de Giessen wrote a real nice one with a lot of options, that you can download from Github). Whatever you choose, at the very least, you should read the WordPress Codex on changing your sites’s URL and on moving WordPress to another server.
As to the URIs inside posts, there are ways to let WordPress work with them; read this article on how it can be done manually. I, however, tend to agree with Joost de Valk who argues that relative URIs might not be a good idea.
More goodies
DTAP can also be used for your content workflow; there is a commercial plugin called RAMP which allows you to deploy content between you DTAP-environments.
Back to you
What are your experiences with DTAP and WordPress? Do you even use it? What obstacles did you encounter and how did you tackle them?