How to add Elasticsearch plugins to Magento Cloud local docker setup
Please see the Official Magento Cloud docs first.
This guide has been created because the environment service configuration setting for this does not work with local docker container setup.
-
Install the project's composer dependencies
This is needed so the
docker
directory is created andece-tools
installed.composer install --ignore-platform-reqs
You local machine probably doesn't have all the required PHP extensions hence the
--ignore-platform-reqs
switch.Usually this switch may cause problems if it was a real build, because different vendor version could be installed. In this case it will be fine because the real build process is completely isolated in a docker container.
-
Set up Magento Cloud docker environement according to the documentation.
-
Create the directory
docker/elasticsearch-dev
. -
Save the contents of attached
elasticsearch-dev.Dockerfile
todocker/elasticsearch-dev/Dockerfile
. -
Customize the new docker file.
- Set the elasticsearch version you need - it should be one of the available tags.
- Customize the plugins to be installed.
-
As mentioned in the original documentation extend the docker-compose setup with custom modifications - save the contents of
docker-compose-dev.yml
to the same filename in your main project directory. -
From now on instead of running
docker-compose run {parameters}
you will have to enter:docker-compose -f docker-compose.yml -f docker-compose-dev.yml run {parameters}
Note: When you change the custom elasticsearch file after the container has been built docker-compose will not automatically rebuild the container - you need to run docker-compose -f docker-compose.yml -f docker-compose-dev.yml build
to force it.