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: https://gist.github.com/mcr/49e8c7034658120013c1fe49da77c2ac

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

module Capistrano module DSL module Paths def deploy_to dir = @host.properties.fetch(:deploy_to) || 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 "server.client1.example.com", user: "client1", roles: %w{app db web}, deploy_to: '/client1/app/foobar' server "server.client2.example.com", user: "client2", roles: %w{app db web}, deploy_to: '/client2/app/foobar'

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


  • How to create the new target in Xcode for app extension using CMake?
  • Getting undefined symbol: __asan_memset when trying to use Clang address sanitizer
  • _cp_dispatch not getting called in cherrypy
  • Memory Requirement/Utilization for MongoDB, Riak and HyperTable (or HBase)
  • Sympy - fraction manipulation
  • Rails rubber - cap command not found
  • Can't open HTTP stream: Error opening file (../cap_ffmpeg_impl.hpp:529)
  • springboot + webpack dev server, does not change localhost bundle file after rebuilding
  • How can I selectively modify the src attributes of script tags in an HTML document using Perl?
  • Rails 4.1 environment variables not reloading
  • How to create a custom Powershell operator?
  • What is the use of a session store?
  • Using Laravel 5.4 pusher
  • Getting media player state in windows phone 7
  • npm 5.4.1 install/uninstall all failing
  • Suppressing passwd when calling sqlplus from shell script
  • Check for zero lines output from command over SSH
  • Run multiple queries from 1 SQL file showing result in multiple tables
  • Copy to all folders batch file?
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Jenkins: How To Build multiple projects from a TFS repository?
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Weird JavaScript statement, what does it mean?
  • How do you troubleshoot character encoding problems?
  • Apache 2.4 - remove | delete | uninstall
  • Invalid access key error using credentials redeemed from an amazon open id token
  • Circular dependency while pushing http interceptor
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to format a variable of double type
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • coudnt use logback because of log4j
  • Linking SubReports Without LinkChild/LinkMaster
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS