I think you overcomplicating it

Create two tasks

task :production ...
task :staging ...

Override as necessary setting direct values. If you have different servers set 
them inside the tasks

Call as:

cap production deploy
Or
cap staging deploy



On Jun 4, 2012, at 3:39 AM, Jérémy Lecour <[email protected]> wrote:

> Hi Lee, thanks for your answer.
> 
> 
> In fact, reading the source code ,n I've found that I can use the `parallel` 
> block like this (and it seems to work) :
> 
> set :deploy_to, lambda {
>   parallel do |session|
>     session.when "server.host =~ /bis/", "/home/#{user}-pra/apps"
>     session.else "/home/#{user}/apps"
>   end
> }
> 
> This way I can match some part of the host name and have a specific deploy_to 
> variable for my special server.
> 
> That said, I'd rather rely on the "role options" to mark one or many servers 
> (in the "web" role) as special and set the deploy_to accordingly.
> 
> Right now, I still didn't find how to access the options hash, but I'm 
> searching.
> 
> 
> Le lundi 4 juin 2012 11:53:24 UTC+2, Lee Hambley a écrit :
> Jeremy,
> 
> You'll have to re-architect your system to include the stage in the 
> :deploy_to, this is a  smart move anyway, (personally I use 
> /opt/sites/:application/:environment) - then simply add the staging server as 
> a normal server in the production deployment.
> 
> You could take it a step further and set some additional options on the 
> server (staging) that it can be excluded from spinning up web servers/etc
> 
> - Lee
> On Monday, June 4, 2012 at 11:50 AM, Jérémy Lecour wrote:
> 
>> Hi,
>> 
>> I use a multistage Capistrano configuration. I have 2 serveurs 1 for 
>> production and 1 for staging, and there are 2 stages for capistrano, with 
>> the same configuration (deploy_to, …) That way, my production and staging 
>> environments are very similar.
>> 
>> Having just 1 production server, I'd like to be able to switch to the 2nd 
>> server in case of emergency, or for a scheduled long maintenance.
>> My staging server is perfect for this, but I don't want to use the staging 
>> DB, app, … for the production environment.
>> 
>> I 'd like to tweak my production deployment strategy to mirror every 
>> deployment to the 2nd server but with a specific configuration (mainly the 
>> "deploy_to" variable).
>> 
>> Is there a way to do that?
>> 
>> Thanks for your help
>> -- 
>> * 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

-- 
* 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

Reply via email to