feat(zammad): support limiting elasticsearch memory

This commit is contained in:
Johanna Dorothea Reichmann 2022-07-25 07:39:15 +02:00
parent 40eee20240
commit 17d1535d3a
No known key found for this signature in database
GPG key ID: 03624C433676E465
4 changed files with 19 additions and 4 deletions

View file

@ -20,6 +20,9 @@ zammad_network:
zammad_host_network: ~ zammad_host_network: ~
zammad_allow_host_nework: ~ zammad_allow_host_nework: ~
zammad_elastic_max_mem_in_mb: 512
zammad_elastic_min_mem_in_mb: 256
# The container order is *very* important! # The container order is *very* important!
zammad_containers: zammad_containers:
- name: "zammad-postgresql" - name: "zammad-postgresql"
@ -62,6 +65,9 @@ zammad_containers:
networks: networks:
- name: "{{ zammad_network.name }}" - name: "{{ zammad_network.name }}"
add_host_network: "{{ zammad_allow_host_nework.elasticsearch | default(False) }}" add_host_network: "{{ zammad_allow_host_nework.elasticsearch | default(False) }}"
memory_limit: "{{ zammad_elastic_max_mem_in_mb }}M"
env:
ES_JAVA_OPTS: "-Xms{{ zammad_elastic_min_mem_in_mb }}m -Xmx{{ zammad_elastic_max_mem_in_mb }}m"
- name: "zammad-websocket" - name: "zammad-websocket"
image_name: "{{ zammad_container_repo }}" image_name: "{{ zammad_container_repo }}"

View file

@ -39,6 +39,16 @@
notify: Restart elasticsearch notify: Restart elasticsearch
loop: "{{ zammad_elasticsearch_files }}" loop: "{{ zammad_elasticsearch_files }}"
- name: Template elasticsearch jvm options
template:
src: jvm.options.j2
dest: "{{ zammad_base_path }}/elasticsearch-config/jvm.options"
owner: "{{ zammad_user_res.uid }}"
group: "{{ zammad_user_res.group }}"
mode: "0660"
tags: [ 'prepare', 'prepare-zammad' ]
notify: Restart elasticsearch
- name: Template fake /etc/passwd for postgres - name: Template fake /etc/passwd for postgres
template: template:
src: postgres-passwd.j2 src: postgres-passwd.j2
@ -91,6 +101,7 @@
labels: "{{ container.labels | default(omit) }}" labels: "{{ container.labels | default(omit) }}"
volumes: "{{ container.volumes | default(omit) }}" volumes: "{{ container.volumes | default(omit) }}"
restart_policy: "{{ container.restart_policy }}" restart_policy: "{{ container.restart_policy }}"
memory: "{{ container.memory_limit | default(omit) }}"
state: "{{ container.state | default('started') }}" state: "{{ container.state | default('started') }}"
comparisons: comparisons:
networks: strict networks: strict

View file

@ -19,8 +19,8 @@
# Xms represents the initial size of total heap space # Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space # Xmx represents the maximum size of total heap space
-Xms1g -Xms{{ zammad_elastic_min_mem_in_mb }}m
-Xmx1g -Xmx{{ zammad_elastic_max_mem_in_mb }}m
################################################################ ################################################################
## Expert settings ## Expert settings

View file

@ -17,8 +17,6 @@ zammad_directories:
zammad_elasticsearch_files: zammad_elasticsearch_files:
- src: elasticsearch.yml - src: elasticsearch.yml
mode: 660 mode: 660
- src: jvm.options
mode: 660
- src: log4j2.properties - src: log4j2.properties
mode: 660 mode: 660