在heroku cedar堆栈上部署sinatra应用程序(使用config.ru)
我正在尝试使用此响应中的一些提示来重构我的 sinatra 代码,将我的主文件分成单独的文件,并且我在部署到 heroku 时遇到问题。
以前我没有 config.ru
文件,只使用了我的 Procfile
,它是:
web: bundle exec ruby web.rb -p $PORT
按照 这篇文章。
通过重构,我现在已将我的 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=
Is Thin notinstalled on heroku?或者是否有其他方法可以通过更改在 heroku 上运行我的应用程序?
I'm trying to refactor my sinatra code to separate my main file into separate files, using some tips from this response, and I'm having troubles deploying to heroku.
Previously I didn't have a config.ru
file, and just used my Procfile
, which was:
web: bundle exec ruby web.rb -p $PORT
as per this article.
From the refactor, I've now changed my Procfile
to
web: bundle exec thin -R config.ru start -p $PORT
With my config.ru
file being
root = ::File.dirname(__FILE__)
require ::File.join( root, 'web' )
run MyApp.new
And my web.rb
file being contained around a class definition
class MyApp < Sinatra::Application
# ...
end
This works on my local development computer, but when I deploy to heroku, I get
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=
Is thin not installed on heroku? Or is there some other way of running my app on heroku with the changes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我必须更新我的
Procfile
,因为RACK_ENV
未传递到 heroku 环境中。Procfile
变成:I had to update my
Procfile
because theRACK_ENV
isn't passed into the heroku environment. TheProcfile
became: