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

时间:2022-10-18 20:38:17

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.

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

Previously I didn't have a config.ru file, and just used my Procfile, which was:

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

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

as per this article.

根据这篇文章。

From the refactor, I've now changed my Procfile to

从重构开始,我现在将我的Procfile更改为

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

With my config.ru file being

我的config.ru文件正在

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

And my web.rb file being contained around a class definition

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

class MyApp < Sinatra::Application
  # ...
end

This works on my local development computer, but when I deploy to heroku, I get

这适用于我的本地开发计算机,但是当我部署到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 not installed on heroku? Or is there some other way of running my app on heroku with the changes?

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

1 个解决方案

#1


9  

I had to update my Procfile because the RACK_ENV isn't passed into the heroku environment. The Procfile became:

我不得不更新我的Procfile,因为RACK_ENV没有传递到heroku环境。 Procfile成为:

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

#1


9  

I had to update my Procfile because the RACK_ENV isn't passed into the heroku environment. The Procfile became:

我不得不更新我的Procfile,因为RACK_ENV没有传递到heroku环境。 Procfile成为:

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