当前位置: 动力学知识库 > 问答 > 编程问答 >

capistrano3 - deploying to multiple server for multiple environment

问题描述:

I have a rails app. that is deployed in Amazon ec2 instance using capistrano. Now I would like to deploy same app in Azure cloud. My problem is I would like to deploy 'staging' stage to Amazon ec2 and 'production' stage to Azure cloud. So, what necessary configuration is to made for deploy.rb file which has below code:-

lock '3.4.0'

role :web, '[email protected]'

role :app, '[email protected]'

role :db, '[email protected]', primary: true

role :resque_worker, '[email protected]'

role :resque_scheduler, '[email protected]'

set :application, 'air_scout'

set :deploy_user, 'deploy'

set :rvm_type, :user # Defaults to: :auto

set :rvm_ruby_version, '2.1.3'

set :keep_releases, 3

set :tests, []

set :assets_roles, [:app]

set :pty, true

set :resque_environment_task, true

set :linked_files, %w{config/mongoid.yml config/secrets.yml}

set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}

set(:config_files, %w(

mongoid.yml

secrets.yml

nginx.conf

unicorn.rb

unicorn_init.sh

))

set(:executable_config_files, %w(

unicorn_init.sh

))

set(:symlinks, [

{

source: 'nginx.conf',

link: "/etc/nginx/sites-enabled/{{full_app_name}}"

},

{

source: 'unicorn_init.sh',

link: "/etc/init.d/unicorn_{{full_app_name}}"

}

])

namespace :deploy do

after :finishing, 'deploy:cleanup'

before 'deploy:setup_config', 'nginx:remove_default_vhost'

after 'deploy:setup_config', 'nginx:reload'

after 'deploy:publishing', 'deploy:restart'

after 'deploy:restart', 'resque:restart'

end

namespace :database do

desc 'Completely rebuild the database and admin user data.'

task :reset do

on roles(:db) do

within release_path do

with rails_env: fetch(:rails_env) do

execute :rake, 'db:setup'

execute :rake, 'db:seed'

end

end

end

end

end

My stages file contains config specific to servers. I'm confused in deploy.rb configuration. How role should be splitted (assuming same user-deploy). Please help me configuring the server. And let me know if you need additional information. Thankyou. Happy Coding.

分享给朋友:
您可能感兴趣的文章:
随机阅读: