使用via:remote_cache使用Capistrano + Gitlab进行部署

我使用capistrano来部署PHP Web应用程序,我们有一个内部gitlab服务器,无法在网络外部访问。 我正在尝试使用remote_cache进行部署,因为如果将其用于复制需要很长时间。 我已经检查了这个和这个但没有得到想要的结果。 我正在尝试下面的代码。

set :default_stage, "staging" ssh_options[:forward_agent] = true server "servername", :app, :web, :db, :primary => true set :application, "appname" set :scm, :git set :repository, '.' set :local_repository, "file://." set :branch, "master" default_run_options[:pty] = true set :keep_releases, 2 set :user, 'username' set :deploy_to, "/home/domain/public_html/test" set :copy_cache, true set :deploy_via, :remote_cache set :copy_strategy, :export set :use_sudo, false set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules", "Capfile", "config/deploy.rb"] 

存储库和本地存储库使用什么路径。 有什么建议我怎样才能做到这一点? 编辑:我可以使用我的本地仓库进行远程缓存。

你的意思是如何使用本地存储库来获取remote_cache?

:repository是要部署的服务器将使用的URL。 因此,如果您的Git服务器在您部署到的同一服务器上运行,则可以将其设置为file:/// path_to_repo

:local_repository是您将用于连接到运行capistrano脚本的本地计算机上的repo的URL。 只有在以下情况下才需要设置:存储库是本地路径,并且您从另一台计算机运行capistrano。

例:

 set :repository, "file:///home/git/my_repo" set :local_repository, "http://server_address/my_repo" 

但是,例如,如果你的repo在Github上,那么你应该只设置:repository (不要设置:local_repository

 set :repository, "git@github.com/your_account/your_repo.git" 

使用remote_cache部署(共享/缓存副本)时,Capistrano会自动创建一个目录,用于保存它的克隆。

运行脚本时是否出错?