heroku sinatra app崩溃,错误h10

时间:2013-08-15 05:12:25

标签: ruby heroku sqlite sinatra

我是heroku和sinatra的新手,但我的本地应用程序在sinatra和sqlite3上正常运行。我知道heroku不支持sqlite3,所以我尝试了这个答案:Deploy RoR to Heroku and Sqlite3 fails

当我推送到heroku并试图访问它时,我收到了一个错误。所以我检查了日志。这就是我所看到的。我在这里看到其他人有同样的问题,但决议都是多种多样的,我尝试重新启动heroku:

2013-08-15T05:07:17+00:00 heroku[slug-compiler]: Slug compilation finished
2013-08-15T05:07:21.550961+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 28820`
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/sinatra-activerecord-1.2.3/lib/sinatra/activerecord.rb:23:in `database'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/app.rb:7:in `<top (required)>'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/sinatra-activerecord-1.2.3/lib/sinatra/activerecord.rb:17:in `database='
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/config.ru:2:in `block in <main>'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2013-08-15T05:07:25.339770+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:39:in `establish_connection'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2013-08-15T05:07:25.339770+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
2013-08-15T05:07:25.339194+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/config.ru:in `new'
2013-08-15T05:07:25.339770+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/rackup:23:in `load'
2013-08-15T05:07:25.339194+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:32:in `spec'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2013-08-15T05:07:25.339079+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:58:in `rescue in resolve_hash_connection': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile. (Gem::LoadError)
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1191:in `set'
2013-08-15T05:07:25.339079+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:55:in `resolve_hash_connection'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1917:in `block (2 levels) in delegate'
2013-08-15T05:07:25.339488+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
2013-08-15T05:07:25.339314+00:00 app[web.1]:    from /app/config.ru:2:in `require'
2013-08-15T05:07:25.339770+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
2013-08-15T05:07:25.339770+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/rackup:23:in `<main>'
2013-08-15T05:07:25.339770+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
2013-08-15T05:07:27.328918+00:00 heroku[web.1]: Process exited with status 1
2013-08-15T05:07:27.341978+00:00 heroku[web.1]: State changed from starting to crashed
2013-08-15T05:07:28.551518+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=intense-depths-3455.herokuapp.com fwd="70.179.10.147" dyno= connect= service= status=503 bytes=
2013-08-15T05:07:29.149180+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=intense-depths-3455.herokuapp.com fwd="70.179.10.147" dyno= connect= service= status=503 bytes=

关于如何让它发挥作用的任何想法? 我的配置是:

#config.ru
require "./app"
run Sinatra::Application

我的gemfile是:

source 'https://rubygems.org'

gem "sinatra"
gem "activerecord"
gem "sinatra-activerecord"
gem "pony"

group :development do
  gem "shotgun"
  gem "tux"
  gem "sqlite3", "~> 1.3.7", :require => "sqlite3"
end

1 个答案:

答案 0 :(得分:0)

我能够通过添加一行来在生产中使用postgresql来实现它。