Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #789 from rawmind0/master
Browse files Browse the repository at this point in the history
Updated es-cluster package to work on rancher v1.6.15 and higher
  • Loading branch information
rawmind0 authored May 18, 2018
2 parents ca610a2 + d957f0b commit 2f22a44
Show file tree
Hide file tree
Showing 12 changed files with 542 additions and 1 deletion.
1 change: 1 addition & 0 deletions templates/es-cluster/0/rancher-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: Elasticsearch Cluster
version: 5.4.0-rancher1
description: Scalable Elasticsearch Cluster
maximum_rancher_version: v1.6.14

questions:
- variable: "cluster_name"
Expand Down
1 change: 1 addition & 0 deletions templates/es-cluster/1/rancher-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: Elasticsearch Cluster
version: 5.4.2-rancher1
description: Scalable Elasticsearch Cluster
maximum_rancher_version: v1.6.14

questions:
- variable: "cluster_name"
Expand Down
1 change: 1 addition & 0 deletions templates/es-cluster/2/rancher-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ catalog:
name: Elasticsearch Cluster
version: 5.4.2-rancher2
description: Scalable Elasticsearch Cluster
maximum_rancher_version: v1.6.14

questions:
- variable: "cluster_name"
Expand Down
1 change: 1 addition & 0 deletions templates/es-cluster/3/rancher-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ catalog:
name: Elasticsearch Cluster
version: 5.5.1-rancher1
description: Scalable Elasticsearch Cluster
maximum_rancher_version: v1.6.14

questions:
- variable: "cluster_name"
Expand Down
1 change: 1 addition & 0 deletions templates/es-cluster/4/rancher-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ catalog:
name: Elasticsearch Cluster
version: 6.2.3-rancher1
description: Scalable Elasticsearch Cluster
maximum_rancher_version: v1.6.14

questions:
- variable: "cluster_name"
Expand Down
5 changes: 5 additions & 0 deletions templates/es-cluster/5/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Elasticsearch Cluster

A scalable Elasticsearch cluster

WARN: To avoid vm.max_map_count errors you could set "Update host sysctl" to true. Then param vm.max_map_count will be update to 262144 if it's less in your hosts.
152 changes: 152 additions & 0 deletions templates/es-cluster/5/docker-compose.yml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
version: '2'
services:
es-master:
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
io.rancher.sidekicks: es-master-storage{{- if eq .Values.UPDATE_SYSCTL "true" -}},es-sysctl{{- end}}
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1
environment:
- "cluster.name=${cluster_name}"
- "node.name=$${HOSTNAME}"
- "bootstrap.memory_lock=true"
- "xpack.security.enabled=false"
- "ES_JAVA_OPTS=-Xms${master_heap_size} -Xmx${master_heap_size}"
- "discovery.zen.ping.unicast.hosts=es-master"
- "discovery.zen.minimum_master_nodes=${minimum_master_nodes}"
- "node.master=true"
- "node.data=false"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
mem_limit: ${master_mem_limit}
mem_swappiness: 0
cap_add:
- IPC_LOCK
volumes_from:
- es-master-storage

es-master-storage:
labels:
io.rancher.container.start_once: true
network_mode: none
image: rawmind/alpine-volume:0.0.2-1
environment:
- SERVICE_UID=1000
- SERVICE_GID=1000
- SERVICE_VOLUME=/usr/share/elasticsearch/data
volumes:
- es-master-volume:/usr/share/elasticsearch/data

es-data:
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
io.rancher.sidekicks: es-data-storage{{- if eq .Values.UPDATE_SYSCTL "true" -}},es-sysctl{{- end}}
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1
environment:
- "cluster.name=${cluster_name}"
- "node.name=$${HOSTNAME}"
- "bootstrap.memory_lock=true"
- "xpack.security.enabled=false"
- "discovery.zen.ping.unicast.hosts=es-master"
- "ES_JAVA_OPTS=-Xms${data_heap_size} -Xmx${data_heap_size}"
- "node.master=false"
- "node.data=true"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
mem_limit: ${data_mem_limit}
mem_swappiness: 0
cap_add:
- IPC_LOCK
volumes_from:
- es-data-storage
depends_on:
- es-master

es-data-storage:
labels:
io.rancher.container.start_once: true
network_mode: none
image: rawmind/alpine-volume:0.0.2-1
environment:
- SERVICE_UID=1000
- SERVICE_GID=1000
- SERVICE_VOLUME=/usr/share/elasticsearch/data
volumes:
- es-data-volume:/usr/share/elasticsearch/data

