Skip to content

Commit

Permalink
Merge pull request #6241 from dimagi/ap/remove-es2-support
Browse files Browse the repository at this point in the history
Remove es2 support from commcare-cloud
  • Loading branch information
AmitPhulera authored Mar 12, 2024
2 parents 9284d07 + 10dec90 commit a384aaf
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 108 deletions.
6 changes: 3 additions & 3 deletions quick_monolith_install/sample-environment/public.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{% endraw %}
elasticsearch_memory: '2048m'
elasticsearch_cluster_name: '{{env_name}}-es'
elasticsearch_version: 2.4.6
elasticsearch_download_sha256: 5f7e4bb792917bb7ffc2a5f612dfec87416d54563f795d6a70637befef4cfc6f.
elasticsearch_version: 5.6.16
elasticsearch_download_sha256: 6b035a59337d571ab70cea72cc55225c027ad142fbb07fd8984e54261657c77f.

formplayer_java_version: {% raw %}"{{ java_17_bin_path }}/java"
{% endraw %}
Expand Down Expand Up @@ -82,7 +82,7 @@ localsettings:
COUCH_STALE_QUERY: 'update_after'
DEPLOY_MACHINE_NAME: {% raw %}"{{ ansible_hostname }}"
{% endraw %}
ELASTICSEARCH_MAJOR_VERSION: 2
ELASTICSEARCH_MAJOR_VERSION: 5
EMAIL_SMTP_HOST: 'localhost'
EMAIL_SMTP_PORT: 25
EMAIL_USE_TLS: no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ ELASTICSEARCH_PORT = {{ ELASTICSEARCH_PORT }}
{% if 'ELASTICSEARCH_MAJOR_VERSION' in localsettings %}
ELASTICSEARCH_MAJOR_VERSION = {{ localsettings.ELASTICSEARCH_MAJOR_VERSION }}
{% else %}
ELASTICSEARCH_MAJOR_VERSION = 2
ELASTICSEARCH_MAJOR_VERSION = 5
{% endif %}

