2

I'm deploying Rails application to server. I can easily accomplish everything if I need only production. But I need staging as well.

I launch my unicorn server with the following command:

bundle exec /home/deployer/apps/myapp/shared/bundle/ruby/2.0.0/bin/unicorn_rails \
-D -c /home/deployer/apps/myapp/shared/config/unicorn.config.rb -E staging

But regardless of my command, the server launches application with production environment.

Is there another place in my application where I should specify environment to be staging?

Thanks!

Alex Smolov
  • 1,831
  • 4
  • 24
  • 43
  • 1
    Are you sure you have added a staging environment in your apps configuration? Refer to http://stackoverflow.com/questions/19344267/adding-a-staging-environment-to-the-workflow – Agis Jan 28 '14 at 19:42

1 Answers1

3

Set the environment variable RAILS_ENV=staging before you run the command. You can do it on the same line even (in Bash):

$ RAILS_ENV=staging bundle exec unicorn...

You would have to have the environment set up in multiple files such as config/environments/ and config/database.yml.

Chloe
  • 25,162
  • 40
  • 190
  • 357