我的所有文件都可以在GitHub上找到:https://github.com/Integralist/Passage(以防万一您需要查看我的工作内容)。无法使用Heroku使用基本的Ruby/Sinatra应用程序?
我是新来的Heroku,我尝试了之后得到一个末日的应用程序上传的,但它只是不运行,当我访问应用程序的URL,我得到一个通用的“应用程序错误”消息的指令。
我的设置过程一直如下:
heroku login
heroku create --stack cedar
创建config.ru
文件,并添加内容...
require 'app'
run Sinatra::Application
创建Gemfile文件(无文件扩展名)并添加c ontent ...
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 protected]
2012-06-09T18:36:37+00:00 heroku[api]: Release v2 created by [email protected]
2012-06-09T18:36:38+00:00 heroku[api]: Release v3 created by [email protected]
2012-06-09T18:36:38+00:00 heroku[api]: Deploy e26921b by [email protected]
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=
有人可以解释的问题是什么,以及如何我可以请修复它。
谢谢。
你的'app.rb'里有什么?既然你使用的是'Procfile',你的'config.ru'没有初始化服务器,'app.rb'(来自'ruby app.rb'命令)。 – redhotvengeance