2014-01-28 46 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设置环境。

相关问题