Jamis,
I tried your suggestion and here is what I did:

before 'deploy_task_that_fails', 'print_variables'
task :install_1 do
  set :deploy_to, "/home/rails/install_1/#{application}"
end
task :deploy_task_that_fails do
  fail "abort here."
end

Where 'print_variable' is something like:

task :print_variables, :roles => :app do
  %w(application deploy_to).each do |k|
    puts "#{k} => #{fetch(k.to_sym)}"
  end
  (variables.keys.select { |k| /stage/ =~ k.to_s }).each do |k|
    puts "#{k} => #{fetch(k.to_sym)}"
  end
  (variables.keys.select { |k| /path/ =~ k.to_s }).each do |k|
    puts "#{k} => #{fetch(k.to_sym)}"
  end
end

When I try 'cap install_1 fail-here' I get following

$ cap install_1 deploy_task_that_fails
  * executing `install_1'
  * executing `deploy_task_that_fails'
    triggering before callbacks for `deploy_task_that_fails'
  * executing `print_variables'
application => PlantCollections_qa
deploy_to => /home/rails/install_1/PlantCollections_qa
stage => qa
releases_path => /home/rails/install_1/PlantCollections_qa/releases
shared_path => /home/rails/install_1/PlantCollections_qa/shared
current_path => /u/apps/PlantCollections_qa/current
release_path => /home/rails/install_1/PlantCollections_qa/releases/
20080717181519

Note that, current_path is not what you expect it to be. Won't this
cause problems?

I needed something like:

set :rails_env, 'qa'
set :application, "PlantCollections_#{rails_env}"

Since, :rails_env has to be different for different stage (makes most
sense), I couldn't get :application based on :rails_env (because of
some lazy definition issue with mulstage).

So, here is what I ended up doing:

I got rid of multistage and included following _at_the_top of my
deploy.rb:

require 'palmtree/recipes/mongrel_cluster'
set :stage, "qa" unless variables[:stage]
location = fetch(:stage_dir, "config/deploy")
load "#{location}/#{stage}"

This would immediately load the stage specific deploy/<stage>.rb and I
could set :rails_env and :application in my <stage>.rb file.

This does change how different can be invoked. So, I can no longer do
"cap <stage> <deploy_task>".
Instead, I have to to "cap -S <stage> <deploy_task>".

I am happy with what I've got, however, I am not sure if I am settiny
myself up for a big trouble later (all because I don't understand the
lazy variable definition)


On Jul 14, 5:07 pm, andres <[EMAIL PROTECTED]> wrote:
> On Mon, 2008-07-14 at 15:56 -0600, Jamis Buck wrote:
> > I'd do something like the multistage stuff:
>
> beautiful,
> many thanks,
>
>
>
>
>
> >    set(:deploy_to) { abort "you need to call install_1, install_2, or
> > install_3 first" }
>
> >    task :install_1 do
> >      set :deploy_to, "/home/rails/install_1/#{application}"
> >    end
>
> >    task :install_2 do
> >      set :deploy_to, "/home/rails/install_2/#{application}"
> >    end
>
> >    task :install_3 do
> >      set :deploy_to, "/home/rails/install_3/#{application}"
> >    end
>
> > Then, I'd deploy three times:
>
> >    cap install_1 deploy
> >    cap install_2 deploy
> >    cap install_3 deploy
>
> > Which, of course, could be wrapped into a rake task for ease of
> > execution if you're always executing all three.
>
> > - Jamis
>
> > On Jul 14, 2008, at 3:35 PM, Andres wrote:
>
> > > Hi,
>
> > > Quick question,
>
> > > With the basic documentation, it easy to understand how to deploy one
> > > app to different boxes by passing several servers to the role :app,
> > > variable.
>
> > > But, what if I'd like to deploy the same application several times in
> > > the same box,
> > > something as
>
> > > set :deploy_to, "/home/rails/install_1/#{application}"
> > > set :deploy_to, "/home/rails/install_2/#{application}"
> > > set :deploy_to, "/home/rails/install_3/#{application}"
>
> > > But all in the same machine,
>
> > > So, in this case, what's the approach to deploy my app several times
> > > in the same box?
>
> > > Thank you,
>
> > > Andres
>
> > >
> --
> Andres Paglayan
> CTO, StoneSoup LLC
> Ph: 505 629-4344
> Mb: 505 690-2871
> FWD: 65-5587
> Testi. Codi. Vinci.
>
>  smime.p7s
> 7KDownload

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to