0

我在部署到 Heroku 时遇到问题,我已经安装了 postgresql,但我认为我没有正确配置它。这可能是问题,也可能不是问题,但我有一种预感,这与它有关。请指教。

博客的 git:https ://github.com/Apane/Blogit_blog

更新了 Heroku 日志

    2013-05-25T02:32:07.946326+00:00 app[web.1]:     1: <div class="right1">
2013-05-25T02:32:07.946326+00:00 app[web.1]:     2: <%= login_required class: "actions", id: "new_blog_post_link" do %>
2013-05-25T02:32:07.946326+00:00 app[web.1]:     3:   <%= link_to t(:new_blog_post, scope: 'blogit.posts'), new_post_path %>
2013-05-25T02:32:07.941979+00:00 app[web.1]:   Rendered blogit/posts/index.html.erb within layouts/application (91.1ms)
2013-05-25T02:32:07.946326+00:00 app[web.1]: 
2013-05-25T02:32:07.946326+00:00 app[web.1]: ActionView::Template::Error (unknown attribute: name):
2013-05-25T02:32:07.946326+00:00 app[web.1]:   app/controllers/application_controller.rb:5:in `current_user'
2013-05-25T02:32:07.946326+00:00 app[web.1]: 
2013-05-25T02:32:07.946665+00:00 app[web.1]: 
2013-05-25T02:32:07.946326+00:00 app[web.1]:   app/views/blogit/posts/index.html.erb:2:in `_app_views_blogit_posts_index_html_erb__3752095678148312245_34603300'
2013-05-25T02:32:07.946326+00:00 app[web.1]:     5: </div>
2013-05-25T02:32:07.946326+00:00 app[web.1]:     4: <% end %>
2013-05-25T02:32:07.997684+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-05-25T02:32:07.997684+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-05-25T02:32:10.467911+00:00 heroku[web.1]: Process exited with status 137
2013-05-25T02:37:19.248690+00:00 heroku[slugc]: Slug compilation started
2013-05-25T02:38:02.467323+00:00 heroku[api]: Deploy de08b17 by "email"
2013-05-25T02:38:02.493201+00:00 heroku[api]: Release v9 created by "email"
2013-05-25T02:38:02.544564+00:00 heroku[api]: Deploy de08b17 by "email"
2013-05-25T02:38:03.445329+00:00 heroku[slugc]: Slug compilation finished
2013-05-25T02:38:04.208989+00:00 heroku[web.1]: State changed from up to starting
2013-05-25T02:38:06.350047+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 41915`
2013-05-25T02:38:07.613671+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-05-25T02:38:08.321413+00:00 app[web.1]: [2013-05-25 02:38:08] ERROR SignalException: SIGTERM
2013-05-25T02:38:08.321413+00:00 app[web.1]:    /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2013-05-25T02:38:15.184606+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T02:38:15.184606+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T02:38:15.187273+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T02:38:16.758556+00:00 app[web.1]: [Blogit]: Blogit::Configuration#rss_feed_language has been deprecated. You can remove this from your blogit.rb configuration file
2013-05-25T02:38:17.431528+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-05-25T02:38:17.431823+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-05-25T02:38:18.932239+00:00 app[web.1]: [2013-05-25 02:38:18] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-05-25T02:38:18.932504+00:00 app[web.1]: [2013-05-25 02:38:18] INFO  WEBrick::HTTPServer#start: pid=2 port=41915
2013-05-25T02:38:18.932239+00:00 app[web.1]: [2013-05-25 02:38:18] INFO  WEBrick 1.3.1
2013-05-25T02:38:19.138465+00:00 heroku[web.1]: State changed from starting to up
2013-05-25T02:38:19.286419+00:00 heroku[web.1]: Process exited with status 137
2013-05-25T02:38:24.702435+00:00 app[web.1]: Started GET "/" for 99.233.170.104 at 2013-05-25 02:38:24 +0000
2013-05-25T02:38:24.702435+00:00 app[web.1]: => Call with -d to detach
2013-05-25T02:38:24.702435+00:00 app[web.1]: => Booting WEBrick
2013-05-25T02:38:24.702435+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:41915
2013-05-25T02:38:24.702435+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-05-25T02:38:24.865680+00:00 app[web.1]: Processing by Blogit::PostsController#index as HTML
2013-05-25T02:38:25.061058+00:00 app[web.1]:   Rendered blogit/posts/index.html.erb within layouts/application (130.6ms)
2013-05-25T02:38:25.061376+00:00 app[web.1]: Completed 500 Internal Server Error in 196ms
2013-05-25T02:38:25.063272+00:00 app[web.1]: 
2013-05-25T02:38:25.063272+00:00 app[web.1]: ActionView::Template::Error (unknown attribute: name):
2013-05-25T02:38:25.063272+00:00 app[web.1]:     1: <div class="right1">
2013-05-25T02:38:25.063092+00:00 heroku[router]: at=info method=GET path=/ host=infinite-springs-1056.herokuapp.com fwd="99.233.170.104" dyno=web.1 connect=3ms service=407ms status=500 bytes=643
2013-05-25T02:38:25.063272+00:00 app[web.1]:     2: <%= login_required class: "actions", id: "new_blog_post_link" do %>
2013-05-25T02:38:25.063272+00:00 app[web.1]:     4: <% end %>
2013-05-25T02:38:25.063585+00:00 app[web.1]: 
2013-05-25T02:38:25.063272+00:00 app[web.1]:     3:   <%= link_to t(:new_blog_post, scope: 'blogit.posts'), new_post_path %>
2013-05-25T02:38:25.063272+00:00 app[web.1]:     5: </div>
2013-05-25T02:38:25.063272+00:00 app[web.1]:   app/views/blogit/posts/index.html.erb:2:in `_app_views_blogit_posts_index_html_erb___1859728747634219045_31435420'
2013-05-25T02:38:25.063272+00:00 app[web.1]: 
2013-05-25T02:38:25.063272+00:00 app[web.1]:   app/controllers/application_controller.rb:5:in `current_user'
2013-05-25T02:39:31.009984+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by "email"
2013-05-25T02:39:35.228241+00:00 heroku[run.1589]: Awaiting client
2013-05-25T02:39:35.254224+00:00 heroku[run.1589]: Starting process with command `bundle exec rake db:migrate`
2013-05-25T02:39:36.715005+00:00 heroku[run.1589]: State changed from starting to up
2013-05-25T02:39:43.583619+00:00 heroku[run.1589]: Process exited with status 0
2013-05-25T02:39:43.598693+00:00 heroku[run.1589]: State changed from up to complete
2013-05-25T02:47:44.635791+00:00 heroku[api]: Deploy 3b2c0e0 by "email"
2013-05-25T02:47:44.659753+00:00 heroku[api]: Release v10 created by "email"
2013-05-25T02:47:44.704699+00:00 heroku[api]: Deploy 3b2c0e0 by "email"
2013-05-25T02:47:45.205793+00:00 heroku[web.1]: State changed from up to starting
2013-05-25T02:47:48.591029+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 27123`
2013-05-25T02:47:49.862664+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-05-25T02:47:50.836497+00:00 app[web.1]: [2013-05-25 02:47:50] ERROR SignalException: SIGTERM
2013-05-25T02:47:50.836497+00:00 app[web.1]:    /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2013-05-25T02:47:54.610704+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them 
in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T02:47:54.611109+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T02:47:54.611344+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T02:47:56.472610+00:00 app[web.1]: [Blogit]: Blogit::Configuration#rss_feed_language has been deprecated. You can remove this from your blogit.rb configuration file
2013-05-25T02:47:57.907795+00:00 app[web.1]: [2013-05-25 02:47:57] INFO  WEBrick 1.3.1
2013-05-25T02:47:57.907795+00:00 app[web.1]: [2013-05-25 02:47:57] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-05-25T02:47:57.908723+00:00 app[web.1]: [2013-05-25 02:47:57] INFO  WEBrick::HTTPServer#start: pid=2 port=27123
2013-05-25T02:47:58.197066+00:00 heroku[web.1]: State changed from starting to up
2013-05-25T02:47:58.851641+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-05-25T02:47:58.851887+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-05-25T02:48:00.088867+00:00 app[web.1]: => Booting WEBrick
2013-05-25T02:48:00.088867+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:27123
2013-05-25T02:48:00.088867+00:00 app[web.1]: Started GET "/" for 99.233.170.104 at 2013-05-25 02:48:00 +0000
2013-05-25T02:48:00.088867+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-05-25T02:48:00.088867+00:00 app[web.1]: => Call with -d to detach
2013-05-25T02:48:00.290164+00:00 app[web.1]: Processing by Blogit::PostsController#index as HTML
2013-05-25T02:48:00.460839+00:00 app[web.1]:   Rendered blogit/posts/index.html.erb within layouts/application (98.8ms)
2013-05-25T02:48:00.462767+00:00 app[web.1]: 
2013-05-25T02:48:00.462767+00:00 app[web.1]:     1: <div class="right1">
2013-05-25T02:48:00.461055+00:00 app[web.1]: Completed 500 Internal Server Error in 171ms
2013-05-25T02:48:00.462767+00:00 app[web.1]: ActionView::Template::Error (unknown attribute: name):
2013-05-25T02:48:00.462767+00:00 app[web.1]:     4: <% end %>
2013-05-25T02:48:00.462767+00:00 app[web.1]:     3:   <%= link_to t(:new_blog_post, scope: 'blogit.posts'), new_post_path %>
2013-05-25T02:48:00.462767+00:00 app[web.1]:     2: <%= login_required class: "actions", id: "new_blog_post_link" do %>
2013-05-25T02:48:00.462767+00:00 app[web.1]:     5: </div>
2013-05-25T02:48:00.462767+00:00 app[web.1]:   app/controllers/application_controller.rb:5:in `current_user'
2013-05-25T02:48:00.462767+00:00 app[web.1]:   app/views/blogit/posts/index.html.erb:2:in `_app_views_blogit_posts_index_html_erb___1549385033592403810_36478100'
2013-05-25T02:48:00.462767+00:00 app[web.1]: 
2013-05-25T02:48:00.463077+00:00 app[web.1]: 
2013-05-25T02:48:00.471980+00:00 heroku[router]: at=info method=GET path=/ host=infinite-springs-1056.herokuapp.com fwd="99.233.170.104" dyno=web.1 connect=3ms service=421ms status=500 bytes=643
2013-05-25T02:48:01.026129+00:00 heroku[web.1]: Process exited with status 137
4

