Capistrano deploy to different path on same server

I am trying to deploy my application using capistrano. But I want to deploy my application to multiple paths of the same server.For example If for the first run I want to deploy it to below path

set :deploy_to, '/home/a/some_path/

Once completed the first one it should run for the second path that will be

set :deploy_to, '/home/b/some_path/

and so on. Any suggestions how can I achieve this? Right now my single path deployment path is working AOK.


In your config file:

set :deploy_to, ENV["DEPLOY_PATH"]

Then, to deploy, run the command setting the DEPLOY_PATH variable:

DEPLOY_PATH="my/path" cap production deploy


Using capistrano 3.8.2, I monkeypatched lib/capistrano/dsl/paths.rb in my deploy.rb, but then I found that I needed more work to get git wrapper set up right when there where different deploy users. The result is at:

But, I'm leaving the essence of the content here:

module Capistrano module DSL module Paths def deploy_to dir = || fetch(:deploy_to) puts "For #{@host.hostname} deploy_to: #{dir}" dir end end end end

(You can take the puts out, and shorten it to a one-liner, but I found the extra debug useful)

One then does:

server "", user: "client1", roles: %w{app db web}, deploy_to: '/client1/app/foobar' server "", user: "client2", roles: %w{app db web}, deploy_to: '/client2/app/foobar'

where and are CNAMEs or duplicate A/AAAA records for the same server. This also isolates the question of where each client is to DNS.

人吐槽 人点赞



用户名: 密码:
验证码: 匿名发表


查看评论:Capistrano deploy to different path on same server