Multiple deploy scripts

I’m taking over a project and am wanting to put a staging server in
place.

The thing holding me up is the Capistrano deploy scripts. I have
changed the ‘deploy.rb’ file to ‘deploy-production.rb’ and then added
a ‘deploy-stage.rb’ file.

Here is where I believe my problem is coming into play:
The current contents of my ‘Capfile’:

load ‘deploy’ if respond_to?(:namespace) # cap2 differentiator
Dir[‘vendor/plugins//recipes/.rb’].each { |plugin| load(plugin) }
load ‘config/deploy-stage’
load ‘config/deploy-production’

This was a shot in the dark (adding the last two lines). Am I
misunderstanding what that load line does? Here’s is why I’m
confused. After modifying the file as such, I then go to the command
line and attempt to run the stage script with ‘cap -f config/deploy-
stage.rb deploy’. I then receive a lovely message telling me that
“the task `deploy’ does not exist”. Whaaa? Well, we know it does, so
this must be caused by the Capfile no longer being included. I
thought I read in the documentation that if ‘-f’ is used even once, it
will negate the Capfile’s inclusion.

So I suppose I’m looking for some direction here. A seemingly ideal
solution would be to create a task such as ‘cap deploy:stage’ and ‘cap
deploy:production’ in order to deploy to stage. Is this a bad idea?
How would I go about doing this?

Thank you!!!

On Wed, Jun 18, 2008 at 8:49 AM, Slant [email protected] wrote:

“the task `deploy’ does not exist”. Whaaa? Well, we know it does, so
this must be caused by the Capfile no longer being included. I
thought I read in the documentation that if ‘-f’ is used even once, it
will negate the Capfile’s inclusion.

So I suppose I’m looking for some direction here. A seemingly ideal
solution would be to create a task such as ‘cap deploy:stage’ and ‘cap
deploy:production’ in order to deploy to stage. Is this a bad idea?
How would I go about doing this?

My understanding is that calling:

RAILS_ENV=‘staging’ && cap deploy

should do it. Maintaining two versions of basically the same file goes
against the DRY principle.


Anthony E.
408-656-2473
http://anthony.ettinger.name

On Wed, Jun 18, 2008 at 5:49 PM, Slant [email protected] wrote:

“the task `deploy’ does not exist”. Whaaa? Well, we know it does, so
this must be caused by the Capfile no longer being included. I
thought I read in the documentation that if ‘-f’ is used even once, it
will negate the Capfile’s inclusion.

So I suppose I’m looking for some direction here. A seemingly ideal
solution would be to create a task such as ‘cap deploy:stage’ and ‘cap
deploy:production’ in order to deploy to stage. Is this a bad idea?
How would I go about doing this?

Thank you!!!

I did go in a different direction:

Top of my config/deploy.rb file try loads recipes from
config/deploy/*.rb, each of these “sub recipes” only created a task
for production and staging, that define db, app and web roles, also
rails_env

So I can do in the command line:

cap production deploy

cap staging deploy

etc.

Learned that trick from some EY recipes :wink:

Regards,

Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

On Wed, 2008-06-18 at 19:09 +0200, Luis L. wrote:

cap staging deploy

etc.

Learned that trick from some EY recipes :wink:

Right on, yup, this is capistrano “multistage” and is included in the
capistrano-ext gem:

http://quotedprintable.com/2007/7/23/capistrano-multi-stage-support

Great stuff, very handy.

Yours,

tom

Superb!! Thank you all so very much. I was not aware of the
multistage feature!! Crazy…