Files
computer-playbook/roles/web-app-magento/templates/compose.yml.j2
kevinveenbirkenbachandClaude Opus 5.5 a7db89ac0b fix(search): give the search engines half of their container as heap
The central Elasticsearch, Zammad's Elasticsearch and Magento's
OpenSearch ran with a literal heap beside a mem_limit four times its
size: 1g in 4g, 512m in 2g and 512m in 2g. The heap is now half of the
limit through lookup('service_memory_mb'), which makes it 2048, 1024
and 1024 MiB and lets it follow the limit when that changes.

Xms equals Xmx, so these containers hold that much more memory from
the start.

Zammad's memcached size and Magento's PHP_MEMORY_LIMIT take the same
lookup and keep their values, 256 and 768M.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 23:31:14 +02:00

50 lines
2.3 KiB
Django/Jinja

{% include 'roles/sys-svc-compose/templates/base.yml.j2' %}
{% set MAGENTO_PHP_READY_GATE = "until nc -z " ~ MAGENTO_PHP_HOST ~ " " ~ MAGENTO_PHP_PORT ~ " 2>/dev/null; do sleep 2; done;" %}
{% set service_name = 'nginx' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_image', application_id, 'nginx') }}
{{ lookup('compose_only', 'container_name', MAGENTO_NGINX_CONTAINER) }}
command: ["sh", "-c", "{{ MAGENTO_PHP_READY_GATE }} exec nginx -g 'daemon off;'"]
{{ lookup('depends_on', ['php', 'search']) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_ports', ['magento', 'http', DOCKER_BIND_HOST]) | indent(4) }}
healthcheck:
test: ["CMD-SHELL", "nginx -t >/dev/null 2>&1 && nc -z {{ MAGENTO_PHP_HOST }} {{ MAGENTO_PHP_PORT }}"]
interval: 2m
timeout: 5s
retries: 5
start_period: 10m
start_interval: 5s
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'php' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_image', application_id, 'php') }}
{{ lookup('compose_only', 'container_name', MAGENTO_PHP_CONTAINER) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_depends_on', application_id, extra={
'search': {'condition': 'service_started'},
}) | indent(4) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'search' %}
{{ service_name }}:
{{ lookup('container_image', application_id, 'search') }}
{{ lookup('compose_only', 'container_name', MAGENTO_SEARCH_CONTAINER) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
environment:
- discovery.type=single-node
- plugins.security.disabled=true
- OPENSEARCH_JAVA_OPTS=-Xms{{ MAGENTO_SEARCH_HEAP_MB }}m -Xmx{{ MAGENTO_SEARCH_HEAP_MB }}m
{{ lookup('container_healthcheck', service_name) | indent(4) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('compose_volumes') }}
{{ lookup('compose_networks') }}