1

I have a Rails app and I would like to use Capistrano to deploy two versions: production and staging.

On my deploy.rb file I have: set :stages, ['staging', 'production']

Then how can I use two paths without overriding them?

set :deploy_to, '/home/deploy/Sites/staging/myname'

set :deploy_to, '/home/deploy/Sites/production/myname'

I've seen this answer but I'd like to keep the command line clean.

Community
  • 1
  • 1
a.barbieri
  • 2,398
  • 3
  • 30
  • 58

2 Answers2

5

Create two files under config/deploy/*.rb, production.rb and staging.rb, to the production.rb add set :deploy_to, '/home/deploy/Sites/production/myname', to the staging.rb add set :deploy_to, '/home/deploy/Sites/staging/myname'

Don't be lazy and read the Capistrano documentation

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
0

Any data from config/deploy.rb can be defined for specific environments in config/deploy/*

example of config/deploy/production.rb

set :stage, :production
set :rails_env, :production
set :branch, "master"

example of config/deploy/staging.rb

set :stage, :staging
set :rails_env, :staging
set :branch, "staging"

This works for me with two environments from different branchs. I hope you define the :deploy_to and server url specifically as well.