Latest: Genstatic, my first sip of coffee

Content with Style

Web Technique

PHP Deployment With Capistrano

by Matthias Willerich on August 11 2008, 08:33

Today I’d like to share 2 links with you that have helped me quite a bit recently.
I finally found the time at work to move a couple of further-ran projects from the initial “building it” stage to “maintaining it”. Using this opportunity I followed Jon Maddox’ post about utilizing my installed (and older) version of Capistrano to get more control over deploying PHP projects. As most of them are Wordpress installations, this Made By Many post about Capistrano and Wordpress was also of good use.

The biggest criticism I come across when mentioning this is “why bother with this when I can use shell scripts”, referring to scp, ssh, rsync, and all the rest. I find this is a valid point, and except for the “maybe I can’t be bothered writing a shell script containing all that” argument, I’m clueless. Is it simply the collection of all this functionality and presenting it in an apparently easy way? Maybe someone can enlighten me here or over on the other side?

For me, I just like to have the good feeling that, after configuring it, I can do my changes locally, test them, check in the changes once I’m happy, hit “cap deploy” and go for lunch/dinner/over to more exciting things in life than uploading files. And if I really screw up (because I secretly make sure it’s fine live as well, and it’s not), i can simply roll back.
With a little scripting magic wrapped into the configuration I can sync databases and files back and forth (yeah, yeah, why not do this in the console to start with?). And, paths amended for a different machine (if necessary), it’s portable, too.

Comments

  • So, 2 seconds after posting this, Simon starts pestering me with well-informed questions via iChat:
    “i’m in two minds whether to use capistrano. for [my project] i have a nice deploy shell script i coded myself. u reckon this is better?”
    So here we go, IS it better? Smart cookie that I am, my zen-like answer was “if [your setup] works for you, there’s no need to change anything. you need to look at the options [of capistrano], and if you need them”
    Then he mentions that I missed the fact that Capistrano needs Ruby set up, which might be too annoying for someone solely working in PHP.
    Not stopping there, we also touched on the subject of database migrations. At least with this one there are ways to integrate symfony , and I’m sure cakephp and Zend can also be dealt with.
    Sometimes you just wonder what friends are for… zzzzz….

    by Matthias Willerich on August 11 2008, 09:26 - #

  • Zend Framework proposed component… http://framework.zend.com/wiki/display/ZFPROP/Zend_Db_Schema_Manager+-+Rob+Allen

    by Simon Plenderleith on August 11 2008, 09:36 - #

  • and another monster to slot into to make life a little more colorful: doctrine , a php ORM diddy that can do migrations and other stuff, and slots into zend.
    Now, take that, use only the migrations for your app, thread it into capistrano and wait for me to tell you that everything has become in fact easier… :-D

    by Matthias Willerich on August 11 2008, 09:49 - #


Comments for this article are closed.