【发布时间】:2012-01-10 13:46:57
【问题描述】:
我正在尝试使用this response 的一些提示重构我的 sinatra 代码以将我的主文件分成单独的文件,但我在部署到 heroku 时遇到了麻烦。
以前我没有config.ru 文件,只是使用了我的Procfile,即:
web: bundle exec ruby web.rb -p $PORT
根据this article。
通过重构,我现在将Procfile 更改为
web: bundle exec thin -R config.ru start -p $PORT
有了我的config.ru 文件
root = ::File.dirname(__FILE__)
require ::File.join( root, 'web' )
run MyApp.new
我的 web.rb 文件包含在类定义中
class MyApp < Sinatra::Application
# ...
end
这适用于我的本地开发计算机,但是当我部署到 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=
heroku 上没有安装 Thin 吗?或者是否有其他方法可以通过更改在 heroku 上运行我的应用程序?
【问题讨论】:
标签: ruby deployment heroku sinatra