Using Capistrano to deploy ZenPhoto to Dreamhost

October 15, 2006 Link to post  Permalink

ZenPhoto is a very focused and lightweight photo gallery application. I’ve played around with a number of web based photo applications, and I’m currently using ZenPhoto for my own photos.

As a follow on to my post about deploying Wordpress using Capistrano,
I’ve now got a deployment of ZenPhoto running there too. Here’s what I did to make this easy.

1. Create a new domain (or sub-domain) in the Dreamhost control panel, make sure to use PHP5, using my account. I then set the web directory field to be ‘’ instead of the default of ‘’. I also removed the WWW using the radio buttons.

2. Create a new MySQL database using the Dreamhost control panel

3. Setup a local directory with a config and public directories, and unpack the ZenPhoto download into public

  |- config
  |    |- deploy.rb
  |    |- zp-config-dreamhost.php
  |    |- zp-config-local.php   
  |- public
  |    |- <unpack ZenPhoto 1.0.3>

4. I added my deploy.rb to the config directory.

5. Edit the deploy.rb file to have all the correct settings – anything with the prefix of my should be changed and the file saved as deploy.rb

6. Configure the ZenPhoto zp-config.php file as per the documentation, and copy the Dreamhost version to config/zp-config-dreamhost.php and your local version to zp-config-local.php. The Dreamhost version will be symlinked into place during deployment.

7. Import the whole zenphoto tree into an SVN server that is accessible from your Dreamhost account – Dreamhost can host this too – look under Goodies!

8. Dreamhost has created a the ‘current/public’ tree in your domain directory – delete this so Capistrano can do its symlink magic.

9. Run cap setup from the zenphoto directory to setup the directory tree on the Dreamhost server from the client – the deploy.rb file symlinks these into the public directory during deployment.

10. Create a shared/albums and shared/cache directories on the Dreamhost server for ZenPhoto photos and cache files to be stored.

11. Make sure to commit your SVN changes to the server

12. Run cap deploy and type your Dreamhost password when prompted.

Since I am making changes to some of the code to make my photos display the way I want, I’ve added a clear_cache task to the deployment script – cap clear_cache will delete all the generated image files that ZenPhoto uses for different image sizes. If you change thumbnail or image sizes, or quality settings, then the cache needs to be cleared.