2013-02-04 90 views
1

我正在嘗試部署我的應用程序在Heroku 它包含5個文件,一個簡單的機架應用程序時 1.config.ru 與代碼應用程序錯誤部署在Heroku

require 'rack' 
require './myapp' 

run MyApp.new 

2.Gemfile 與代碼

其中創建自動 4.myapp.rb與代碼
source "http://rubygems.org" 
gem 'grape' 
gem 'sequel' 
gem 'heroku' 
gem 'rake' 
gem 'pg' 
gem 'rack' 
group :test do 
    gem "rspec", "~> 2.12.0" 
    gem "rack-test", "~> 0.6.2" 
    gem "rspec-core", "~> 2.12.2" 
    gem "rspec-expectations", "~> 2.12.1" 
    gem "rspec-mocks", "~> 2.12.1" 
    gem "capybara", "~> 2.0.2" 
    gem "nokogiri", "~> 1.5.6" 
end 

3.Gemfile.lock

# my_app.rb 
class MyApp 
    def call env 
    [200, {"Content-Type" => "text/html"}, ["Hello Rack Participants"]] 
    end 
end 

5.Procfile與代碼

web: bundle exec rackup config.ru 

然後我打電話捆綁rackup config.ru 後安裝

其預期 但在那之後我嘗試將它部署在Heroku上的工作完全正常並得到應用程序錯誤 我執行以下命令爲此

git init 
git add . 
git commit -m "initial commit" 
heroku create 
git push heroku master 
heroku open 

Web瀏覽器與應用程序錯誤 開放當我運行命令Heroku的日誌 那麼它給我註銷

2013-02-04T05:34:17+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=quiet-caverns-8170.herokuapp.com fwd=121.245.34.235 dyno= queue= wait= connect= service= status=503 bytes= 

任何一個可以請幫助爲什麼我收到在Heroku和hopw這個錯誤糾正它?

這裏充滿了日誌的Heroku

