Refactor Shopware role to use dedicated OpenSearch service and improved environment handling.

Changes include:
- Added OpenSearch configuration and variable definitions (image, version, heap, memory limits)
- Replaced legacy search/elasticsearch logic with OpenSearch integration
- Updated docker-compose template for OpenSearch with proper JVM heap and ulimits
- Ensured both OPENSEARCH_URL and ELASTICSEARCH_URL are set for compatibility

Reference: https://chatgpt.com/share/6907b0d4-ab14-800f-b576-62c0d26c8ad1
This commit is contained in:
2025-11-02 21:05:52 +01:00
parent ec7b8662dd
commit 7bc9f7abd9
4 changed files with 45 additions and 51 deletions

View File

@@ -27,29 +27,20 @@
{% include 'roles/docker-container/templates/healthcheck/curl.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
{% if SHOPWARE_SEARCH_ENABLED %}
{% if SHOPWARE_SEARCH_ENGINE == 'opensearch' %}
{% if SHOPWARE_OPENSEARCH_ENABLED %}
{% set service_name = 'opensearch' %}
{{ service_name }}:
{% include 'roles/docker-container/templates/base.yml.j2' %}
image: opensearchproject/opensearch:2
image: "{{ SHOPWARE_OPENSEARCH_IMAGE }}:{{ SHOPWARE_OPENSEARCH_VERSION }}"
container_name: "{{ SHOPWARE_OPENSEARCH_CONTAINER }}"
environment:
- discovery.type=single-node
- plugins.security.disabled=true
- bootstrap.memory_lock=true
- OPENSEARCH_JAVA_OPTS=-Xms{{ SHOPWARE_OPENSEARCH_MEM_RESERVATION }} -Xmx{{ SHOPWARE_OPENSEARCH_MEM_RESERVATION }}
ulimits:
memlock: { soft: -1, hard: -1 }
{% include 'roles/docker-container/templates/networks.yml.j2' %}
{% else %}
{% set service_name = 'elasticsearch' %}
{{ service_name }}:
{% include 'roles/docker-container/templates/base.yml.j2' %}
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.22
environment:
- discovery.type=single-node
ulimits:
memlock: { soft: -1, hard: -1 }
{% include 'roles/docker-container/templates/networks.yml.j2' %}
{% endif %}
{% endif %}
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}

View File

@@ -19,13 +19,11 @@ MESSENGER_TRANSPORT_DSN="redis://{{ SHOPWARE_REDIS_ADDRESS }}/2"
CACHE_URL="file://cache"
{% endif %}
{% if SHOPWARE_OPENSEARCH_ENABLED %}
# Search
{% if SHOPWARE_SEARCH_ENABLED %}
{% if SHOPWARE_SEARCH_ENGINE == 'opensearch' %}
OPENSEARCH_URL="http://opensearch:9200"
{% else %}
ELASTICSEARCH_URL="http://elasticsearch:9200"
{% endif %}
ELASTICSEARCH_URL="http://opensearch:9200"
{% endif %}
# Mail (Mailu)