Heroku上缺少配置目录 - config.ru中的LoadError

时间:2012-05-09 04:39:18

标签: ruby-on-rails heroku thin

更新
我现在知道(从运行heroku run bashls -la),部署到heroku后确实缺少config目录。然而,它存在于本地存储库中。


的.gitignore

/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3

# Ignore all logfiles and tempfiles.
/log/*.log
*.log
/tmp

将我的应用程序推送到heroku后,我得到/app/config/environment的LoadError,这在以前的版本中没有发生过。 未对config.ru进行任何更改。 文件config/environment.rb存在。

我尝试了回滚,但不能,因为之前的版本有不同的附加组件。

如何解决此错误?

Heroku日志:


2012-05-09T03:59:15+00:00 heroku[slugc]: Slug compilation started
2012-05-09T04:00:36+00:00 heroku[api]: Release v48 created by xxx
2012-05-09T04:00:36+00:00 heroku[api]: Deploy ac5eee6 by xxx
2012-05-09T04:00:36+00:00 heroku[web.1]: State changed from crashed to created
2012-05-09T04:00:36+00:00 heroku[web.1]: State changed from created to starting
2012-05-09T04:00:36+00:00 heroku[slugc]: Slug compilation finished
2012-05-09T04:00:44+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 6745`
2012-05-09T04:00:47+00:00 app[web.1]: /app/config.ru:3:in `require': no such file to load -- /app/config/environment (LoadError)
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/config.ru:3:in `block in <main>'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/config.ru:1:in `new'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/config.ru:1:in `<main>'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/rack/adapter/loader.rb:36:in `eval'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/rack/adapter/loader.rb:36:in `load'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/rack/adapter/loader.rb:45:in `for'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/controllers/controller.rb:169:in `load_adapter'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/controllers/controller.rb:73:in `start'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:185:in `run_command'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:151:in `run!'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/bin/thin:6:in `<top (required)>'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-05-09T04:00:47+00:00 app[web.1]: >> Using rack adapter
2012-05-09T04:00:48+00:00 heroku[web.1]: Process exited with status 1
2012-05-09T04:00:48+00:00 heroku[web.1]: State changed from starting to crashed

config.ru


# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
run ItAngel::Application

2 个答案:

答案 0 :(得分:0)

每次添加或删除配置变量时,使用发布管理http://blog.heroku.com/archives/2010/11/17/releases/,它应该创建一个新版本,因此即使您有不同的附加组件,您也应该可以回滚到以前的版本

你的Procfile有什么?尝试像这样指定RACK_ENV

web: bundle exec thin start -p $PORT -e $RACK_ENV

当您运行git push heroku master时,一切似乎都有效吗?

答案 1 :(得分:0)

我已经就我的应用程序的类似问题联系了heroku,我们发现删除文件.gitignore旁边的.slugignore文件修复了问题。

可能是你身边的同一案件,你可以在这里看到我的问题: why config folder is not pushed?

并查看我的问题的答案。

我希望这会有所帮助