Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top