On Nov 3, 2006, at 12:59 PM, Jon Garvin wrote:
>
> We've got one Rails application that we deploy to multiple
> instances on
> our server, each with their own mongrel_clusters, databases, etc.
> We use
> a table in the databases to turn certain features on and off per
> instance. I've been using capistrano for a while on a personal project
> and want us to start using it on our big app at work. We're moving
> to a
> new server, so now seems like the opportune time to migrate to cap as
> well. Does anybody have any suggestions on how to arbitrarily deploy
> the app to one instance on the server? Obviously, the default tasks
> won't be enough, but I'm curious if anyone else has dealt with
> this, and
> if so, how they handled things like the :deploy_to variable, roles,
> etc.
> Maybe it's simply a matter of creating a task like
> 'deploy_to_client1',
> that sets up the variables and then runs the default tasks?
Hi, I asked this question a while ago. And using tips I learned from
this list, I have built my own solution. As a side note, I use the
railsmachine gem to aid in deployment, because I like some of the
things they do. More info about railsmachine here: https://
support.railsmachine.com/index.php?pg=kb.page&id=12
If I want to deploy the same app somewhere else (for demos or the
like), I just add another when clause to the case statement.
I'm just going to paste my whole sanitized deploy.rb for you.
In the next couple of days, I'll annotate this a little better and
make a blog post on it with a bit more detail.
========8<===========
require 'railsmachine/recipes'
# use cap -s to set the stage. the stage defaults to "staging"
set :stage, "staging" unless variables[:stage]
case stage
when "staging"
set :application, "app-staging"
set :domain, "app-staging.test.com"
set :rails_env, "production"
set :app_server, "dev01"
set :apache_proxy_port, 8000
set :apache_proxy_servers, 3
when "production"
set :application, "app-production"
set :domain, "app.com"
set :rails_env, "production"
set :app_server, "prod01"
set :apache_proxy_port, 8010
set :apache_proxy_servers, 3
end
set :deploy_to, "/var/rails/#{application}"
set :user, "deploy"
set :repository, "http://svn/project/app/trunk"
role :web, app_server
role :app, app_server
role :db, app_server, :primary => true
role :scm, app_server
set :apache_conf, "/etc/httpd/conf.d/#{application}.conf"
task :after_update_code, :roles => :app do
put(File.read('config/database.yml'), "#{release_path}/config/
database.yml", :mode => 0444)
end
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---