Files
computer-playbook/roles/web-app-shopware/templates/compose.yml.j2
kevinveenbirkenbachandClaude Opus 5.5 462bc4ccf0 fix(web-app-shopware): keep the init memory limit in the role's env file
The init service received INIT_PHP_MEMORY_LIMIT through an inline
environment block in the compose template. It moves to templates/env.j2,
which the container base hands to every Shopware container as env_file.
Only files/shell/init.sh reads the variable, behind a `:?` guard, so the
other containers seeing it changes nothing.

The lookup names 'init' instead of service_name, which is bound in the
compose template but not in env.j2. The value stays 1024M.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 01:37:17 +02:00

103 lines
4.5 KiB
Django/Jinja

x-environment: &shopware
{{ lookup('container_image', application_id, 'shopware', version=SHOPWARE_PKG_VERSION) }}
working_dir: {{ SHOPWARE_ROOT }}
{{ lookup('compose_only', 'pull_policy', 'never') }}
{% include 'roles/sys-svc-compose/templates/base.yml.j2' %}
{% set service_name = 'init' %}
{% set docker_restart_policy = 'no' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
<<: *shopware
{{ lookup('compose_only', 'container_name', SHOPWARE_INIT_CONTAINER) }}
entrypoint: [ "sh", "{{ SHOPWARE_INIT_DOCKER }}" ]
user: "0:0"
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'web' %}
{% set docker_restart_policy = DOCKER_RESTART_POLICY %}
{% set container_port = lookup('config',application_id, 'services.web.ports.internal.http') %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
<<: *shopware
{{ lookup('template', 'roles/sys-svc-container/templates/build.yml.j2') | indent(4) }}
args:
SHOPWARE_CONTAINER_IMAGE: "{{ SHOPWARE_CONTAINER_IMAGE }}"
SHOPWARE_CONTAINER_VERSION: "{{ SHOPWARE_CONTAINER_VERSION }}"
SHOPWARE_PKG_NAME: "{{ SHOPWARE_PKG_NAME }}"
SHOPWARE_PKG_VERSION: "{{ SHOPWARE_PKG_VERSION }}"
SHOPWARE_COMPOSER_PLATFORM_PHP: "{{ SHOPWARE_COMPOSER_PLATFORM_PHP }}"
SHOPWARE_PHP_IMAGE: "{{ SHOPWARE_PHP_IMAGE }}"
SHOPWARE_PHP_VERSION: "{{ SHOPWARE_PHP_VERSION }}"
{{ lookup('compose_only', 'container_name', SHOPWARE_WEB_CONTAINER) }}
{{ lookup('container_ports', ['shopware', 'http', DOCKER_BIND_HOST]) | indent(4) }}
{{ lookup('depends_on', {'init': 'service_completed_successfully'}) }}
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1:{{ container_port }}/robots.txt || wget -q --spider http://127.0.0.1:{{ container_port }}/ || exit 1"]
interval: 2m
timeout: 5s
retries: 10
start_period: 10m
start_interval: 5s
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{% set service_name = 'worker' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
<<: *shopware
{{ lookup('compose_only', 'container_name', SHOPWARE_WORKER_CONTAINER) }}
entrypoint: {{ SHOPWARE_WORKER_ENTRYPOINT }}
command: ["--memory-limit={{ lookup('service_memory_mb', application_id, service_name, 0.25) }}M"]
{{ lookup('depends_on', {'init': 'service_completed_successfully'}) }}
{{ lookup('container_healthcheck', service_name) | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'scheduler' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
<<: *shopware
{{ lookup('compose_only', 'container_name', SHOPWARE_SCHED_CONTAINER) }}
entrypoint: {{ SHOPWARE_SCHED_ENTRYPOINT }}
{{ lookup('depends_on', {'init': 'service_completed_successfully'}) }}
{{ lookup('container_healthcheck', service_name) | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% if SHOPWARE_OPENSEARCH_ENABLED %}
{% set service_name = 'opensearch' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_image', application_id, 'opensearch') }}
{{ lookup('compose_only', 'container_name', SHOPWARE_OPENSEARCH_CONTAINER) }}
environment:
- discovery.type=single-node
- plugins.security.disabled=true
- bootstrap.memory_lock=true
- OPENSEARCH_JAVA_OPTS=-Xms{{ SHOPWARE_OPENSEARCH_HEAP_MB }}m -Xmx{{ SHOPWARE_OPENSEARCH_HEAP_MB }}m
ulimits:
memlock: { soft: -1, hard: -1 }
{{ lookup('depends_on', {'init': 'service_completed_successfully'}) }}
healthcheck:
test: ["CMD-SHELL", "curl -fsSL http://127.0.0.1:{{ SHOPWARE_OPENSEARCH_PORT }}/_cluster/health || exit 1"]
interval: 2m
# nocheck: healthcheck-timing-override curl against opensearch, which does not answer inside the 5s default while it is still forming its cluster
timeout: 10s
retries: 5
start_period: 10m
start_interval: 5s
{{ lookup('container_networks') | indent(4) }}
{% endif %}
{{ lookup('compose_volumes') }}
{{ lookup('compose_networks') }}