Posts Tagged ‘Downtime’

Minimizing Downtime

Wednesday, October 8th, 2008

Now 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 avail­ability target, I needed some mecha­nism by which changes and updates that I made to the site were not reflected in the produc­tion website (can I call it that?) until the right time.

The solution is a simple one: run a devel­op­ment 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:

  1. Set up a new virtual host for the devel­op­ment site.
  2. Set up a new database for the devel­op­ment site and populate it with existing records.
  3. Update the WordPress config­u­ra­tion file to select a different database based on the current working directory.
  4. Set up server authen­ti­ca­tion for the devel­op­ment website.
  5. Write an init script to copy (rsync) all the files from the devel­op­ment site to the primary one. Exclude the authen­ti­ca­tion files like htpasswd, of course.
  6. Set up a depen­dency 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!