部署使用Capistrano + Gitlab使用via:remote_cache [英] Deployment using Capistrano + Gitlab using via: remote_cache
问题描述
我正在使用capistrano来部署一个PHP web应用程序,并且我们有一个内部gitlab服务器,它不能在网络外部访问。我正在尝试使用remote_cache进行部署,因为如果将其用于复制,需要很长时间。我已经检查过 This 和这,但没有得到想要的结果。
set:default_stage,staging
ssh_options [:forward_agent] = true
serverservername,: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 $ b $ set:keep_releases,2
set:user,'username'
set:deploy_to, / home / domain / public_html / test
set:copy_cache,true $ b $ set:deploy_via,:remote_cache $ b $ set:copy_strategy,:export $ b $ set:use_sudo,false
set:copy_exclude,[.git,.DS_Store,.gitignore,.gitmodules,Capfile,config / deploy.rb]
用于存储库和本地存储库的路径。任何建议我怎么能做到这一点?
编辑:我可以使用我的本地回购远程缓存。
for remote_cache?
:repository
是要部署的服务器将使用的url。因此,如果你的Git服务器运行在你要部署的服务器上,你可以将它设置为file:/// path_to_repo
示例:
set:repository,file:/// home / git / my_repo
set:local_repository,http:// server_address / my_repo
但是,如果您的回购在Github上,那么您应该只设置:repository
(不要设置:local_repository
)
set:repository,git@github.com/your_account/your_repo.git
Capistrano会自动创建一个目录,以便在使用remote_cache部署(共享/缓存副本)时保持它的repo克隆。
运行脚本时出现错误吗?
I am using capistrano for the deployment of an PHP web application and we are having an internal gitlab server which is not accessible outside the network. I am trying to deploy using remote_cache as it is taking to much time if use it for copy. I have already checked This and This but not getting the desired result. I am trying the below code.
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"]
What path to use for repository and local repository. Any suggestions how can I achieve this ? EDIT : Can I use my local repo for the remote cache.
How do you mean use you local repository for remote_cache?
:repository
is the url that the server being deployed to will use. So, if your Git server is running on the same server you are deploying to, you can set this to file:///path_to_repo
:local_repository
is the url that you will use to connect to the repo from your local machine that you are running the capistrano script on. You only need to set this if you :repository is a local path and you are running capistrano from a different machine.
Example:
set :repository, "file:///home/git/my_repo"
set :local_repository, "http://server_address/my_repo"
However, if, for example, you repo is on Github, then you should only set :repository
(DO NOT set :local_repository
)
set :repository, "git@github.com/your_account/your_repo.git"
Capistrano automatically creates a directory for keeping it's clone of the repo when using remote_cache deployment (shared/cached-copy).
Do you get an error when you run the script?
这篇关于部署使用Capistrano + Gitlab使用via:remote_cache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!