从heroku迁移到dokku(数字海洋)

时间:2016-06-22 13:22:33

标签: ruby-on-rails heroku digital-ocean

我正在切换heroku的所有东西并转移到数字海洋(更便宜和静态IP地址!!)

我在heroku上有搜索框。我会在数字海洋上需要这样的东西。

目前我正在发出错误请求(仍然为heroku设置?)看起来像这样

I, [2016-06-22T13:18:41.226034 #275]  INFO -- : Started GET "/events_autocomplete?query=test" for 212.250.145.155 at 2016-06-22 13:18:41 +0000
I, [2016-06-22T13:18:41.253478 #275]  INFO -- : Processing by EventsController#autocomplete as JSON
I, [2016-06-22T13:18:41.253665 #275]  INFO -- :   Parameters: {"query"=>"test"}
I, [2016-06-22T13:18:41.264460 #275]  INFO -- : Completed 500 Internal Server Error in 11ms (Searchkick: 5.7ms | ActiveRecord: 0.0ms)
F, [2016-06-22T13:18:41.266812 #275] FATAL -- :
Faraday::ConnectionFailed (Connection refused - connect(2) for "localhost" port 9200):
  app/controllers/events_controller.rb:61:in `autocomplete'


I, [2016-06-22T13:18:41.319310 #275]  INFO -- : Started GET "/search_events?utf8=%E2%9C%93&search=test&commit=Search" for 212.250.145.155 at 2016-06-22 13:18:41 +0000
I, [2016-06-22T13:18:41.321272 #275]  INFO -- : Processing by EventsController#search as HTML
I, [2016-06-22T13:18:41.321365 #275]  INFO -- :   Parameters: {"utf8"=>"✓", "search"=>"test", "commit"=>"Search"}
I, [2016-06-22T13:18:41.326730 #275]  INFO -- : Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.0ms)
F, [2016-06-22T13:18:41.328614 #275] FATAL -- :
Faraday::ConnectionFailed (Connection refused - connect(2) for "localhost" port 9200):
  app/controllers/events_controller.rb:83:in `search'

我对此很新,所以任何帮助都会非常感激

由于 萨姆

修改

  def search
    @events = Event.where("event_type != 'festival' AND complete = true").page(params[:page]).per(10).search params[:search], suggest: true, misspellings: { distance: 1 }, order: { date: :asc, eventname: :asc }, match: :word_start
    if @events.results.any?
      render 'events/results'
    else
      render 'events/noresults'
    end
  end

1 个答案:

答案 0 :(得分:0)

您可以使用官方dokku-elasticsearch插件设置ES实例并将其链接到您的应用程序。完成后,我们会为您的应用设置var eld; $(".todo-delete").click(function() { eld = $(this).parent(); $(".modal").fadeToggle("fast", "linear"); }); $(".yes").click(function() { eld.parent().parent().remove(); }); $(".no").click(function() { $(".modal").fadeToggle("fast", "linear"); }); ,只要您的代码尊重这一点,您就应该好好去。