简体   繁体   中英

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, "git@github.com:<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!

I think your stages_dir line should be:

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

ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM