2

I'm having difficulty with connecting my Heroku app to an Elasticsearch instance. I'm using the tire gem and the bonsai add-on on Heroku.

When I deploy the application I get this error twice:

Skipping index creation, cannot connect to Elasticsearch

I also have this in my initialize bonsai.rb file:

if ENV['BONSAI_INDEX_URL']
  bonsai_uri = URI.parse(ENV['BONSAI_INDEX_URL'])
  Tire.configure do
    url "http://sampleindex.bonsai.io"
  end
  BONSAI_INDEX_NAME = bonsai_uri.path[1..-1]
else
  BONSAI_INDEX_NAME = "my_index"
end
Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Kyle
  • 1,058
  • 2
  • 10
  • 22
  • Hey zeantosi. It's strange, I did the BONSAI_URL while I was still having this issue and it was still giving me a connection failure error. After an hour or so, I tried again and it was working. I'm wondering if there was an issue with DNS or something on Heroku's end. Thanks for your answer. – Kyle Sep 09 '13 at 16:38

1 Answers1

1

Looking like you may be pointing to an invalid ElasticSearch URL. Try typing the following from the command line:

heroku config | grep BONSAI
#=> BONSAI_URL     => http://ql9lsrn8:img5ndnsbtaahloy@redwood-94865.us-east-1.bonsai.io/

This should return the operating URL on Heroku's Bonsai service. Use this in your configuration:

Tire.configure do
  url "http://ql9lsrn8:img5ndnsbtaahloy@redwood-94865.us-east-1.bonsai.io/"
end
zeantsoi
  • 25,857
  • 7
  • 69
  • 61