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

Setup Install 2.4.6 Only Possible with OpenSearch #37236

Closed
1 of 5 tasks
laurnts opened this issue Mar 18, 2023 · 33 comments
Closed
1 of 5 tasks

Setup Install 2.4.6 Only Possible with OpenSearch #37236

laurnts opened this issue Mar 18, 2023 · 33 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6 Indicates original Magento version for the Issue report.

Comments

@laurnts
Copy link

laurnts commented Mar 18, 2023

Preconditions and environment

  • Magento version 2.4.6
  • Running php bin/magento setup:install --search-engine=elasticsearch8 ... will returned an error during installation

Steps to reproduce

  1. Ensure Elasticsearch 8.4 is installed
  2. Ensure Magento 2.4.6 composer installation works
  3. Run php bin/magento .... --search-engine=elasticsearch8

Expected result

A successful Magento2 setup installation while using elasticsearch as the search engine

Actual result

Could not validate a connection to the OpenSearch. No alive nodes found

Additional information

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Mar 18, 2023

Hi @laurnts. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@m2-assistant
Copy link

m2-assistant bot commented Mar 18, 2023

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@engcom-Dash engcom-Dash added the Reported on 2.4.6 Indicates original Magento version for the Issue report. label Mar 18, 2023
@magenx
Copy link

magenx commented Mar 18, 2023

yes, just tested with elasticsearch 8.6:
installed with --search-engine=elasticsearch7
i dont see anything elasticsearch 8 related,
when you change in menu to opensearch search engine, magento works ok 🤕

@lcw-media
Copy link

lcw-media commented Mar 21, 2023

At first, try installing the official magento 2 Elasticsearch 8 Module:

composer require magento/module-elasticsearch-8 --with-all-dependencies

Then, try installing with following parameters:

bin/magento setup:install --disable-modules=Magento_InventoryElasticsearch,Magento_Elasticsearch8,Magento_Elasticsearch,Magento_OpenSearch

After setup is done, enable modules again (Dont enable Magento_OpenSearch again):

bin/magento module:enable Magento_InventoryElasticsearch Magento_Elasticsearch8 Magento_Elasticsearch

Change default search engine to elasticsearch 8:
bin/magento config:set catalog/search/engine 'elasticsearch8'

Start Magento Setup: (ElasticSearch 8 Service should run while starting setup again ;) )

bin/magento setup:upgrade bin/magento setup:di:compile

Good Luck!

@magenx
Copy link

magenx commented Mar 21, 2023

this must be in documentation, not hidden somewhere in github issue.

i think installation must be also very simple.
this is not an upgrade.
and the other problem it will not work with xpack security enabled.

then opensearch also have issues with security plugin enabled.

the only working installation with proper authentication is elasticsearch 7

@t-heuser
Copy link

I can confirm the issue in v2.4.6, even integration tests are failing in setup if you have ElasticSearch 8 installed and not ElasticSearch7 or OpenSearch.

@magenx
Copy link

magenx commented Mar 21, 2023

feels like issue is coming from adobe commerce cloud platform, they run opensearch without security plugin
probably thats why nothing ever was properly tested

@laurnts
Copy link
Author

laurnts commented Mar 21, 2023

this must be in documentation, not hidden somewhere in github issue.

i think installation must be also very simple. this is not an upgrade. and the other problem it will not work with xpack security enabled.

then opensearch also have issues with security plugin enabled.

the only working installation with proper authentication is elasticsearch 7

Completely agree with MagenX here. The setup install of Magento2 provide the option to use elasticsearch and opensearch respectively (unlike the previous version before where it gets mixed). Thus the installation should be straight forward.

Also the xpack security enabled needed to be disabled (false). Else the node cluster canno't be found error will get triggered.

Aside from that (not related to this ticket). varnish.vcl can only export version 6 while in 2.4.6 Varnish 7 is supported.

@magenx
Copy link

magenx commented Mar 24, 2023

i wasted all weekend to find out this, running different setups like crazy.
adobe fiddled around for 217 days and came up with a broken release, a non-working core component without which the whole patform can't be installed... now it's my time to whine...

@FadedOut
Copy link

i wasted all weekend to find out this, running different setups like crazy. adobe fiddled around for 217 days and came up with a broken release, a non-working core component without which the whole patform can't be installed... now it's my time to whine...

Such oversight makes me want to rant now...

