Closed matthinea closed 5 years ago
Hi, first, I don't think I've ever used the extension with a password-protected cluster, so there might be something which needs to be changed in the code.
For a client, encoding the username and password in the URL is enough, but I'm fairly sure the extension won't take it into account — I think the extension needs additional parameters to work in this scenario.
As a note, I'm still a fan of the extension, but I think for newer versions of Elasticsearch, we should migrate into a Docker-based setup, which isolates the installation much better.
For instance, this is a single command I use to test https://github.com/elastic/elasticsearch-x-pack-ruby against an Elasticsearch cluster with the platinum
X-Pack license:
docker run \
--name elasticsearch-xpack \
--env ELASTIC_PASSWORD=changeme \
--publish 9260:9200 \
--volume $(pwd)/tmp/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
--memory 4g \
--rm \
docker.elastic.co/elasticsearch/elasticsearch-platinum:6.1.1
Hi @mnd-dsgn, I'm afraid I can't offer more assistance / advice at this point, is there anything more I can do?
Sorry, I haven't had time to revisit this, we've since stubbed our own way of testing Elasticsearch functionality that just uses test_
-prefixed index names and cleans up after each test. But thanks @karmi, I'll be sure to investigate Docker when we return to developing Elasticsearch features
Thanks for the note, @mnd-dsgn !
I'm going to close this as the recommendation to use Docker for starting a cluster with platinum features is best.
In a
rails_helper
file I'm using to configure RSpec for my test suite, I'm running:However, the test cluster consistently fails to start, either printing the error raised by the
__get_cluster_health
method in cluster.rb or raising anElasticsearchSecurityException
.Output with
ENV['DEBUG'] = 'true'
looks respectively like one of these:or
Elasticsearch is working perfectly fine in a Rails console and I can query it from the test suite as long as I make sure the client instance is passed a
user
and apassword
option matching the password I generated when I set the Elasticsearch password using x-pack, i.e:I'm wondering if my inability to get a test cluster running has anything to do with the Net::HTTP GET request on line 631 of
cluster.rb
that does not seem to take into account authentication. The Elasticsearch docs here say:Thanks!