How do I deploy a rails app to more than one domain/user/db combination in Capistrano and Rails 3?
This might sound strange (or even dangerous) but I would like to deploy one rails app to multiple domains. I built one CMS that I maintain for several different clients. The only difference between the sites is the CSS files, images, a database.yml, and a config.yml file. When I deploy I would like to update all their sites at once. Each domain uses different usernames and passwords so I cannot use the single user that is normal set in the deploy.rb file. Basically I need to run the deploy on different sets of users, domains, and databases.
My needs are different than just deploying to several staging, test, or load balanced servers. Each web server is a unique and independent production server, running as though it was a different rails app.
I need to do something like the following in the deploy.rb:
role :app, "ww开发者_StackOverflow中文版w.cats.com", "www.dogs.com"
role :web, "www.cats.com", "www.dogs.com"
role :db, "www.cats.com", "www.dogs.com" # both need the same migrations
set :deploy_to "/home/#{cats_user}/www.cats.com", "/home/#{dogs_user}/www.dogs.com"
Is something like this possible? If not, a good alternative would be greatly appreciated!
We use the multistaging option of capistrano-ext
as described in this article.
The example in the blogpost is for the different stages in releasing (testing, acceptance, production) but you could as well use it to deploy to different servers. And as each stage has its own configuration-file you can easily change the configuration (config.yml/database.yml) per stage.
If you have more questions, just ask :)
精彩评论