magento-cloud-docker
magento-cloud-docker copied to clipboard
OpenSearch docker images broken
Preconditions
Magento Cloud Docker - local development with latest 1.3.2 package
Steps to reproduce
- Create .magento.docker.yml file
- Specify elasticsearch service with:
- image: "magento/magento-cloud-docker-opensearch"
- version: "1.2"
- Generate docker-compose.yml file
- Attempt to bring up services
Expected result
Local Magento environment with OpenSearch
Actual result
OpenSearch container fails healthcheck. Upon review, OS_HOST is used for both the URL and port, unlike the Elasticsearch image which correctly uses ES_HOST and ES_PORT. However, even when fixing this issue, the healthcheck still fails.
We use the docker dev setup quite extensively, historically with ES. We are exploring OS, but are blocked on this issue.
Hi @zakisaad
Thank you for your contribution.
You're right, OS_PORT should be there:
#!/bin/bash
set -eo pipefail
if health="$(curl -fsSL "http://${OS_HOST:-opensearch}:${OS_PORT:-9200}/_cat/health?h=status")"; then
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
if [ "$health" = 'green' ] || [ "$health" = 'yellow' ]; then
exit 0
fi
echo >&2 "Unexpected health status: $health"
fi
exit 1
And we will fix it in the next release.
But it is not a root cause. OS_HOST and OS_PORT are used when they are provided.
So, the default value is opensearch:9200
I tried to reproduce it, but it works fine. I tried it on Mac OS and Linux.
Could you provide more information about your system (OS, Docker version, etc)?
Try to use the next steps:
- clone 2.4.4 template
- run composer update
- run
./vendor/bin/ece-docker build:compose
- run
docker-compose up -d
2.4.4 template uses OS 1.2 by default
Hello @BaDos
I am also facing same issue on Mac machine only. I following the same steps you were mention :
clone 2.4.4 template
run composer update
run ./vendor/bin/ece-docker build:compose
run docker-compose up -d
system information :
MacBook Pro M1 chip 32 gb ram
Hello @kanojiyadhaval
How much memory do you provide for Docker Desktop?
Hi @BaDos
currently, it's 8gb.
I'm facing the same problem, working on:
Macbook air M1 8 gb ram Magento Cloud CLI 1.40.0 Magento 2.4.5 clean install
all the docker environment worked on first install, i stopped the containers and when i try to star them again it says the OpenSearch container is unhealthy, it is running but i can't run magento commands due to unhealthy container
any progress on this?
Did you just use an image from Docker Hub? Or did you build own image using this sources https://github.com/magento/magento-cloud-docker/tree/develop/images/opensearch ?
Docker Hub does not contain any images for M1, please build you own images and try again to reproduce it.
@here I fixed Opensearch but I get OOM in Java. Using images from the source you provided @BaDos Here is my Dockerfile for MAcbook M1. Magento version 2.4.5-p1 - Magento cloud docker installed via composer. Images build manually
FROM opensearchproject/opensearch:1.2.1
USER root
RUN yum -y install zip && \
zip -q -d /usr/share/opensearch/lib/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class && \
yum remove -y zip && \
yum -y clean all && \
rm -rf /var/cache
USER opensearch
RUN bin/opensearch-plugin install -b analysis-icu && \
bin/opensearch-plugin install -b analysis-phonetic
ADD docker-healthcheck.sh /docker-healthcheck.sh
ADD docker-entrypoint.sh /docker-entrypoint.sh
HEALTHCHECK --retries=3 CMD ["bash", "/docker-healthcheck.sh"]
ENTRYPOINT ["bash", "/docker-entrypoint.sh"]
EXPOSE 9200 9300
The main change was here "ENTRYPOINT ["bash", "/docker-entrypoint.sh"]". But Im working in a large site and Im getting these errors in Opensearch logs - java.lang.OutOfMemoryError: Java heap space
And setting are now 8G for memory. Maybe a problem in the code. I don't know. Would you guys please test my fix and see if you can reindex without issues?