将Sinatra应用程序部署到Heroku时出现错误H10

时间:2014-11-02 03:54:02

标签: ruby heroku deployment sinatra httparty

我无法将我的应用部署到Heroku。太令人沮丧了。

以下是存储库:repository link

我尝试过的事情:

  • 我已根据找到的here
  • 的heroku部署页面更新了我的config.ru
  • 我已经heroku run rake db:migrate
  • 我已经heroku restart
  • 我确保我有一个更新的gemfile
  • 我仔细检查过我的app.rb
  • 中有'require'语句

有什么想法?我得到的错误日志如下:

2014-11-02T03:46:07.404128+00:00 heroku[api]: Deploy bbe19c1 by johnsalzarulo@gmail.com
2014-11-02T03:46:07.404202+00:00 heroku[api]: Release v17 created by johnsalzarulo@gmail.com
2014-11-02T03:46:08.439283+00:00 heroku[web.1]: State changed from crashed to starting
2014-11-02T03:46:11.353727+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 43798`
2014-11-02T03:46:13.210413+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2014-11-02T03:46:13.210411+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2014-11-02T03:46:13.210388+00:00 app[web.1]: /app/config.ru:1:in `require': cannot load such file -- ./gifinder (LoadError)
2014-11-02T03:46:13.210410+00:00 app[web.1]:    from /app/config.ru:1:in `block in <main>'
2014-11-02T03:46:13.210424+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2014-11-02T03:46:13.210425+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2014-11-02T03:46:13.210414+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-11-02T03:46:13.210415+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-11-02T03:46:13.210417+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2014-11-02T03:46:13.210419+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2014-11-02T03:46:13.210418+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2014-11-02T03:46:13.210421+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
2014-11-02T03:46:13.210427+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
2014-11-02T03:46:13.210430+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
2014-11-02T03:46:13.210432+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
2014-11-02T03:46:13.210434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/bin/rackup:23:in `load'
2014-11-02T03:46:13.210437+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.1.0/bin/rackup:23:in `<main>'
2014-11-02T03:46:13.977897+00:00 heroku[web.1]: State changed from starting to crashed
2014-11-02T03:46:13.970947+00:00 heroku[web.1]: Process exited with status 1
2014-11-02T03:46:15.252296+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gifinder.herokuapp.com request_id=7106f663-fa15-4c74-ab8e-f5df75030a55 fwd="174.129.111.111" dyno= connect= service= status=503 bytes=
2014-11-02T03:46:42.265175+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gifinder.herokuapp.com request_id=900cbb04-7ee9-4392-9f2f-7d4e833b15c0 fwd="24.43.108.83" dyno= connect= service= status=503 bytes=
2014-11-02T03:46:43.407062+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gifinder.herokuapp.com request_id=ce46eed0-4a7f-4633-81ec-c826a3c90e30 fwd="24.43.108.83" dyno= connect= service= status=503 bytes=

2 个答案:

答案 0 :(得分:3)

您的config.ru文件正在尝试使用require语句加载不存在的文件。将此行require './gifinder'更改为:

require './app'

或,将app.rb的文件名更改为gifinder.rb。您还应该遵循iain的建议并删除双重Gemfile.lock,因为这必然会导致问题。

您对HTTParty的要求也应该是小写的。我通过将需求更改为全部小写来获取您的仓库并使其在heroku上运行:

require 'httparty'

答案 1 :(得分:0)

我不知道你是怎么做到的,但你有两个Gemfile.lock。我删除它们并重新运行Bundler,git rm那个不应该在那里的。

另请注意,Heroku现在使用procfiles比以前更广泛,所以掌握Foreman和define a procfile


此外,当我运行bundle install --binstubs --path=vendor时,我收到此消息:

  

来自heroku的安装后消息:! heroku宝石一直是   弃用并替换为Heroku Toolbelt。 !下载和   安装自:https://toolbelt.heroku.com!有关API访问权限,请参阅:   https://github.com/heroku/heroku.rb

所以从app.rb中移除Gemfile中的gem 'heroku', '~> 3.15.0'require 'heroku'(应用程序中从未需要)。当我这样做时,命令bin/rackup config.ru在localhost上为我运行应用程序:9292就好了。