I have an old cap 1.4.1 script that I used like this:
if ENV['DEPLOY'] == 'production'
puts "*** Deploying to the PRODUCTION servers!"
set :application, "production-web"
set :rails_env, "production"
set :mongrel_port, "8000"
set :mongrel_environment, "production"
else
puts "*** Deploying to the STAGING server!"
set :application, "staging-web"
set :rails_env, "staging"
set :mongrel_port, "8010"
set :mongrel_environment, "staging"
end
But with the namespacing in Cap 2, seems like you could just define
this stuff inside your namespace:
namespace :deploy do
namespace :production do
# set your environment here
# reference original tasks here your tasks here
end
end
I'm not sure it's worth the work. With the environment variable, you
just call that before you call your cap tasks on the command line. In
my original scheme, I have staging be default, then production doesn't
get deployed to accidentally.
Jamie
On Jun 19, 2008, at 2:55 PM, spike grobstein wrote:
>
>
> Hi,
>
> I'm using capistrano to deploy [non-rails] applications to our server
> environment. Because our SVN server lives on the LAN, but the entire
> application environment lives on a separate private network accessible
> only through a gateway machine, capistrano is an ideal tool for
> pushing updates to the various applications.
>
> I'm running into an issue where I have a task that I want to call but
> on different hosts (ie: deploying to our staging and production
> servers). Right now, I'm doing it like this:
>
> cap deploy:my_app HOSTS="production1.server.com"
>
> however, I'd much prefer to call it like this:
>
> cap deploy:my_app:production
> or
> cap deploy:my_app:staging
>
> I created 2 tasks, one for staging and one for production, each with
> their roles set appropriately, and each calling a "deploy_my_app"
> task, but it tries to deploy the app to all servers.
>
> Is there a way to call deploy_my_app, but only have it execute on the
> servers with the roles defined in the calling task? I can't use
> "ENV['HOSTS'] = :production", since it requires that I supply it with
> a hostname/FQDN rather than a symbol referencing it.
>
> any help?
>
> tia.
>
>
> ...spike
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---