user3618929
user3618929

Reputation: 143

how to set RAILS_ENV to staging when deployed by "$ cap staging deploy"

Capistrano 3.1 is used to deploy rails app 4.1.0

I specify different databases for production and staging in my database.yml

After I deployed with "$ cap staging deploy", everything is fine, except that the production database is used, instead of the staging database.

I guess RAILS_ENV on the server has NOT been set correctly, how can I do that? Any suggestions?

Thanks

Upvotes: 3

Views: 3028

Answers (2)

user3618929
user3618929

Reputation: 143

Modify the staging server, and set unicorn start flag from "-E production" to "-E staging". Fix this issue.

Upvotes: 0

peterept
peterept

Reputation: 4427

I assume you have installed the Capistrano Rails Gem and it is performing the rake db:migrate for you.

The default behaviour is to use the stage name for RAILS_ENV, eg: RAILS_ENV="staging".

If you need it to be something else, in your deploy/staging.rb, you can use:

set :rails_env, 'testing'

Upvotes: 1

Related Questions