ES_SETTINGS = {{ ES_SETTINGS }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
---
elasticsearch_version: 2.4.6
elasticsearch_version: 5.6.16
# https://www.elastic.co/guide/en/elasticsearch/guide/current/heap-sizing.html#_give_half_your_memory_to_lucene
# Either half the machines RAM or 24 GB. If changing in the future, never want to go over 30 GB
elasticsearch_memory: "{{ [ansible_memory_mb.real.total // 2, 24576] | min }}m"
elasticsearch_download_sha256: 5f7e4bb792917bb7ffc2a5f612dfec87416d54563f795d6a70637befef4cfc6f.
elasticsearch_download_sha256: 6b035a59337d571ab70cea72cc55225c027ad142fbb07fd8984e54261657c77f.
elasticsearch_home: "/opt/elasticsearch-{{ elasticsearch_version }}"
elasticsearch_conf_dir: "/etc/elasticsearch-{{ elasticsearch_version }}"
elasticsearch_data_dir: "{{ encrypted_root }}/elasticsearch-{{ elasticsearch_version }}"
elasticsearch_tcp_port: 9300
elasticsearch_http_port: 9200
#es_snapshot_bucket: "dimagi-{{ deploy_env }}-es-snapshots"
es_repository_name: "{{ deploy_env }}_es_snapshot"
aws_plugin_version: "2.7.1"
swift_plugin_version: "2.4.6"
backup_es_swift: no
elasticsearch_enable_inline_groovy_scripts: True
elasticsearch_service_name: elasticsearch
Expand Down
11 changes: 0 additions & 11 deletions src/commcare_cloud/ansible/roles/elasticsearch/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
value: '262144'
state: present
become: yes

- name: Download Elasticsearch 2.4.x
become: yes
get_url:
url: "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-{{ elasticsearch_version }}.tar.gz"
dest: "/home/{{ cchq_user }}/downloads/elasticsearch-{{ elasticsearch_version }}.tar.gz"
sha256sum: "{{ elasticsearch_download_sha256 }}"
when: elasticsearch_version == "2.4.6"

- name: Download Elasticsearch 5
become: yes
Expand Down Expand Up @@ -83,9 +75,6 @@
tags:
- es_conf

- include: misc_v2.yml
when: elasticsearch_version == '2.4.6'

- include: misc_v5.yml
when: elasticsearch_version == '5.6.16'

Expand Down
47 changes: 0 additions & 47 deletions src/commcare_cloud/ansible/roles/elasticsearch/tasks/misc_v2.yml

This file was deleted.

10 changes: 0 additions & 10 deletions src/commcare_cloud/ansible/roles/elasticsearch/tasks/misc_v7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,3 @@
- name: Check for installed plugins
shell: "{{ elasticsearch_home }}/bin/elasticsearch-plugin list"
register: installed_plugins

- name: Install elasticsearch aws plugin
become: yes
shell: "{{ elasticsearch_home }}/bin/elasticsearch-plugin install elasticsearch/elasticsearch-cloud-aws/{{ aws_plugin_version }}"
when: (backup_es_s3) and (installed_plugins.stdout is defined) and ('cloud-aws' not in installed_plugins.stdout)

- name: Install elasticsearch swift plugin
become: yes
shell: "{{ elasticsearch_home }}/bin/elasticsearch-plugin install https://github.com/dimagi/elasticsearch-repository-swift/releases/download/swift-repository-plugin-{{ swift_plugin_version }}/repository-swift-3.0.0-es{{ swift_plugin_version }}.zip"
when: (backup_es_swift) and (installed_plugins.stdout is defined) and ('repository-swift' not in installed_plugins.stdout)
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ node.name: "{{ elasticsearch_node_name }}"
{% if elasticsearch_node_zone is defined %}
# Used for shard allocation awareness
# https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html
{% if elasticsearch_version == '2.4.6'%}
node.zone: "{{ elasticsearch_node_zone }}"
{% endif %}
{% if elasticsearch_version is version('5.0.0', '>=') %}
node.attr.zone: "{{ elasticsearch_node_zone }}"
{% endif %}
{% endif %}

# disable multiple nodes starting from the same installation location
node.max_local_storage_nodes: 1
Expand All @@ -40,10 +35,7 @@ discovery.zen.minimum_master_nodes: {{ [2, groups.elasticsearch|map('extract', h
discovery.zen.fd.ping_timeout: 90s
discovery.zen.fd.ping_interval: 10s
discovery.zen.fd.ping_retries: 20
{% if elasticsearch_version == '2.4.6' %}
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.timeout: 90s
{% endif %}

{% if elasticsearch_version == '5.6.16' %}
discovery.zen.ping_timeout: 90s
{% endif %}
Expand All @@ -70,14 +62,6 @@ network.host: "{{ inventory_hostname }}"
network.host: "{{ lookup('dig', inventory_hostname, wantlist=True)[0] }}"
{% endif %}

{% if elasticsearch_version == '2.4.6'%}
index.search.slowlog.threshold.query.warn: 10s
index.search.slowlog.threshold.query.info: 5s
index.search.slowlog.threshold.query.debug: 2s
index.search.slowlog.threshold.query.trace: 500ms
index.max_result_window: 1050000
{% endif %}

{% if elasticsearch_fielddata_cache_size|default('') %}
indices.fielddata.cache.size: {{ elasticsearch_fielddata_cache_size }}
{% endif %}
Expand All @@ -102,13 +86,8 @@ cloud:

{% endif %}

# Only allow indices to be created by an explicit "create" command
{% if elasticsearch_version == '2.4.6'%}
action.auto_create_index: false
{% endif %}
{% if elasticsearch_version is version('5.0.0', '>=') %}
# Only auto create elastic search internal indices
action.auto_create_index: .watches,.triggered_watches,.watcher-history-*
{% endif %}


{% if es_local_repo and not backup_es_s3%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,12 @@ Environment=ES_PATH_CONF={{ elasticsearch_conf_dir}}
{% if elasticsearch_version == '5.6.16'%}
Environment=ES_JVM_OPTIONS={{ elasticsearch_conf_dir}}/jvm.options
{% endif %}
{% if elasticsearch_version == '2.4.6'%}
Environment=ES_HEAP_SIZE={{ elasticsearch_memory }}
{% endif %}
WorkingDirectory={{ elasticsearch_home }}

User=elasticsearch
Group=elasticsearch

{% if elasticsearch_version == '2.4.6'%}
ExecStart={{ elasticsearch_home }}/bin/elasticsearch --path.conf=${CONF_DIR} --path.home=${ES_HOME}
{% endif %}

{% if elasticsearch_version == '5.6.16'%}
ExecStart={{ elasticsearch_home }}/bin/elasticsearch -Epath.conf=${CONF_DIR}
{% endif %}

Restart=always
RestartSec=10
Expand Down

0 comments on commit a384aaf

Please sign in to comment.