Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSearch docker images broken #350

Open
zakisaad opened this issue Jun 2, 2022 · 7 comments
Open

OpenSearch docker images broken #350

zakisaad opened this issue Jun 2, 2022 · 7 comments

Comments

@zakisaad
Copy link

zakisaad commented Jun 2, 2022

Preconditions

Magento Cloud Docker - local development with latest 1.3.2 package

Steps to reproduce

  1. Create .magento.docker.yml file
  2. Specify elasticsearch service with:
    • image: "magento/magento-cloud-docker-opensearch"
    • version: "1.2"
  3. Generate docker-compose.yml file
  4. 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.

@BaDos
Copy link
Contributor

BaDos commented Jun 23, 2022

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

@kanojiyadhaval
Copy link

kanojiyadhaval commented Aug 29, 2022

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

MicrosoftTeams-image

@BaDos
Copy link
Contributor

BaDos commented Aug 30, 2022

Hello @kanojiyadhaval

How much memory do you provide for Docker Desktop?

@kanojiyadhaval
Copy link

Hi @BaDos

currently, it's 8gb.

@AngelBS
Copy link

AngelBS commented Oct 13, 2022

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?

@BaDos
Copy link
Contributor

BaDos commented Oct 16, 2022

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.

@gcampedelli
Copy link

gcampedelli commented May 8, 2023

@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?

@BaDos BaDos removed their assignment Mar 2, 2024
@github-project-automation github-project-automation bot moved this to Ready for Grooming in Backlog Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for Grooming
Development

No branches or pull requests

5 participants