2014-01-28 45 views
2

我正在將Rails應用程序部署到服務器。如果我只需要production,我可以輕鬆完成所有任務。但我也需要staging無法爲Rails應用程序設置登臺環境

啓動我的麒麟服務器使用以下命令:

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 

但不管我的命令,服務器production環境啓動應用程序。

在我的應用程序中還有另一個地方,我應該指定環境爲staging

謝謝!

+1

您確定您在應用程序配置中添加了臨時環境嗎?請參閱http://stackoverflow.com/questions/19344267/adding-a-staging-environment-to-the-workflow – Agis

回答

3

在運行該命令之前設置環境變量RAILS_ENV=staging。你可以做到這一點在同一條線上,甚至(在擊):

$ RAILS_ENV=staging bundle exec unicorn...

你將不得不在多個文件,如config/environments/config/database.yml設置環境。

相關問題