在heroku雪松堆栈上部署sinatra应用程序(使用config.ru)

zlo*_*log 8 ruby deployment heroku sinatra

我正在尝试重构我的sinatra代码,将我的主文件分成单独的文件,使用此响应中的一些提示,我遇到了部署到heroku的麻烦.

以前我没有config.ru文件,只是使用了我的Procfile,这是:

web: bundle exec ruby web.rb -p $PORT
Run Code Online (Sandbox Code Playgroud)

根据这篇文章.

从重构开始,我现在改变了我Procfile的意思

web: bundle exec thin -R config.ru start -p $PORT
Run Code Online (Sandbox Code Playgroud)

随着我的config.ru文件正在

root = ::File.dirname(__FILE__)
require ::File.join( root, 'web' )
run MyApp.new
Run Code Online (Sandbox Code Playgroud)

我的web.rb文件包含在类定义中

class MyApp < Sinatra::Application
  # ...
end
Run Code Online (Sandbox Code Playgroud)

这适用于我的本地开发计算机,但是当我部署到heroku时,我得到了

2011-12-01T11:21:54+00:00 app[web.1]: bundler: command not found: thin
2011-12-01T11:21:54+00:00 app[web.1]: Install missing gem executables with `bundle install`
2011-12-01T11:21:56+00:00 heroku[web.1]: State changed from starting to crashed
2011-12-01T11:22:01+00:00 heroku[router]: Error H10 (App crashed) -> GET [my app].herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2011-12-01T11:22:02+00:00 heroku[router]: Error H10 (App crashed) -> GET [my app].herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
Run Code Online (Sandbox Code Playgroud)

瘦是没有安装在heroku上?或者是否有其他方法在heroku上运行我的应用程序?

zlo*_*log 9

我不得不更新我,Procfile因为RACK_ENV它没有传递到heroku环境.本Procfile变成了:

web: bundle exec thin -R config.ru start -p $PORT -e $RACK_ENV
Run Code Online (Sandbox Code Playgroud)