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

2023-11-21

我正在尝试重构我的 sinatra 代码以将我的主文件分成单独的文件,使用一些技巧这个回应,并且我在部署到 heroku 时遇到了麻烦。

以前我没有config.ru文件,并且刚刚使用了我的Procfile,即:

web: bundle exec ruby web.rb -p $PORT

as per 本文.

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

web: bundle exec thin -R config.ru start -p $PORT

With my config.ru文件存在

root = ::File.dirname(__FILE__)
require ::File.join( root, 'web' )
run MyApp.new

And my 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 上运行我的应用程序吗?


我必须更新我的Procfile因为RACK_ENV没有传递到 heroku 环境中。这Procfile became:

web: bundle exec thin -R config.ru start -p $PORT -e $RACK_ENV
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在heroku cedar堆栈上部署sinatra应用程序(使用config.ru) 的相关文章

随机推荐