Create a symlink to the original app and set up the second app's vhost by pointing it at the symlink's public path. That works for us (only we have 10 vhosts).
If you use a capistrano deploy, you will need to set up an after hook to create that symlink. Something like this (again, we have 10, so it's a loop):
desc "Symlink the clones"
task :custom_symlink, :roles => :app, :except => { :no_release => true } do
on_rollback do
(1..vhosts).to_a.each do |vhost|
current_vhost_path = "#{deploy_to}/#{subdomain}#{vhost}"
run "rm -f #{current_vhost_path}; ln -s #{previous_release} #{current_vhost_path}; true"
end
end
(1..vhosts).to_a.each do |vhost|
current_vhost_path = "#{deploy_to}/#{subdomain}#{vhost}"
run "rm -f #{current_vhost_path} && ln -s #{release_path} #{current_vhost_path}"
end
end
after "deploy:symlink", :custom_symlink
And, note that this is the paranoid version here, so if it's a rollback, we reset to the previous release.
Regards, Lori