Instead of creating another symbolic link in the release catalog, I suggest using a multi-stage extension. With this extension, you can define different steps and add a custom configuration to them. Therefore, instead of using one deployment directory for production and production, use a separate one for each other.
Add these lines to deploy.rb:
require "capistrano/ext/multistage" set :stages, ["staging", "production"] set :default_stage, "staging"
Remove the deploy_to variable from deploy.rb. Then create a deployment directory inside the configuration that contains files with scene names. In this case: deploy / staging.rb and deploy / production.rb. Contents of staging.rb:
set :rails_env, "staging" set :deploy_to, "staging/capistrano"
And similarly for production.rb:
set :rails_env, "production" set :deploy_to, "production/capistrano"
Of course, change the paths in deploy_to. Then send staging.example.com to staging/capistrano/current/public and www.example.com to production/capistrano/current/public .
To deploy the intermediate version, run cap staging deploy or just cap deploy (remember that the installation was installed by default in deploy.rb) and cap production deploy to deploy to production.
source share