mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-09 14:46:37 +00:00
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:
@@ -1,7 +1,4 @@
|
||||
title: "{{ SOFTWARE_NAME }} Shop"
|
||||
configuration:
|
||||
search:
|
||||
engine: "{{ SHOPWARE_SEARCH_ENGINE }}"
|
||||
features:
|
||||
central_database: true
|
||||
redis: true
|
||||
@@ -21,32 +18,35 @@ docker:
|
||||
database:
|
||||
enabled: true
|
||||
php:
|
||||
image: "{{ SHOPWARE_PHP_IMAGE }}"
|
||||
version: "{{ SHOPWARE_VERSION }}"
|
||||
name: "{{ SHOPWARE_PHP_CONTAINER }}"
|
||||
cpus: 2.0
|
||||
mem_reservation: 2g
|
||||
mem_limit: 4g
|
||||
pids_limit: 2048
|
||||
image: "ghcr.io/shopware/development"
|
||||
version: "latest"
|
||||
name: "shopware-php"
|
||||
cpus: 2.0
|
||||
mem_reservation: 2g
|
||||
mem_limit: 4g
|
||||
pids_limit: 2048
|
||||
nginx:
|
||||
image: "{{ SHOPWARE_NGINX_IMAGE }}"
|
||||
version: "{{ SHOPWARE_NGINX_VERSION }}"
|
||||
name: "{{ SHOPWARE_NGINX_CONTAINER }}"
|
||||
port: 8080
|
||||
cpus: 0.5
|
||||
mem_reservation: 256m
|
||||
mem_limit: 512m
|
||||
image: "nginx"
|
||||
version: "alpine"
|
||||
name: "shopware-nginx"
|
||||
port: 8080
|
||||
cpus: 0.5
|
||||
mem_reservation: 256m
|
||||
mem_limit: 512m
|
||||
redis:
|
||||
enabled: "{{ SHOPWARE_REDIS_ENABLED }}"
|
||||
cpus: 0.25
|
||||
mem_reservation: 256m
|
||||
mem_limit: 512m
|
||||
elasticsearch:
|
||||
mem_limit: 2gb
|
||||
enabled: true
|
||||
image: "redis"
|
||||
version: "7-alpine"
|
||||
cpus: 0.25
|
||||
mem_reservation: 256m
|
||||
mem_limit: 512m
|
||||
opensearch:
|
||||
mem_limit: 2gb
|
||||
search:
|
||||
enabled: "{{ SHOPWARE_SEARCH_ENABLED }}"
|
||||
engine: "{{ SHOPWARE_SEARCH_ENGINE }}"
|
||||
enabled: true
|
||||
image: "opensearchproject/opensearch"
|
||||
version: "2.12.0"
|
||||
name: "shopware-opensearch"
|
||||
cpus: 1.0
|
||||
mem_reservation: 2g
|
||||
mem_limit: 4g
|
||||
volumes:
|
||||
data: "{{ SHOPWARE_VOLUME }}"
|
||||
data: "shopware_data"
|
||||
|
||||
@@ -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' %}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -18,10 +18,15 @@ SHOPWARE_USER: "www-data"
|
||||
SHOPWARE_ROOT: "/var/www/html"
|
||||
|
||||
# Search/Cache
|
||||
SHOPWARE_REDIS_ENABLED: "{{ applications | get_app_conf(application_id, 'docker.services.redis.enabled') }}"
|
||||
SHOPWARE_REDIS_ADDRESS: "redis:6379"
|
||||
SHOPWARE_SEARCH_ENABLED: "{{ applications | get_app_conf(application_id, 'docker.services.search.enabled') }}"
|
||||
SHOPWARE_SEARCH_ENGINE: "{{ applications | get_app_conf(application_id, 'docker.services.search.engine') }}"
|
||||
SHOPWARE_REDIS_ENABLED: "{{ applications | get_app_conf(application_id, 'docker.services.redis.enabled') }}"
|
||||
SHOPWARE_REDIS_ADDRESS: "redis:6379"
|
||||
SHOPWARE_OPENSEARCH_ENABLED: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.enabled') }}"
|
||||
SHOPWARE_OPENSEARCH_ENGINE: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.engine') }}"
|
||||
SHOPWARE_OPENSEARCH_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.image') }}"
|
||||
SHOPWARE_OPENSEARCH_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.version') }}"
|
||||
SHOPWARE_OPENSEARCH_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.name') }}"
|
||||
SHOPWARE_OPENSEARCH_MEM_RESERVATION: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.mem_reservation') }}"
|
||||
SHOPWARE_OPENSEARCH_MEM_LIMIT: "{{ applications | get_app_conf(application_id, 'docker.services.opensearch.mem_limit') }}"
|
||||
|
||||
# IAM (true if either OIDC or LDAP is enabled)
|
||||
SHOPWARE_IAM_ENABLED: "{{ applications | get_app_conf(application_id, 'features.oidc') or applications | get_app_conf(application_id, 'features.ldap') }}"
|
||||
|
||||
Reference in New Issue
Block a user