Heroku附加组件一起使用

Heroku附加组件一起使用

本文介绍了Config Tire与Bonsai ElasticSearch Heroku附加组件一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个Rails 3.2应用程序.我创建了一个索引.我遵循了该指南: https://gist.github.com/nz/2041121 创建一个config/initializers/bonsai.rb中的bonsai.rb文件看起来像这样:

So I have a rails 3.2 app. I created an index.I followed this guide: https://gist.github.com/nz/2041121 to create an bonsai.rb file in config/initializers/bonsai.rbIt looks like this:

ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']

# Optional, but recommended: use a single index per application per environment.
# Caveat: This convention not be entirely supported throughout Tire's API.
app_name = Rails.application.class.parent_name.underscore.dasherize
app_env = Rails.env
INDEX_NAME = "#{app_name}-#{app_env}"

但是我要努力工作,这是heroku日志中的这张记录:

But I dosent work, this outprint from the heroku logs:

2013-03-06T17:04:54+00:00 app[web.1]: Processing by SchoolsController#index as HTML
2013-03-06T17:04:54+00:00 app[web.1]: Started GET "/trafikskola?utf8=%E2%9C%93&query=Malm%C3%B6" for 192.165.96.102 at 2013-03-06 17:04:54 +0000
2013-03-06T17:04:54+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "query"=>"Malmö"}
2013-03-06T17:04:58+00:00 heroku[router]: at=info method=GET path=/trafikskola?utf8=%E2%9C%93&query=Malm%C3%B6 host=stormy-escarpment-2346.herokuapp.com fwd="192.165.96.102" dyno=web.1 queue=0 wait=0ms connect=1ms service=3106ms status=500 bytes=643
2013-03-06T17:04:58+00:00 app[web.1]:
2013-03-06T17:04:58+00:00 app[web.1]:   app/models/school.rb:19:in `search'
2013-03-06T17:04:58+00:00 app[web.1]:   app/controllers/schools_controller.rb:10:in `index'
2013-03-06T17:04:58+00:00 app[web.1]: Completed 500 Internal Server Error in 3073ms
2013-03-06T17:04:58+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2013-03-06T17:04:58+00:00 app[web.1]:
2013-03-06T17:04:58+00:00 app[web.1]:

我的问题:

  1. 我应该在bonsai.rb文件的ELASTICSEARCH_URL中添加内容吗?如果是,那怎么办?
  2. 我创建了一个本地索引,这意味着什么吗?
  3. 还是其他?
  1. Should I put somehting in the ELASTICSEARCH_URL in the bonsai.rb file? If yes, then what?
  2. I have created a local index to, does that mean something?
  3. Or is it something else?

推荐答案

config/initializers/bonsai.rb是正确的,问题是我也必须在生产模式下对其进行索引.

The config/initializers/bonsai.rb was right and the problem was I had to index it in production mode also.

所以我做到了:

heroku rake environment tire:import CLASS=School FORCE=true

它奏效了.

这篇关于Config Tire与Bonsai ElasticSearch Heroku附加组件一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 11:40