Using Capistrano with Perl (or PHP) 4 comments

posted Thursday, March 9, 2006 by topfunky

UPDATE: The cap command can be used instead of rake.

Theoretically, you can use the Switchtower Capistrano deployment system with Perl, PHP, or any other system. I haven’t seen a tutorial for doing it with non-Rails systems, so here is how I did it tonight:

  • Make the standard ‘public’, and ‘config’ folders that you are used to seeing in Rails.
  • Copy all your Perl or PHP files into ‘public’.
  • Copy this starter deploy.rb file to config/deploy.rb.
  • Make a restart task that does nothing (or restarts FCGI’s for the language in question).
  • Run cap setup
  • Copy any relevant upload folders to shared/system/...
  • Make an after_symlink task that symlinks from any relevant upload folders and makes Perl files executable:
desc 'Link to files'
task :after_symlink do
  run "chmod +x #{current_path}/public/*.pl" 
  run "ln -s #{shared_path}/file #{current_path}/public/file" 
end
  • Run cap deploy

I used this with a Perl-based system and it worked successfully! Yay! Capistrano + Ruby deployment for non-Rails languages!

See also

4 comments

Leave a response

  • Gravatar icon procreate

    I’ve been using ST with php also. Works like a charm!

  • Gravatar icon Chriztian Steinmeier

    OK Mr. Topfunky – you’re about to be slapped on the head for being too productive :-)

    Maybe it’s that Dvorak thing…

  • I moved a big PHP project to Capistrano a while back and it’s been a dream. Then I added migrations into the mix.

    It’s Viral Rails… taking over from the inside out!

  • Muchas gracias, Geoffrey, this made my day. I rolled my own rakefile for managing my PHP project back in the pre-Switchtower-days, then I added migrations&stuff but it feels so old-fashioned compared to Capistrano.

    Now I’ll be able to do deployment&migrations with a single command, even in those PHP apps. Cool…

Your Comment

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Manufactured with

Subscribe

Subscribe (RSS)