0

我正在 Heroku 上部署 Rails 3.2.11 应用程序,并使用 Thin 作为我的服务器。当我推送到 Heroku 时,它启动 Thin 就好了,但它似乎也尝试启动 WEBrick。

我的Procfile如下:

网络:捆绑 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

为什么要这样做?我错过了什么?

4

2 回答 2

0

事实证明,我使用的一个插件 SyntaxHighlighter 在它的测试目录中有一些文件可以启动 WEBrick。我刚刚删除了那些,提交,推送,并且效果很好。

于 2013-04-11T17:00:20.060 回答
0

尝试使用 Thin 而不是 WEBrick。您可以通过简单地将其添加到您的 gemfile 来做到这一点:

gem 'thin'

然后运行bundle install,提交新的 Gemfile 和 Gemfile.lock,然后推送到 Heroku。

WEBrick 不适合生产使用。

于 2013-04-11T15:44:01.207 回答