4 回答 4

1

您是否运行过“heroku run rake db:migrate”?Heroku 似乎没有看到您的 User 模型,这意味着它可能尚未在数据库中。

这是一个类似的问题:Heroku Postgres 错误:PGError:错误:关系“组织”不存在(ActiveRecord::StatementInvalid)

于 2013-05-25T01:55:47.100 回答
1

如错误日志中所述,问题来自

app/controllers/application_controller.rb:5:in `current_user'

这是

@current_user ||= User.first || User.create!(name: "APane")

您正在尝试在 User 表中创建一个新行,并传入 user 表上的 name 属性,但它不存在。在您的架构中,用户没有名称字段。您将需要生成迁移以添加它。

您可能还想复习一下对 Rails 应用程序的一些基本了解。这些指南非常有帮助。

于 2013-05-25T04:05:01.540 回答
0

看起来您正在使用 Webrick,我很确定您应该使用 Thin for Heroku。不确定它是否会解决您的问题。

于 2013-05-25T02:17:23.203 回答
0

我注意到你在你的组Gemfile中的缩进有一个错误。end:production

改变这个

group :production do
  gem 'pg'
  end

对此

group :production do
  gem 'pg'
end

此外,如果您sqlite用于开发和postgresql生产,并且不确定postgresql是否正确安装。做这个

bundle install --without production

这将使您在 Heroku 上启动并运行。

但是,Heroku 不建议在开发和生产中运行不同的数据库,因为这会导致难以发现错误等。因此,尽快弄清楚如何在两种环境中运行 postgresql 是明智的。希望这能让你开始

于 2013-05-25T02:26:13.413 回答