Sfoglia il codice sorgente

Merge pull request #680 from markshust/feature/opensearch

Mark Shust 2 anni fa
parent
commit
13bf00d120

+ 34 - 0
.github/workflows/build-opensearch.yml

@@ -0,0 +1,34 @@
+name: build-opensearch
+
+on: workflow_dispatch
+
+jobs:
+  opensearch-1-2:
+    runs-on: ubuntu-latest
+    steps:
+      -
+        name: Checkout
+        uses: actions/checkout@v2
+      -
+        name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+      -
+        name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+      -
+        name: Login to DockerHub
+        uses: docker/login-action@v1 
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      -
+        name: Build and push
+        id: docker_build
+        uses: docker/build-push-action@v2
+        with:
+          context: images/opensearch/1.2
+          platforms: linux/amd64,linux/arm64
+          push: true
+          tags: |
+            markoshust/magento-opensearch:1.2
+            markoshust/magento-opensearch:1.2-0

+ 4 - 3
compose/bin/setup

@@ -9,6 +9,8 @@ MEM=$(docker info | grep "Total Memory" | cut -d':' -f2 | xargs | sed s/GiB//)
 source env/db.env
 # shellcheck source=../env/elasticsearch.env
 source env/elasticsearch.env
+# shellcheck source=../env/opensearch.env
+source env/opensearch.env
 # shellcheck source=../env/magento.env
 source env/magento.env
 # shellcheck source=../env/rabbitmq.env
@@ -60,9 +62,8 @@ bin/clinotty bin/magento setup:install \
   --session-save-redis-host=redis \
   --session-save-redis-log-level=4 \
   --session-save-redis-db=2 \
-  --search-engine=elasticsearch7 \
-  --elasticsearch-host=$ES_HOST \
-  --elasticsearch-port=$ES_PORT \
+  --elasticsearch-host=$OPENSEARCH_HOST \
+  --elasticsearch-port=$OPENSEARCH_PORT \
   --use-rewrites=1 \
   --no-interaction
 

+ 3 - 4
compose/compose.yaml

@@ -52,15 +52,14 @@ services:
     ports:
       - "6379:6379"
 
-  elasticsearch:
-    image: markoshust/magento-elasticsearch:7.16-0
+  opensearch:
+    image: markoshust/magento-opensearch:1.2.4-0
     ports:
       - "9200:9200"
       - "9300:9300"
+    env_file: env/opensearch.env
     environment:
       - "discovery.type=single-node"
-      ## Set custom heap size to avoid memory errors
-      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
       ## Avoid test failures due to small disks
       ## More info at https://github.com/markshust/docker-magento/issues/488
       - "cluster.routing.allocation.disk.threshold_enabled=false"

+ 3 - 0
compose/env/elasticsearch.env

@@ -1,2 +1,5 @@
 ES_HOST=elasticsearch
 ES_PORT=9200
+
+## Set custom heap size to avoid memory errors
+ES_JAVA_OPTS="-Xms1g -Xmx1g"

+ 9 - 0
compose/env/opensearch.env

@@ -0,0 +1,9 @@
+OPENSEARCH_HOST=opensearch
+OPENSEARCH_PORT=9200
+OPENSEARCH_HEALTHCHECK_TIMEOUT=100
+
+## Set custom heap size to avoid memory errors
+ES_JAVA_OPTS="-Xms1g -Xmx1g"
+
+# Prevent security patch conflicts with core M2 code
+DISABLE_SECURITY_PLUGIN=true

+ 5 - 0
images/opensearch/1.2/Dockerfile

@@ -0,0 +1,5 @@
+FROM opensearchproject/opensearch:1.2.4
+
+RUN /usr/share/opensearch/bin/opensearch-plugin install --batch \
+  analysis-icu \
+  analysis-phonetic