因此,在我的情况下,我们将存储(Git)环境迁移到了不同的框中,让我们将其称为stash_box。
在此之前,这是我要部署到prod的过程。
我有一个安全的linux盒,用于部署。让我们称其为deploy_box。
让我们调用目标prod服务器prod_box。
在此之前,procuction盒具有ssh对存储框(prod_box -> stash_box)的访问权限。
因此,当我从deploy_box中提取代码时&运行
cap prod_box deploy它曾经成功地部署过。
现在,有一个防火墙规则,即不允许与具有git的stash_box对话。
据我所知,capistrano需要目标服务器&存储服务器之间的连接。
现在,deploy_box可以双向地到达stash_box和prod_box。
是否有一种通过修改现有capistrano脚本来实现生产部署的方法?
这是我现有的deploy.rb文件:
require "capistrano/ext/multistage"
require "bundler/capistrano"
SECURE_FILES = ['database.yml', 'initializers/secret_token.rb']
set :application, "myapp"
set :use_sudo, false
set :scm, :git
set :repository, "ssh://git@stash_box:7999/web/myapp.git"
set :user, "webuser"
set :deploy_via, :remote_cache
after "deploy:update_code", "custom:create_symlinks", "custom:assets_precompile", "custom:miscellaneous"
after "deploy", "deploy:migrate"
after "deploy", "deploy:cleanup"
namespace :deploy do
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end
end
namespace :custom do
desc "Assets Pre-Compilation"
task :assets_precompile, :roles => :app do
run "cd #{current_release} && RAILS_ENV=#{rails_env} bundle exec rake assets:precompile"
end
end这是我的prod_box.rb文件:
server "prod_box", :app, :web, :db, :primary => true
set :deploy_to, "/opt/web/var/my_app"
set :rails_env, "customertest"
set :branch, "staging"发布于 2015-10-06 18:18:43
只需使用不同的部署策略:
set :deploy_via, :copy现在,源代码将在本地签出并上传到远程。你可以读到更多关于这里的信息。
编辑
对于capistrano v3,您必须使用这个创业板,并指定:
set :scm, :gitcopyhttps://stackoverflow.com/questions/32975680
复制相似问题