Hi
When I tried to solve the same problem like Elasticsearch integration with CI 2.0 [Rails project]
Even I set a value for cluster_name, still got Cannot find Elasticsearch launch script from [elasticsearch] error.
So I tried build a test environment with script below
Looking at your config I see you have set up a secondary service container for elasticsearch. Each - image: is a separate docker image that is accessible via the network. This would mean you can connect to this elasticsearch container from a client installed in your main image.
The command you are executing: which elasticsearch is executing on the circleci/ruby:2.6.1-node-browsers docker image which does not have the elasticsearch binary installed.
You can create a custom docker image using circleci/ruby:2.6.1-node-browsers as your base image. From there you can publish your own Docker image on the Dockerhub and use this in your projects.
FROM circleci/ruby:2.6.1-node-browsers
RUN ...
Creating a custom Docker image is usually the best option as there are less potential points of failures. A built image using circleci/ruby:2.6.1-node-browsers will benefit from any cached layers from this image on our host and will only need to download any additional layers created from the DockerHub.
One note, I would recommend dropping the patch version in the image. Often patches are required to fix issues that may arrise with the image (such as moving/changing packages). Building off 2.6 will allow you to pull the most recent patch which may help avoid issues.
@KyleTryon What happens if someone does not want to install Elasticsearch manually. ?
The problem with provided Elasticsearch images are that the path to location of elasticsearch is not available.
E.g. using the same config as given in the question
This Elasticsearch cluster requires giving the args :command by setting the ENV variable TEST_CLUSTER_COMMAND with the path to the Elasticsearch file. (on local system the path is something like '/Users/.../.../elasticsearch-6.8.0/bin/elasticsearch'
Otherwise it throws the error:
Errno::ENOENT:
No such file or directory - Cannot find Elasticsearch launch script from [elasticsearch] -- did you pass a correct path?
If we use docker image of Elasticsearch, then can you please tell what can be the expected path of where the ES is installed on the directory structure. ?
Hi @AhsenArif
You can access Elasticsearch service via network.
The endpoint of Elasticsearch is localhost:{port you set}
That means you haven’t necessary to boot any Elasticsearch service on primary container.