I find this happens with almost every single release they come out with. I've upgraded from 2.4.0 to each release to now 2.4.5 (I will not be updating to .6 until .6-p1) and every single "major" release (.1, .2, .3, .4, .5) has had some profoundly surprising bugs that makes you wonder who tests these releases. Almost like they test with one setup and say "good to go". It's absolutely absurd and can destroy businesses. I wonder if paying the $1500+ per month for "Adobe Commerce" has less bugs. Highly doubt it. The sad part? It's released only two weeks prior to GA (general availability) for "testing" even to those paying customers. Like really?

I swear, whoever came up with the release schedule for this system should be fired. It's just simply not the way to do it. Smaller, quicker releases are MUCH smarter and better to do. For instance, WooCommerce (which has like 100x more store running it, like 10m compared to 500k for Magento) does releases like once per month. Those releases are MUCH smaller. Easier to deal with bugs and testing - they will also release fixes quickly after instead of making the merchant wait 4-5 months. It's also available for testing WHILE it's being developed. Adobe, for reasons unknown (probably greed somehow) keeps the testing of the dev version behind closed doors (like all those "jira" bug reports require you to be an "Adobe staff member" - like really?? thought this was open-source) so the only REAL testing is done in the two weeks prior to GA. Like how dumb. Then problems like this arises. Problems that should not even have happened if it were tested better. But now stores that rely on a stable eCommerce system so they can make MONEY deal with major site breaking bugs. That is explicitly why most Magento stores pay like $5k for "upgrade" teams - because of the garbage QC (quality control) that Adobe does.

It's sad because overall I think the features and usual stability of Magento is above most others, but during release time it's always a disaster. Always. So...the trick I think I'm learning? ALWAYS wait for the "p" release. Then move to that one, which should HOPEFULLY have the major release's bugs fixed. Because again, with their garbage release schedule they don't release minor point releases to fix problems like this. This major issue, and others, will only be [hopefully] fixed now 4-5 months from now with the "p" release - though knowing them, they will say "this fix is targeted for 2.4.7" or "2.4.8", at the end of 2023 or this time next year - which is just insane. Instead of doing what many other sane companies do and just come out with a minor point release (2.4.6.1) fixing major issues like this.

Gah rant over. Good luck to anyone that updated. I will be waiting, and will always do with this system. Never have I before seen such garbage QC every release. Every...single...time. Really wish WooCommerce was more like this system (features, stability, etc.) because I would just stick with that, I trust their new releases so much more. The garbage Adobe pulls every time with these releases sours my outlook on Magento so much 😡

@mattryding
Copy link

Incase this helps anyone:

  • When installed without "--search-engine=elasticsearch7", I get the error: "Could not validate a connection to the OpenSearch. No alive nodes found"
  • When installed using "--search-engine=elasticsearch7", install works correct

It looks like by default the install is now using OpenSearch and not ElasticSearch7?

I can't comment on ElasticSearch 8 but hopefully the above may help some people.

@n2diving-dgx
Copy link

n2diving-dgx commented Mar 28, 2023

We decided to migrate M2.4.6 on CentOS 7 to Oracle Linux 8. As part of the migration effort we took the opportunity to switch from ElasticSearch (v7.17 on CentOS) to OpenSearch (v2.6 on OL). Attempting a straightforward install of M2.4.6 using a script that ran fine on the existing server with ElasticSearch, I discovered M2.4.6 would not install on the new server running OpenSearch, returning the "No alive nodes found" error.

The cause was OpenSearch had been installed taking the configuration defaults which included enabling ssl/https. Checking the installation of OpenSearch with this console command, the version number of OpenSearch was returned as expected:

curl -XGET --insecure -u 'admin:admin' 'https://localhost:9200'

Eventually, we discovered by disabling the OpenSearch security that Magento 2.4.6 would then install as expected. See https://opensearch.org/docs/1.1/security-plugin/configuration/disable/

The command to check OpenSearch as Magento 2.4.6 seems to require it to be configured changes https to http:

curl -XGET 'http://localhost:9200'

Is it possible that M2.4.6 has a compatibility issue with the OpenSearch security-plugin enabled by default? Is it also possible, as per the @FadedOut rant above, that M2.4.6 was never tested with the security-plugin of OpenSearch that is enabled by default?

@magenx
Copy link

magenx commented Mar 28, 2023

working self hosted configuration for Magento 2.4.6

security enabled security disabled ssl enabled ssl disabled
ElasticSearch 7 OK n/a error OK
ElasticSearch 8 error ok error ok not recommended
OpenSearch 2.6 error ok error ok not recommended

@hostep
Copy link
Contributor

hostep commented Mar 28, 2023

