Hi,
Home-grown or not I dont know for sure. I do see
require 'capistrano/ext/multistage'
in the deploy.rb. And we have a single deploy.rb file (in ~rails/
config) and multiple configuration files in config/deploy/*.rb.
The tasks that we run are pretty much the same for each environment
and so in the main deploy.rb we have:
before 'deploy:apache:reload', 'deploy:loadbalancer:set' # remove
spares from load balancer rotation (breaks if no machine specified as
spare)
before 'deploy:web:enable', 'deploy:apache:reload'
So, every environment shares these sets of dependencies. Here is a
sample environment-specific deploy config file:
set :rails_env, 'staging'
set :use_sudo, false
role :app, '192.168.10.20', '192.168.10.21'
role :web, '192.168.10.20', '192.168.10.21'
role :db, '192.168.10.20', :primary => true, :no_release => true
I would like to add this:
role :web, '192.168.10.99', :spare => true
--------------------
When one specifies the db role, is it always strictly necessary to
specify :primary for at least one machine?
From your reply, it seems like it is possible to place environment-
specific directives in the config file, for example, is this possible:
...
role :web, '192.168.10.99', :spare => true
before 'deploy:apache:reload', 'deploy:loadbalancer:set' # moved
from deploy.rb
...
Mike
On Nov 30, 2009, at 2:33 PM, Lee Hambley wrote:
> Mike,
>
> Presumably, you are doing this with the capistrano-ext multistage,
> not homegrown - and you are using seperate deploy.rb files, the
> standard way to do this is simply not to define the before/after()
> call in the stage environments that don't use the spare server.
>
> Alternately you might be able to use find_servers() (see the API
> docs) - to conditionally call the after/before() setup line... but
> really, only chain the task in the environments that require it.
>
> (and why not provision your spare server, but take it out of the
> load balancer config using some other process...)
>
> -- Lee Hambley
>
> Twitter: @leehambley | @capistranorb
>
> --
> * You received this message because you are subscribed to the Google
> Groups "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/capistrano?hl=en
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en