Deployment using Capistrano + Gitlab using via: remote_cache

萝らか妹 提交于 2019-12-22 06:47:10

问题


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.


回答1:


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?



来源:https://stackoverflow.com/questions/23338556/deployment-using-capistrano-gitlab-using-via-remote-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!