Just to add someting about ES 8, some manual steps need to be taken before Magento 2.4.6 can work with it. Out of the box it doesn't come with ES 8 support, you need to install a new composer package first: https://experienceleague.adobe.com/docs/commerce-operations/upgrade-guide/prepare/prerequisites.html?lang=en#upgrade-elasticsearch

@engcom-Dash
Copy link

Hi @laurnts ,

Issue Confirmed,

Verified the issue 2.4.6 magento instance and the issue is reproducible,Hence we are confirming the issue.

Preconditions:
Magento Version 2.4.6
PHP 8.1

Steps to reproduce:

  • Ensure Elasticsearch 8.4 is installed
  • Ensure Magento 2.4.6 composer installation works
  • Run php bin/magento setup:install --search-engine=elasticsearch 8

KIndly refer the below screenshots:
op2
op1

We are getting actual result which is Could not validate a connection to the OpenSearch. No alive nodes found ,Hence we are confirming the issue.

Regards,

@engcom-Dash engcom-Dash added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Elasticsearch Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Admin UI and removed Issue: ready for confirmation labels Mar 31, 2023
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Mar 31, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-8398 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Mar 31, 2023

✅ Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Dash engcom-Dash removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Apr 2, 2023
@engcom-Dash engcom-Dash removed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Admin UI labels Apr 2, 2023
@m2-community-project m2-community-project bot moved this from Confirmed to Ready for Confirmation in Issue Confirmation and Triage Board Apr 2, 2023
@hostep
Copy link
Contributor

hostep commented Apr 4, 2023

@engcom-Dash: out of curiosity: after your second step, so before the setup:install: did you install the extra composer package for ES8 like mentioned in the documentation?

@engcom-Dash engcom-Dash self-assigned this Apr 9, 2023
@laurnts
Copy link
Author

laurnts commented Apr 11, 2023

@engcom-Dash: out of curiosity: after your second step, so before the setup:install: did you install the extra composer package for ES8 like mentioned in the documentation?

It's a good find, I will test it out if it works.

Incase this helps anyone:

  • When installed without "--search-engine=elasticsearch7", I get the error: "Could not validate a connection to the OpenSearch. No alive nodes found"
  • When installed using "--search-engine=elasticsearch7", install works correct

It looks like by default the install is now using OpenSearch and not ElasticSearch7?

I can't comment on ElasticSearch 8 but hopefully the above may help some people.

I confirm that swapping the elasticsearch8 to elasticsearch7 does work (by means of using older elasticsearch version). However I also think I've tried once running elasticsearch8 and using the install flag elasticsearch7 does work too

@laurnts
Copy link
Author

laurnts commented Apr 11, 2023

i wasted all weekend to find out this, running different setups like crazy. adobe fiddled around for 217 days and came up with a broken release, a non-working core component without which the whole patform can't be installed... now it's my time to whine...

Such oversight makes me want to rant now...

I find this happens with almost every single release they come out with. I've upgraded from 2.4.0 to each release to now 2.4.5 (I will not be updating to .6 until .6-p1) and every single "major" release (.1, .2, .3, .4, .5) has had some profoundly surprising bugs that makes you wonder who tests these releases. Almost like they test with one setup and say "good to go". It's absolutely absurd and can destroy businesses. I wonder if paying the $1500+ per month for "Adobe Commerce" has less bugs. Highly doubt it. The sad part? It's released only two weeks prior to GA (general availability) for "testing" even to those paying customers. Like really?

I swear, whoever came up with the release schedule for this system should be fired. It's just simply not the way to do it. Smaller, quicker releases are MUCH smarter and better to do. For instance, WooCommerce (which has like 100x more store running it, like 10m compared to 500k for Magento) does releases like once per month. Those releases are MUCH smaller. Easier to deal with bugs and testing - they will also release fixes quickly after instead of making the merchant wait 4-5 months. It's also available for testing WHILE it's being developed. Adobe, for reasons unknown (probably greed somehow) keeps the testing of the dev version behind closed doors (like all those "jira" bug reports require you to be an "Adobe staff member" - like really?? thought this was open-source) so the only REAL testing is done in the two weeks prior to GA. Like how dumb. Then problems like this arises. Problems that should not even have happened if it were tested better. But now stores that rely on a stable eCommerce system so they can make MONEY deal with major site breaking bugs. That is explicitly why most Magento stores pay like $5k for "upgrade" teams - because of the garbage QC (quality control) that Adobe does.

