簡體   English   中英

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

[英]Deploying sinatra app (with config.ru) on heroku cedar stack

我正在嘗試重構我的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=

瘦是沒有安裝在heroku上? 或者是否有其他方法在heroku上運行我的應用程序?

我不得不更新我的Procfile因為RACK_ENV沒有傳遞到heroku環境。 Procfile成為:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM