我正在使用Thin作为我的服务器在Heroku上部署Rails 3.2.11应用程序。当我推送到Heroku时,它很好地启动了Thin,但是它似乎也尝试启动WEBrick。
我的Procfile如下:
web:bundle exec rails server -p $ PORT thin -e $ RACK_ENV
我的Heroku记录:
2013-04-11T14:52:28.276634+00:00 heroku[api]: Release v21 created by XXXXXX@gmail.com
2013-04-11T14:52:28.331285+00:00 heroku[api]: Deploy 6f63ed4 by XXXXXX@gmail.com
2013-04-11T14:52:28.432372+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-11T14:52:28.965697+00:00 heroku[slugc]: Slug compilation finished
2013-04-11T14:52:30.218480+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 9009 thin -e $RACK_ENV`
2013-04-11T14:52:32.898285+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-11T14:52:32.897830+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-11T14:52:34.350938+00:00 app[web.1]: [2013-04-11 14:52:34] INFO WEBrick::HTTPServer#start: pid=2 port=2010
2013-04-11T14:52:34.350132+00:00 app[web.1]: [2013-04-11 14:52:34] INFO WEBrick 1.3.1
2013-04-11T14:52:34.350707+00:00 app[web.1]: [2013-04-11 14:52:34] WARN TCPServer Error: Address already in use - bind(2)
2013-04-11T14:52:34.350132+00:00 app[web.1]: [2013-04-11 14:52:34] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-04-11T14:52:34.407830+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-04-11T14:52:34.407675+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 2010, should be 9009 (see environment variable PORT)
2013-04-11T14:52:35.572955+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-11T14:52:35.560772+00:00 heroku[web.1]: Process exited with status 137
为什么这样做?我错过了什么?
答案 0 :(得分:0)
尝试使用Thin而不是WEBrick。你可以通过简单地将它添加到你的gemfile来实现:
gem 'thin'
然后运行bundle install
,提交新的Gemfile和Gemfile.lock,然后推送到Heroku。
WEBrick不适合生产使用。
答案 1 :(得分:0)
事实证明,我使用的插件SyntaxHighlighter在其测试目录中有一些文件启动了WEBrick。我刚刚删除了那些,承诺,推送,并且它运行良好。