我的所有文件都可以在 GitHub 上找到:https ://github.com/Integralist/Passage (以防万一您需要查看我正在使用的内容)。
我是 Heroku 的新手,我尝试按照说明上传 Sinatra 应用程序,但它无法运行,当我访问应用程序 URL 时,我收到一条通用的“应用程序错误”消息。
我的设置过程如下:
heroku login
heroku create --stack cedar
创建config.ru
文件并添加内容...
require 'app'
run Sinatra::Application
创建一个 Gemfile 文件(无文件扩展名)并添加内容...
source 'http://rubygems.org'
gem 'sinatra', '1.3.2'
gem 'thin', '1.3.1'
打开终端(我正在运行 Mac OS X)并执行:bundle install
这似乎生成了一个重复的 Gemfile 但这次带有 .lock 文件扩展名?这另一个 Gemfile 现在具有以下内容...
GEM
remote: http://rubygems.org/
specs:
daemons (1.1.8)
eventmachine (0.12.10)
rack (1.4.1)
rack-protection (1.2.0)
rack
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.3.3)
PLATFORMS
ruby
DEPENDENCIES
sinatra (= 1.3.2)
thin (= 1.3.1)
然后我创建一个Procfile
(无文件扩展名)并添加内容:web: bundle exec ruby app.rb -p $PORT
(app.rb 显然是我的主应用程序文件的名称)。
然后,我使用 Git 将我的文件暂存/提交/推送到相关的 Heroku 存储库。
但如果我跑步,heroku ps
我会...
=== web: `bundle exec ruby app.rb -p`
web.1: crashed for 1m
然后,如果我跑步,heroku logs
我会...
2012-06-09T18:35:41+00:00 heroku[slugc]: Slug compilation started
2012-06-09T18:36:37+00:00 heroku[api]: Add LANG, PATH, RACK_ENV, GEM_PATH config by email@domain.com
2012-06-09T18:36:37+00:00 heroku[api]: Release v2 created by email@domain.com
2012-06-09T18:36:38+00:00 heroku[api]: Release v3 created by email@domain.com
2012-06-09T18:36:38+00:00 heroku[api]: Deploy e26921b by email@domain.com
2012-06-09T18:36:38+00:00 heroku[web.1]: State changed from created to starting
2012-06-09T18:36:38+00:00 heroku[slugc]: Slug compilation finished
2012-06-09T18:36:40+00:00 heroku[web.1]: Starting process with command `bundle exec ruby app.rb -p`
2012-06-09T18:36:41+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/main.rb:15:in `<class:Application>': missing argument: -p (OptionParser::MissingArgument)
2012-06-09T18:36:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/main.rb:4:in `<module:Sinatra>'
2012-06-09T18:36:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/main.rb:3:in `<top (required)>'
2012-06-09T18:36:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra.rb:5:in `require'
2012-06-09T18:36:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra.rb:5:in `<top (required)>'
2012-06-09T18:36:41+00:00 app[web.1]: from app.rb:12:in `require'
2012-06-09T18:36:41+00:00 app[web.1]: from app.rb:12:in `<main>'
2012-06-09T18:36:42+00:00 heroku[web.1]: Process exited with status 1
2012-06-09T18:36:42+00:00 heroku[web.1]: State changed from starting to crashed
2012-06-09T18:36:42+00:00 heroku[web.1]: State changed from crashed to created
2012-06-09T18:36:42+00:00 heroku[web.1]: State changed from created to starting
2012-06-09T18:36:44+00:00 heroku[web.1]: Starting process with command `bundle exec ruby app.rb -p`
2012-06-09T18:36:45+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/main.rb:15:in `<class:Application>': missing argument: -p (OptionParser::MissingArgument)
2012-06-09T18:36:45+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/main.rb:4:in `<module:Sinatra>'
2012-06-09T18:36:45+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/main.rb:3:in `<top (required)>'
2012-06-09T18:36:45+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra.rb:5:in `require'
2012-06-09T18:36:45+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra.rb:5:in `<top (required)>'
2012-06-09T18:36:45+00:00 app[web.1]: from app.rb:12:in `require'
2012-06-09T18:36:45+00:00 app[web.1]: from app.rb:12:in `<main>'
2012-06-09T18:36:47+00:00 heroku[web.1]: Process exited with status 1
2012-06-09T18:36:47+00:00 heroku[web.1]: State changed from starting to crashed
2012-06-09T18:42:09+00:00 heroku[router]: Error H10 (App crashed) -> GET furious-wind-9309.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-06-09T18:42:09+00:00 heroku[router]: Error H10 (App crashed) -> GET furious-wind-9309.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-06-09T18:42:38+00:00 heroku[router]: Error H10 (App crashed) -> GET furious-wind-9309.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-06-09T18:42:39+00:00 heroku[router]: Error H10 (App crashed) -> GET furious-wind-9309.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
有人可以解释问题是什么以及我该如何解决它。
谢谢。