所以我在过去几个小时里一直在尝试各种各样的希望我可以解决这个问题,但是我已经陷入困境并不得不寻求帮助......
我尝试使用PostgreSQL和Datamapper将基于Sinatra的应用程序部署到Heroku。
重新启动dyno没有帮助,并且使用Shotgun(看起来像WEBrick 1.3.1)在本地工作正常。
Heroku记录:
2014-09-15T00:44:16.620710+00:00 heroku[web.1]: State changed from crashed to starting
2014-09-15T00:44:18.868126+00:00 heroku[web.1]: Starting process with command `bundle exec ruby app.rb -p 55219`
2014-09-15T00:44:21.353588+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1497:in `start_server': undefined method `run' for HTTP:Module (NoMethodError)
2014-09-15T00:44:21.353629+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1435:in `run!'
2014-09-15T00:44:21.353657+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/main.rb:25:in `block in <module:Sinatra>'
2014-09-15T00:44:22.014311+00:00 heroku[web.1]: State changed from starting to crashed
2014-09-15T00:44:22.005268+00:00 heroku[web.1]: Process exited with status 1
2014-09-15T00:44:23.532489+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-retreat-7648.herokuapp.com request_id=df6fe1b9-9868-49b0-83e1-fc57dd1c3e63 fwd="86.161.84.51" dyno= connect= service= status=503 bytes=
app.rb的部分内容:
require 'sinatra'
require 'data_mapper'
require 'twitter'
...
configure :development do
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/development.db")
end
configure :production do
DataMapper.setup(:default, ENV['HEROKU_POSTGRESQL_BLUE_URL'])
end
...
DataMapper.finalize.auto_upgrade!
的Gemfile:
source 'http://rubygems.org'
ruby '2.1.2'
gem 'sinatra'
gem 'twitter'
gem 'dm-aggregates'
gem 'dm-constraints'
gem 'dm-core'
gem 'dm-migrations'
gem 'dm-serializer'
gem 'dm-timestamps'
gem 'dm-types'
gem 'dm-validations'
gem 'data_mapper'
group :development do
gem 'sqlite3'
gem 'dm-sqlite-adapter'
gem 'do_sqlite3'
end
group :production do
gem 'pg'
gem 'do_postgres'
gem 'dm-postgres-adapter'
end
config.ru:
require './app'
run Sinatra::Application
Procfile:
web: bundle exec ruby app.rb -p $PORT
database.yml中:
development:
adapter: postgresql
host: localhost
username: user
database: development
如果您有任何想法,我将非常感谢您的帮助。
谢谢。