Satyam
Satyam

Reputation: 665

Automating Zend framework app deployment using Capistrano

I have been struggling with Capistrano to automate deployment for a Zend framework application for the past few hours. Would love some guidance.

My directory structure is as follows

<project name>/
     Capfile
     application/
         configs/
            deploy/
                staging.rb
            application.ini
            deploy.rb
         controllers/
         models/
     .
     .
     .
     other framework folders and files

My Capfile is

require 'rubygems'
require 'railsless-deploy'
require 'capistrano/ext/multistage'

load 'deploy' if respond_to?(:namespace) # cap2 differentiator

My deploy.rb is (scm info omitted)

set :application, "App"

set :stages, %w(staging production)
set :default_stage, "staging"
set :stages_dir, "application/configs/deploy/"

default_run_options[:pty] = true

set :deploy_via, :remote_cache
set :scm, "git"
set :ssh_options, {:forward_agent => true}
set :repository, "[email protected]:<details>"
set :branch, "staging" 

And my staging.rb inside my deploy folder is (credentials omitted)

role :app, "host name"
role :web, "host name"
role :db, "host name", :primary => true

set :deploy_to, "/httpdocs/"

set :user, "username"
set :password, "password"

I am using a VPS but I don't think I am at the stage where I need to debug on the server side. Capistrano says that it cannot detect the staging task even though I defined it. The error is

triggering load callbacks
the task `staging' does not exist

What am I doing wrong?

Thanks!

Upvotes: 2

Views: 791

Answers (1)

Tim Fountain
Tim Fountain

Reputation: 33148

I think your stages_dir line should be:

set :stage_dir, "application/configs/deploy/"

i.e. stage_dir instead of stages_dir

Edit: I'm not familiar with railsless deploy but from looking at it it must override some of the standard Capistrano deployment recipe. Since the multistage gem you are also using will do the same thing, I'd guess the two are not compatible. The error you're getting certainly suggests that the multistage extension is not being used.

I wrote up a blog post ages ago on deploying ZF apps with Capistrano - http://tfountain.co.uk/blog/2009/5/11/zend-framework-capistrano-deployment - also using multistage. The approach you've taken is pretty similar to that. If you don't mind dropping railsless deploy (at least as an experiment), I'd suggest tweaking your Capfile and deploy.rb to match what's in that post (thus removing the requirement for railsless deploy), and seeing if this fixes your issue.

Upvotes: 1

Related Questions