2013-02-04T05:30:44+00:00 heroku[api]: Scale to web=1 by [email protected] 
2013-02-04T05:30:44+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_CYAN resource by [email protected] 
2013-02-04T05:30:44+00:00 heroku[api]: Release v3 created by [email protected] 
2013-02-04T05:30:45+00:00 heroku[api]: Add DATABASE_URL config by [email protected] 
2013-02-04T05:30:45+00:00 heroku[api]: Release v4 created by [email protected] 
2013-02-04T05:30:45+00:00 heroku[api]: Add config by [email protected] 
2013-02-04T05:30:45+00:00 heroku[api]: Release v5 created by [email protected] 
2013-02-04T05:30:45+00:00 heroku[api]: Release v6 created by [email protected] 
2013-02-04T05:30:45+00:00 heroku[api]: Deploy 243e86c by [email protected] 
2013-02-04T05:30:51+00:00 heroku[web.1]: Starting process with command `bundle exec ruby web.rb` 
2013-02-04T05:30:52+00:00 app[web.1]: bash: bundle: command not found 
2013-02-04T05:30:53+00:00 heroku[web.1]: Process exited with status 127 
2013-02-04T05:30:56+00:00 heroku[web.1]: Starting process with command `bundle exec ruby web.rb` 
2013-02-04T05:30:58+00:00 app[web.1]: ruby: No such file or directory -- web.rb (LoadError) 
2013-02-04T05:31:00+00:00 heroku[web.1]: Process exited with status 1 
2013-02-04T05:31:00+00:00 heroku[web.1]: State changed from starting to crashed 
2013-02-04T05:31:00+00:00 heroku[web.1]: State changed from crashed to starting 
2013-02-04T05:31:13+00:00 heroku[web.1]: Starting process with command `bundle exec ruby web.rb` 
2013-02-04T05:31:19+00:00 heroku[web.1]: State changed from starting to crashed 
2013-02-04T05:31:22+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=quiet-caverns-8170.herokuapp.com fwd=121.245.34.235 dyno= queue= wait= connect= service= status=503 bytes= 
2013-02-04T05:31:22+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=quiet-caverns-8170.herokuapp.com fwd=121.245.34.235 dyno= queue= wait= connect= service= status=503 bytes= 
2013-02-04T05:31:18+00:00 app[web.1]: ruby: No such file or directory -- web.rb (LoadError) 
2013-02-04T05:31:19+00:00 heroku[web.1]: Process exited with status 1 
2013-02-04T05:33:42+00:00 heroku[slugc]: Slug compilation started 
2013-02-04T05:33:52+00:00 heroku[api]: Release v7 created by [email protected] 
2013-02-04T05:33:52+00:00 heroku[api]: Deploy eb490fb by [email protected] 
2013-02-04T05:33:52+00:00 heroku[web.1]: State changed from crashed to starting 
2013-02-04T05:33:53+00:00 heroku[slugc]: Slug compilation finished 
2013-02-04T05:33:59+00:00 heroku[web.1]: State changed from starting to crashed 
2013-02-04T05:34:17+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=quiet-caverns-8170.herokuapp.com fwd=121.245.34.235 dyno= queue= wait= connect= service= status=503 bytes= 
2013-02-04T05:33:55+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru` 
2013-02-04T05:33:58+00:00 heroku[web.1]: Stopping process with SIGKILL 
2013-02-04T05:33:57+00:00 app[web.1]: [2013-02-04 05:33:57] INFO WEBrick::HTTPServer#start: pid=2 port=9292 
2013-02-04T05:33:58+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 9292, should be 16705 (see environment variable PORT) 
2013-02-04T05:33:57+00:00 app[web.1]: [2013-02-04 05:33:57] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux] 
2013-02-04T05:33:57+00:00 app[web.1]: [2013-02-04 05:33:57] INFO WEBrick 1.3.1 
2013-02-04T05:33:59+00:00 heroku[web.1]: Process exited with status 137 
2013-02-04T05:41:22+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru` 
2013-02-04T05:41:19+00:00 heroku[web.1]: State changed from crashed to starting 
2013-02-04T05:41:24+00:00 app[web.1]: [2013-02-04 05:41:24] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux] 
2013-02-04T05:41:24+00:00 app[web.1]: [2013-02-04 05:41:24] INFO WEBrick 1.3.1 
2013-02-04T05:41:24+00:00 app[web.1]: [2013-02-04 05:41:24] INFO WEBrick::HTTPServer#start: pid=2 port=9292 
2013-02-04T05:41:25+00:00 heroku[web.1]: Stopping process with SIGKILL 
2013-02-04T05:41:25+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 9292, should be 46347 (see environment variable PORT) 
2013-02-04T05:41:26+00:00 heroku[web.1]: Process exited with status 137 
2013-02-04T05:41:26+00:00 heroku[web.1]: State changed from starting to crashed 
2013-02-04T05:51:59+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 9292, should be 15335 (see environment variable PORT) 
2013-02-04T05:51:57+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru` 
2013-02-04T05:51:59+00:00 app[web.1]: [2013-02-04 05:51:59] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux] 
2013-02-04T05:51:59+00:00 app[web.1]: [2013-02-04 05:51:59] INFO WEBrick 1.3.1 
2013-02-04T05:51:59+00:00 heroku[web.1]: Stopping process with SIGKILL 
2013-02-04T05:51:59+00:00 app[web.1]: [2013-02-04 05:51:59] INFO WEBrick::HTTPServer#start: pid=2 port=9292 
2013-02-04T05:52:01+00:00 hero 
ku[web.1]: Process exited with status 137 
2013-02-04T05:55:18+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=quiet-caverns-8170.herokuapp.com fwd=121.245.34.235 dyno= queue= wait= connect= service= status=503 bytes= 
2013-02-04T05:55:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=quiet-caverns-8170.herokuapp.com fwd=121.245.34.235 dyno= queue= wait= connect= service= status=503 bytes= 
2013-02-04T06:01:58+00:00 heroku[web.1]: State changed from crashed to starting 
2013-02-04T06:02:04+00:00 heroku[web.1]: State changed from starting to crashed 
2013-02-04T06:12:11+00:00 heroku[web.1]: State changed from crashed to starting 
2013-02-04T06:12:14+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru` 
2013-02-04T06:12:18+00:00 heroku[web.1]: Stopping process with SIGKILL 
2013-02-04T06:12:17+00:00 app[web.1]: [2013-02-04 06:12:17] INFO WEBrick 1.3.1 
2013-02-04T06:12:17+00:00 app[web.1]: [2013-02-04 06:12:17] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux] 
2013-02-04T06:12:17+00:00 app[web.1]: [2013-02-04 06:12:17] INFO WEBrick::HTTPServer#start: pid=2 port=9292 
2013-02-04T06:12:18+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 9292, should be 35684 (see environment variable PORT) 
2013-02-04T06:12:19+00:00 heroku[web.1]: State changed from starting to crashed 
2013-02-04T06:12:19+00:00 heroku[web.1]: Process exited with status 137 
+0

我會看你發佈的行前後的行,有時會有更多的信息。當我不得不執行db:migrate但是爲了時,我遇到了類似的問題。 – PeppyHeppy

+0

不,你可以看到有沒有數據庫遷移其簡單的耙子應用程序等待發布完整的日誌 –

+0

現在請幫助爲什麼我得到這個錯誤 –

回答

1

您還沒有$PORT綁定到端口,所以我們殺死你的進程。您必須將您的Procfile更改爲包括-p $PORT

+0

感謝回覆 –