It's sad because overall I think the features and usual stability of Magento is above most others, but during release time it's always a disaster. Always. So...the trick I think I'm learning? ALWAYS wait for the "p" release. Then move to that one, which should HOPEFULLY have the major release's bugs fixed. Because again, with their garbage release schedule they don't release minor point releases to fix problems like this. This major issue, and others, will only be [hopefully] fixed now 4-5 months from now with the "p" release - though knowing them, they will say "this fix is targeted for 2.4.7" or "2.4.8", at the end of 2023 or this time next year - which is just insane. Instead of doing what many other sane companies do and just come out with a minor point release (2.4.6.1) fixing major issues like this.

Gah rant over. Good luck to anyone that updated. I will be waiting, and will always do with this system. Never have I before seen such garbage QC every release. Every...single...time. Really wish WooCommerce was more like this system (features, stability, etc.) because I would just stick with that, I trust their new releases so much more. The garbage Adobe pulls every time with these releases sours my outlook on Magento so much 😡

I have to say I completely agreed with you. Upgrading on minor releases were ok, but big major release with major changes always a hassle. Waiting for the patch version is one of the safest, most easy solution to go with unless there are some imminent issues to be fixed.

@engcom-Dash
Copy link

Hi @laurnts ,

Verified the issue in 2.4.6 in magento instance and issue is not reproducible after installing magento package ES8 and Kindly refer the below screenshots.We can able run the search engine of ES 8 with following command.

"php bin/magento setup:install --search-engine=elasticsearch 8"

Screenshots:
es1

We can successfully the run above mentioned the command without any issue .
Kindly try again with some manual steps of elasticsearch.You may get some information.Here is the link for composer package of elasticsearch 8

Thanks,

@engcom-Dash engcom-Dash added the Issue: needs update Additional information is require, waiting for response label Apr 17, 2023
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Apr 17, 2023
@scholtz
Copy link

scholtz commented Apr 22, 2023

I am using this preparation docker build:

FROM ubuntu
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt dist-upgrade -y && apt install -y mc wget telnet git curl net-tools iotop atop vim dnsutils jq && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN apt update && apt dist-upgrade -y && apt install -y software-properties-common && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/

RUN DEBIAN_FRONTEND=noninteractive && add-apt-repository ppa:ondrej/php

RUN apt update && apt dist-upgrade -y && apt install -y nginx php8.2-fpm php8.2-cli && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
#RUN apt-cache search php8.2
RUN apt update && apt dist-upgrade -y && apt install -y php8.2-curl php8.2-zip php8.2-pdo php8.2-mysqlnd php8.2-opcache php8.2-xml php8.2-gd php8.2-mysql php8.2-intl php8.2-mbstring php8.2-bcmath php8.2-iconv php8.2-soap && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/

RUN echo 2
RUN sed -i 's~memory_limit = .*~memory_limit = 2G~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~max_execution_time = 30~max_execution_time = 1800~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~zlib.output_compression = Off~zlib.output_compression = On~g' /etc/php/8.2/fpm/php.ini 

RUN sed -i 's~memory_limit = .*~memory_limit = 2G~g' /etc/php/8.2/cli/php.ini \
&& sed -i 's~max_execution_time = 30~max_execution_time = 1800~g' /etc/php/8.2/cli/php.ini \
&& sed -i 's~zlib.output_compression = Off~zlib.output_compression = On~g' /etc/php/8.2/cli/php.ini 

RUN grep memory_limit /etc/php/8.2/cli/php.ini  \
&& grep max_execution_time /etc/php/8.2/cli/php.ini \
&& grep output_compression /etc/php/8.2/cli/php.ini

#RUN nginx -v

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

RUN cat /etc/php/8.2/fpm/pool.d/www.conf
RUN mkdir /app
RUN sed -i 's~www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin~www-data:x:33:33:www-data:/app:/bin/bash~g' /etc/passwd 
RUN chown www-data:www-data /app -R

USER www-data
WORKDIR /app
ARG REPO_USER
ARG REPO_PASS
RUN echo "REPO_USER:$REPO_USER"
RUN composer config --global http-basic.repo.magento.com $REPO_USER $REPO_PASS
RUN composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /app/magento
WORKDIR /app/magento
RUN composer require magento/module-elasticsearch-8 --update-with-all-dependencies

USER root

RUN apt update && apt dist-upgrade -y && apt install -y supervisor tzdata && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/

COPY supervisord.conf /etc/supervisord.conf

