Minimizing Downtime
Wednesday, October 8th, 2008Now that this site is hosted on my own server, I wanted ensure that the server is up and running most of the time. Although five 9’s is not my availability target, I needed some mechanism by which changes and updates that I made to the site were not reflected in the production website (can I call it that?) until the right time.
The solution is a simple one: run a development website in parallel, so that all changes can be tested on that first. Updating the primary website would be like flipping a switch. Here’s how I managed this:
- Set up a new virtual host for the development site.
- Set up a new database for the development site and populate it with existing records.
- Update the WordPress configuration file to select a different database based on the current working directory.
- Set up server authentication for the development website.
- Write an init script to copy (rsync) all the files from the development site to the primary one. Exclude the authentication files like
htpasswd, of course. - Set up a dependency on the new script in Apache, so that restarting the service also restarts Apache (this is useful at times).
It’s as simple as that!