es-client:
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
io.rancher.sidekicks: es-client-storage{{- if eq .Values.UPDATE_SYSCTL "true" -}},es-sysctl{{- end}}
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1
environment:
- "cluster.name=${cluster_name}"
- "node.name=$${HOSTNAME}"
- "bootstrap.memory_lock=true"
- "xpack.security.enabled=false"
- "discovery.zen.ping.unicast.hosts=es-master"
- "ES_JAVA_OPTS=-Xms${client_heap_size} -Xmx${client_heap_size}"
- "node.master=false"
- "node.data=false"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
mem_limit: ${client_mem_limit}
mem_swappiness: 0
cap_add:
- IPC_LOCK
volumes_from:
- es-client-storage
depends_on:
- es-master

es-client-storage:
labels:
io.rancher.container.start_once: true
network_mode: none
image: rawmind/alpine-volume:0.0.2-1
environment:
- SERVICE_UID=1000
- SERVICE_GID=1000
- SERVICE_VOLUME=/usr/share/elasticsearch/data
volumes:
- es-client-volume:/usr/share/elasticsearch/data

{{- if eq .Values.UPDATE_SYSCTL "true" }}
es-sysctl:
labels:
io.rancher.container.start_once: true
network_mode: none
image: rawmind/alpine-sysctl:0.1
privileged: true
environment:
- "SYSCTL_KEY=vm.max_map_count"
- "SYSCTL_VALUE=262144"
{{- end}}

volumes:
es-master-volume:
driver: ${VOLUME_DRIVER}
per_container: true
es-data-volume:
driver: ${VOLUME_DRIVER}
per_container: true
es-client-volume:
driver: ${VOLUME_DRIVER}
per_container: true
111 changes: 111 additions & 0 deletions templates/es-cluster/5/rancher-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
version: '2'
catalog:
name: Elasticsearch Cluster
version: 5.5.1-rancher2
description: Scalable Elasticsearch Cluster

questions:
- variable: "cluster_name"
type: "string"
required: true
label: "Cluster name"
description: "Name of the Elasticsearch Cluster"
default: "es-cluster"

- variable: "UPDATE_SYSCTL"
label: "Update host sysctl:"
description: |
Set true to avoid vm.max_map_count errors.
WARN: If set true, host param vm.max_map_count will be update to 262144.
default: false
required: true
type: enum
options:
- false
- true

- variable: "master_heap_size"
type: "string"
required: true
label: "Heap size (master nodes)"
description: "Heap size to be allocated for Java (master nodes)"
default: "512m"

- variable: "master_mem_limit"
type: "int"
required: true
label: "Memory limit in byte (master nodes)"
description: "Memory limit in Byte per elasticsearch container. AT LEAST double the heap size! (master nodes)"
default: 1073741824

- variable: "data_heap_size"
type: "string"
required: true
label: "Heap size (data nodes)"
description: "Heap size to be allocated for Java (data nodes)"
default: "512m"

- variable: "data_mem_limit"
type: "int"
required: true
label: "Memory limit in byte (data nodes)"
description: "Memory limit in Byte per elasticsearch container. AT LEAST double the heap size! (data nodes)"
default: 1073741824

- variable: "client_heap_size"
type: "string"
required: true
label: "Heap size (client nodes)"
description: "Heap size to be allocated for Java (client nodes)"
default: "512m"

- variable: "client_mem_limit"
type: "int"
required: true
label: "Memory limit in byte (client nodes)"
description: "Memory limit in Byte per elasticsearch container. AT LEAST double the heap size! (client nodes)"
default: 1073741824

- variable: "minimum_master_nodes"
type: "int"
required: true
label: "# of minimum Master Nodes"
description: "Set the number of required master nodes to reach quorum. Sets initial scale to this value as well"
default: 3

- variable: "initial_data_nodes"
type: "int"
required: true
label: "# of initial data nodes"
description: "Set the initial number of data nodes"
default: 2

- variable: "initial_client_nodes"
type: "int"
required: true
label: "# of initial client nodes"
description: "Set the initial number of client nodes"
default: 1

- variable: "VOLUME_DRIVER"
description: "The VOLUME driver to associate with this server"
label: "VOLUME Driver"
required: true
default: "local"
type: enum
options:
- local
- rancher-nfs
- rancher-efs
- rancher-ebs

services:

es-master:
scale: ${minimum_master_nodes}

es-data:
scale: ${initial_data_nodes}

es-client:
scale: ${initial_client_nodes}
5 changes: 5 additions & 0 deletions templates/es-cluster/6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Elasticsearch Cluster

A scalable Elasticsearch cluster

WARN: To avoid vm.max_map_count errors you could set "Update host sysctl" to true. Then param vm.max_map_count will be update to 262144 if it's less in your hosts.
Loading

0 comments on commit 2f22a44

Please sign in to comment.