USER root
#RUN cat /etc/nginx/sites-available/default
COPY web.conf /etc/nginx/sites-available/default
COPY magento.template.conf /etc/nginx/snippets/magento.template.conf

RUN rm /app/.config/composer/auth.json 

RUN sed -i 's~expose_php = .*~expose_php = Off~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~display_errors = .*~display_errors = On~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~post_max_size =.*~post_max_size = 32M~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~;opcache.enable=.*~opcache.enable=1~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~;opcache.save_comments=.*~opcache.save_comments=1~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~listen =.*~listen = 127.0.0.1:9000~g' /etc/php/8.2/fpm/pool.d/www.conf

RUN sed -i 's~;access.log~access.log~g' /etc/php/8.2/fpm/php.ini \
&& sed -i 's~;error_log~error_log~g' /etc/php/8.2/fpm/php.ini
RUN grep error_log /etc/php/8.2/fpm/php.ini

ENV TZ="Europe/London"

RUN grep opcache /etc/php/8.2/fpm/php.ini 

RUN grep listen /etc/php/8.2/fpm/pool.d/www.conf
RUN mkdir /run/php-fpm/
COPY start.sh /app/start.sh
EXPOSE 80
CMD ["/app/start.sh"]

this elastic search setup:

# kubectl create -f https://download.elastic.co/downloads/eck/2.7.0/crds.yaml
# kubectl apply -f https://download.elastic.co/downloads/eck/2.7.0/operator.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: magento
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: elastic-magento
  namespace: magento
spec:
  version: 8.7.0
  nodeSets:
  - name: default
    count: 2
    config:
      node.store.allow_mmap: false
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data # Do not change this name unless you set up a volume mount for the data path.
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 5Gi
        storageClassName: nfs-fast-retain
---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: kibana-magento
  namespace: magento
spec:
  version: 8.7.0
  count: 2
  elasticsearchRef:
    name: elastic-magento
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kibana-ingress-test01
  namespace: magento
  annotations: 
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  tls:
  - hosts:
    - kibana-magento.h2.mydomain.com
    secretName: tls-kibana-magento.h2.mydomain.com
  rules:
  - host: kibana-magento.h2.mydomain.com
    http:
      paths:
      - path: /(.*)
        pathType: Prefix
        backend:
          service:
            name: kibana-magento-kb-http
            port:
              number: 5601
              
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: elastic-es-ingress-test01
  namespace: magento
  annotations: 
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  tls:
  - hosts:
    - elastic-magento.k8s.h2.mydomain.com
    secretName: tls-elastic-magento.k8s.h2.mydomain.com
  rules:
  - host: elastic-magento.k8s.h2.mydomain.com
    http:
      paths:
      - path: /(.*)
        pathType: Prefix
        backend:
          service:
            name: elastic-magento-es-http
            port:
              number: 9200

this sample installation

FROM scholtz2/magento:mag-2.4.6-nginx-1-8-php-8-2-stable

USER www-data
WORKDIR /app/magento
RUN ls -lA bin
RUN bin/magento setup:install \
--base-url=http://localhost/ \
--db-host=mysql.mydomain.com \
--db-name=magento2 \
--db-user=magento2 \
--db-password=myMysqlPass \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=myMagentoAdminPass \
--language=en_US \
--currency=USD \
--timezone=Europe/London \
--use-rewrites=1 \
--search-engine=elasticsearch8 \
--elasticsearch-host=https://elastic-magento.k8s.mydomain.com \
--elasticsearch-enable-auth=1 \
--elasticsearch-username=magento2 \
--elasticsearch-password=myElasticSearchUserPass

and i get error
image

I am sure that connection to elasticsearch8 works properly as i can access it through the browser and i can see everything in kibana.

For the record i tried also with

--search-engine=elasticsearch8 \
--elasticsearch-host=elastic-magento-es-http \
--elasticsearch-port=9200 \
--search-engine=elasticsearch8 \
--elasticsearch-host=elastic-magento.k8s.mydomain.com \
--elasticsearch-port=443 \

and i am able to do

wget  --user magento2 --password myElasticSearchUserPass https://elastic-magento-es-http:9200 --no-check-certificate

or

wget  --user magento2 --password myElasticSearchUserPass https://elastic-magento.k8s.mydomain.com/

and result is

