26 lines
982 B
Plaintext
26 lines
982 B
Plaintext
{% for vhost,config in pillar["vhosts"].items() %}
|
|
Prepare elasticsearch volume for {{ vhost }}:
|
|
docker_volume.present:
|
|
- name: elasticsearch-{{ vhost }}
|
|
- driver: local
|
|
|
|
Run Elasticsearch container for {{ vhost }}:
|
|
docker_container.running:
|
|
- name: elasticsearch-{{ vhost }}
|
|
- image: docker.elastic.co/elasticsearch/elasticsearch:7.17.10
|
|
- start: True
|
|
- restart: always
|
|
- networks:
|
|
- network-{{ vhost }}
|
|
- environment:
|
|
- xpack.security.enabled=false
|
|
- discovery.type=single-node
|
|
- ES_JAVA_OPTS=-Xms{{ config.elastic_heap_min }} -Xmx{{ config.elastic_heap_max }}
|
|
- binds:
|
|
- elasticsearch-{{ vhost }}:/usr/share/elasticsearch/data
|
|
- healthcheck:
|
|
- test: [ "CMD", "curl", "--fail" , "http://elasticsearch-{{ vhost }}:9200/_cluster/health?wait_for_status=green&timeout=5s", "||", "exit", "1" ]
|
|
- interval: {{ 5e9 | int }} # 5s
|
|
- timeout: {{ 5e9 | int }} # 5s
|
|
- retries: 5
|
|
{% endfor %} |