On Dec 19, 7:29 am, Gregory Seidman <gsslist
[EMAIL PROTECTED]> wrote:
> I'm trying to figure out the best approach to having different
> configurations for when I'm deploying to a development machine (just a
> single mongrel running from a directory in my home directory), a production
> machine (service script via sudo to start mongrel cluster, deployed to a
> directory under /var/www, maybe multiple machines), or a test machine (same
> as prod, but a different machine).
>
> I don't think roles are the right approach. I could have different config
> files and load the right file based on a -S variable or with a -F flag, but
> that's kind of ugly.
>
> What I'd like is to have a dev, test, and prod namespace in which all of
> the deploy namespace is included, with overrides as necessary. Then I'd cap
> dev:deploy or cap test:deploy:restart or the like. Is there a way to import
> one namespace into another?
>
> --Greg
I have staging environment, not development, but same should work:
task :staging do
role :app, 'dev.machine'
role :db, 'dev.machine'
set :mongrel_port, '3000'
set :mongrel_ip, '0.0.0.0'
set :rails_env, 'staging'
common_stuff
end
task :production do
role :app, 'production.app.machine'
role :db, 'production.db.machine'
set :mongrel_port, '9000'
set :mongrel_ip, '127.0.0.1'
set :rails_env, 'production'
common_stuff
end
task :common_stuff do
namespace :deploy do
task :start, :roles => :app do
run "mongrel_rails start -d -p #{ mongrel_port } -a
#{ mongrel_ip } -e #{ rails_env }"
end
# ...
end
end
Run like:
$ cap production deploy:start
$ cap staging deploy:restart
$ etc
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---