{
  "name" : "elastic-magento-es-default-1",
  "cluster_name" : "elastic-magento",
  "cluster_uuid" : "aLAwT6pxTEmgKVvdT7ds-A",
  "version" : {
    "number" : "8.7.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "09520b59b6bc1057340b55750186466ea715e30e",
    "build_date" : "2023-03-27T16:31:09.816451435Z",
    "build_snapshot" : false,
    "lucene_version" : "9.5.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

also tried to install using

--disable-modules=Magento_InventoryElasticsearch,Magento_Elasticsearch8,Magento_Elasticsearch,Magento_OpenSearch

and later allow it

RUN bin/magento module:enable Magento_InventoryElasticsearch Magento_Elasticsearch8 Magento_Elasticsearch
RUN bin/magento config:set catalog/search/engine 'elasticsearch8'

but it does not work as well, and throws error

Next Magento\Framework\Exception\CouldNotSaveException: The stock item was unable to be saved. Please try again. in /app/magento/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:196
Stack trace:
#0 /app/magento/vendor/magento/module-catalog-inventory/Model/StockRegistry.php(181): Magento\CatalogInventory\Model\Stock\StockItemRepository->save()
#1 /app/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\CatalogInventory\Model\StockRegistry->updateStockItemBySku()
#2 /app/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\CatalogInventory\Model\StockRegistry\Interceptor->___callParent()
#3 /app/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\CatalogInventory\Model\StockRegistry\Interceptor->Magento\Framework\Interception\{closure}()
#4 /app/magento/generated/code/Magento/CatalogInventory/Model/StockRegistry/Interceptor.php(59): Magento\CatalogInventory\Model\StockRegistry\Interceptor->___callPlugins()
#5 /app/magento/vendor/magento/module-catalog-inventory/Observer/SaveInventoryDataObserver.php(125): Magento\CatalogInventory\Model\StockRegistry\Interceptor->updateStockItemBySku()
#6 /app/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Magento\CatalogInventory\Observer\SaveInventoryDataObserver->execute()
#7 /app/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod()
#8 /app/magento/vendor/magento/framework/Event/Manager.php(65): Magento\Framework\Event\Invoker\InvokerDefault->dispatch()
#9 /app/magento/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch()
#10 /app/magento/vendor/magento/framework/Model/AbstractModel.php(837): Magento\Framework\Event\Manager\Proxy->dispatch()
#11 /app/magento/vendor/magento/module-catalog/Model/Product.php(985): Magento\Framework\Model\AbstractModel->afterSave()
#12 /app/magento/vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php(34): Magento\Catalog\Model\Product->afterSave()
#13 /app/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Magento\Framework\EntityManager\Observer\AfterEntitySave->execute()
#14 /app/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod()
#15 /app/magento/vendor/magento/framework/Event/Manager.php(65): Magento\Framework\Event\Invoker\InvokerDefault->dispatch()
#16 /app/magento/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch()
#17 /app/magento/vendor/magento/framework/EntityManager/EventManager.php(49): Magento\Framework\Event\Manager\Proxy->dispatch()
#18 /app/magento/vendor/magento/framework/EntityManager/Operation/Create.php(123): Magento\Framework\EntityManager\EventManager->dispatchEntityEvent()
#19 /app/magento/vendor/magento/framework/EntityManager/EntityManager.php(106): Magento\Framework\EntityManager\Operation\Create->execute()
#20 /app/magento/vendor/magento/module-catalog/Model/ResourceModel/Product.php(777): Magento\Framework\EntityManager\EntityManager->save()
#21 /app/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Model\ResourceModel\Product->save()
#22 /app/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callParent()
#23 /app/magento/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(58): Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception\{closure}()
#24 /app/magento/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(28): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->addCommitCallback()
#25 /app/magento/vendor/magento/framework/Interception/Interceptor.php(135): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->aroundSave()
#26 /app/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception\{closure}()
#27 /app/magento/generated/code/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php(32): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callPlugins()
#28 /app/magento/vendor/magento/framework/Model/AbstractModel.php(663): Magento\Catalog\Model\ResourceModel\Product\Interceptor->save()
#29 /app/magento/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php(143): Magento\Framework\Model\AbstractModel->save()
#30 /app/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Controller\Adminhtml\Product\Save->execute()
#31 /app/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent()
#32 /app/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}()
#33 /app/magento/generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(23): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins()
#34 /app/magento/vendor/magento/framework/App/Action/Action.php(111): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->execute()
#35 /app/magento/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#36 /app/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch()
#37 /app/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent()
#38 /app/magento/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(145): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}()
#39 /app/magento/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
#40 /app/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}()
#41 /app/magento/generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(32): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins()
#42 /app/magento/vendor/magento/framework/App/FrontController.php(245): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch()
#43 /app/magento/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#44 /app/magento/vendor/magento/framework/App/FrontController.php(146): Magento\Framework\App\FrontController->processRequest()
#45 /app/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#46 /app/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#47 /app/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#48 /app/magento/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#49 /app/magento/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#50 /app/magento/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#51 /app/magento/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#52 {main} {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): The stock item was unable to be saved. Please try again. at /app/magento/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:196)
[previous exception] [object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): Could not ping search engine: No alive nodes. All the 1 nodes seem to be down. at /app/magento/vendor/magento/module-elasticsearch/Model/Adapter/Elasticsearch.php:196)"} []

@engcom-Dash
Copy link

Hi @laurnts ,

We have noticed that this issue has not been updated for a period of 14 Days.
Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks.

@Chris25602
Copy link

Chris25602 commented May 23, 2023

I have an issue with the stated resolution. I was unable to find the es8 magento package following the links provided by @engcom-Dash.

m2_es8_composer

Edit: I am working with the default 2.4-develop branch

@aashishgurung
Copy link

I am having same issue as @Chris25602. composer require magento/module-elasticsearch-8 --with-all-dependencies outputs package could not be found.

@hostep
Copy link
Contributor

hostep commented Jun 19, 2023

@aashishgurung: the correct command is composer require magento/module-elasticsearch-8 --update-with-all-dependencies (like is being mentioned in the documentation)

And over here that command works both in Magento 2.4.6 and 2.4.6-p1...

@aashishgurung
Copy link

aashishgurung commented Jun 20, 2023

@hostep Thanks for correcting the option. But the issue here is that the package itself is not found. I tried again, got the same result. My Magento is 2.4.6.

composer require magento/module-elasticsearch-8 --update-with-all-dependencies

Could not find a matching version of package magento/module-elasticsearch-8.
Check the package spelling, your version constraint and that the package is
available in a stability which matches your minimum-stability (stable).

You can check the screenshot posted by @Chris25602.

@hostep
Copy link
Contributor

hostep commented Jun 20, 2023

@aashishgurung: The only thing I can come up with is that you guys are not using repo.magento.com for your composer packages repository and that this repository hasn't got this package yet. Is that the problem maybe? Have you defined an alternative repository in your composer.json file?

You can probably figure this out by enabling more verbose output:

composer require -vvv magento/module-elasticsearch-8 --update-with-all-dependencies

@medigeek
Copy link
Member

medigeek commented Jul 1, 2023

I think we need a detailed explanation/documentation on how to configure magento 2 with elasticsearch 8 and opensearch with security enabled.

Otherwise I had to switch to opensearch and use plugins.security.disabled: true in /etc/opensearch/opensearch.yml

also, suffered from https://magento.stackexchange.com/a/323415 and this error: Fatal error: Uncaught Error: Cannot instantiate interface Magento\AdvancedSearch\Model\Client\ClientOptionsInterface

and obviously required to enable Magento_Elasticsearch module even though I'm using Magento_Opensearch

Here's a quick how-to with security disabled and opensearch 2.5.x on ubuntu and magento 2.4.6


As of version 2.3.7-p3, Adobe Commerce and Magento Open Source support OpenSearch. On-premises installations continue to support Elasticsearch, although it is no longer supported for Adobe Commerce on cloud infrastructure.


test opensearch

https://stackoverflow.com/questions/76252296/can-i-install-opensearch-without-using-docker-on-ubuntu/76364021#76364021
https://opensearch.org/docs/latest/install-and-configure/install-opensearch/debian/

using on dev version 2.5.x instead of supported magento 2 2.2.x: https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html



sudo apt-get install opensearch=2.5.0

systemctl stop elasticsearch
systemctl disable elasticsearch


nano /etc/opensearch/opensearch.yml
#(add the following text)
network.host: localhost
node.name: node-1
plugins.security.disabled: true


systemctl start opensearch
systemctl enable opensearch

curl -X GET http://localhost:9200/

bin/magento config:set catalog/search/engine 'opensearch'

bin/magento module:disable Magento_InventoryElasticsearch Magento_Elasticsearch8 Magento_Elasticsearch Magento_OpenSearch
bin/magento module:enable Magento_OpenSearch Magento_Elasticsearch

bin/magento setup:install --search-engine=opensearch --opensearch-host=localhost --opensearch-port=9200 --opensearch-enable-auth=0 --opensearch-index-prefix=magento2 --opensearch-timeout=15

php -d memory_limit=-1 composer.phar install
php -d memory_limit=2G bin/magento setup:upgrade
php -d memory_limit=2G bin/magento setup:di:compile

php -d memory_limit=2G bin/magento s:s:d -f -j 4

php -d memory_limit=2G bin/magento cache:clean

php -d memory_limit=2G bin/magento indexer:reindex

php -d memory_limit=2G bin/magento cache:clean

@medigeek
Copy link
Member

medigeek commented Jul 1, 2023

something tells me we're missing the part where we add the self signed ssl certificate to be trusted as verified in php or in the server OS.

something like https://stackoverflow.com/questions/21187946/curl-error-60-ssl-certificate-issue-self-signed-certificate-in-certificate-cha

some setting in php.ini ? like https://serverfault.com/questions/633644/adding-a-self-signed-cert-to-the-trusted-certs-within-curl-in-windows

I wonder if hacking this configuration to disable ssl verification in file vendor/magento/framework/HTTP/Adapter/Curl.php will make any difference?

        'verifypeer' => true,
        'verifyhost' => 2

@cfortin
Copy link

cfortin commented Jul 14, 2023

i wasted all weekend to find out this, running different setups like crazy. adobe fiddled around for 217 days and came up with a broken release, a non-working core component without which the whole patform can't be installed... now it's my time to whine...

Such oversight makes me want to rant now...

I find this happens with almost every single release they come out with. I've upgraded from 2.4.0 to each release to now 2.4.5 (I will not be updating to .6 until .6-p1) and every single "major" release (.1, .2, .3, .4, .5) has had some profoundly surprising bugs that makes you wonder who tests these releases. Almost like they test with one setup and say "good to go". It's absolutely absurd and can destroy businesses. I wonder if paying the $1500+ per month for "Adobe Commerce" has less bugs. Highly doubt it. The sad part? It's released only two weeks prior to GA (general availability) for "testing" even to those paying customers. Like really?

I swear, whoever came up with the release schedule for this system should be fired. It's just simply not the way to do it. Smaller, quicker releases are MUCH smarter and better to do. For instance, WooCommerce (which has like 100x more store running it, like 10m compared to 500k for Magento) does releases like once per month. Those releases are MUCH smaller. Easier to deal with bugs and testing - they will also release fixes quickly after instead of making the merchant wait 4-5 months. It's also available for testing WHILE it's being developed. Adobe, for reasons unknown (probably greed somehow) keeps the testing of the dev version behind closed doors (like all those "jira" bug reports require you to be an "Adobe staff member" - like really?? thought this was open-source) so the only REAL testing is done in the two weeks prior to GA. Like how dumb. Then problems like this arises. Problems that should not even have happened if it were tested better. But now stores that rely on a stable eCommerce system so they can make MONEY deal with major site breaking bugs. That is explicitly why most Magento stores pay like $5k for "upgrade" teams - because of the garbage QC (quality control) that Adobe does.

It's sad because overall I think the features and usual stability of Magento is above most others, but during release time it's always a disaster. Always. So...the trick I think I'm learning? ALWAYS wait for the "p" release. Then move to that one, which should HOPEFULLY have the major release's bugs fixed. Because again, with their garbage release schedule they don't release minor point releases to fix problems like this. This major issue, and others, will only be [hopefully] fixed now 4-5 months from now with the "p" release - though knowing them, they will say "this fix is targeted for 2.4.7" or "2.4.8", at the end of 2023 or this time next year - which is just insane. Instead of doing what many other sane companies do and just come out with a minor point release (2.4.6.1) fixing major issues like this.

Gah rant over. Good luck to anyone that updated. I will be waiting, and will always do with this system. Never have I before seen such garbage QC every release. Every...single...time. Really wish WooCommerce was more like this system (features, stability, etc.) because I would just stick with that, I trust their new releases so much more. The garbage Adobe pulls every time with these releases sours my outlook on Magento so much rage

I wholeheartedly agree. As someone coming from the Drupal ecosystem, Magento makes Drupal look like the Rolls-Royce of open source software. This is not the way to do open source properly.

@preetkakkar
Copy link

@medigeek I have tried with your instructions how-to with security disabled and opensearch magento 2.4.6

php -d memory_limit=-1 composer.phar install ( shows the following error_
Could not open input file: composer.phar

and
php -d memory_limit=2G bin/magento setup:upgrade
Could not validate a connection to the OpenSearch. No alive nodes found in your cluster

Does anyone got any solution for this.

@hielh
Copy link

hielh commented Oct 30, 2023

@preetkakkar any solution for your problem please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests