a.barbieri
a.barbieri

Reputation: 2596

Capistrano Multiple Deploy Stages

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.

Upvotes: 1

Views: 1695

Answers (2)

Felipe M Andrada
Felipe M Andrada

Reputation: 117

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.

Upvotes: 0

Roman Kiselenko
Roman Kiselenko

Reputation: 44360

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

Upvotes: 5

Related Questions