2011-12-01 82 views
8

我試圖重構我的sinatra代碼以將我的主文件分隔爲單獨的文件,使用this response的一些提示,並且我正在將問題部署到heroku。在heroku雪松堆棧上部署sinatra應用程序(使用config.ru)

以前我沒有一個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 

這適用於我本地的開發ent電腦,但是當我部署到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上運行我的應用程序的變化?

回答

9

我必須更新我的Procfile,因爲RACK_ENV沒有傳遞到heroku環境。 Procfile變成了:

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

好的,所以我不需要改變config.ru使用Sinatra :: Application而不是MyApp.new。從答案中刪除它。 – zlog

相關問題