我是编程新手,有一个在Heroku上运行的应用程序,对我来说,这只是一个沙盒,用来尝试编写工作代码。我碰巧看到Heroku入门指南(链接如下),该指南建议在部署Rails 4应用程序时使用Unicorn。
在本指南中,它指出“在推送到Heroku之前,您需要使用设置为生产的RACK_ENV进行测试,因为这是您的Heroku应用程序将在其中运行的环境。”在开发(本地机器)时,我决定尝试入门指南中的建议,它工作得很好。
现在我想为我的生产环境做这件事。不清楚您是否会遵循下面指南中的相同说明,将“开发”替换为“生产”。如果有人能证实这是否是我做这件事的正确方式,我将不胜感激。如果这不是正确的方式,请为我提供一些如何正确完成此操作的指导,也将不胜感激。
https://devcenter.heroku.com/articles/getting-started-with-rails4
发布于 2014-04-03 17:33:36
我们让独角兽在Heroku上像这样工作:
#Gemfile
group :production do
gem 'unicorn'
end
#Procfile
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
#config/unicorn.rb
# If you have a very small app you may be able to
# increase this, but in general 3 workers seems to
# work best
worker_processes 3
# Load your app into the master before forking
# workers for super-fast worker spawn times
preload_app true
# Immediately restart any workers that
# haven't responded within 30 seconds
timeout 30https://stackoverflow.com/questions/22828955
复制相似问题