Add elasticsearch support

Services separated on master, client and data.

Change-Id: I042ae6f2ead0d028817c82ea7669a7b590b8c6b6
Depends-On: Ic39eb474f42b25e55772cb95edd362e4be5623c3
This commit is contained in:
Peter Razumovsky 2017-03-14 10:34:26 +00:00
parent 39ba855c31
commit 5e5a32c3a9
7 changed files with 110 additions and 16 deletions

View File

@ -4,17 +4,23 @@ MAINTAINER {{ maintainer }}
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-amd64/
RUN apt-get -y install --no-install-recommends -t jessie-backports openjdk-8-jre \
&& curl https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/{{ elasticsearch_version }}/elasticsearch-{{ elasticsearch_version }}.deb -o /tmp/elasticsearch.deb \
&& dpkg -i /tmp/elasticsearch.deb \
&& rm -f /tmp/elasticsearch.deb \
&& apt-get clean
RUN curl {{ url.elasticsearch.gpg_key }} | sudo apt-key add - \
&& echo "deb {{ url.elasticsearch.deb }} stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-{{ elasticsearch_major_version}}.list
RUN dpkg-divert --rename /usr/lib/sysctl.d/elasticsearch.conf \
&& apt-get update \
&& apt-get install -y --no-install-recommends "elasticsearch={{ elasticsearch_version }}"
RUN usermod -a -G microservices elasticsearch \
&& chown -R elasticsearch: /usr/share/elasticsearch
&& chown -R elasticsearch:elasticsearch /usr/share/elasticsearch
# by default elasticsearch shell is /bin/false, we need
# /bin/bash to run elasticsearch as non-root
# https://discuss.elastic.co/t/running-as-non-root-user-service-wrapper-has-changed/7863
RUN usermod -s /bin/bash elasticsearch -d /usr/share/elasticsearch
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install io.fabric8:elasticsearch-cloud-kubernetes:5.2.2
USER elasticsearch

View File

@ -0,0 +1,27 @@
dsl_version: 0.8.0
service:
name: elasticsearch-client
headless: true
ports:
- {{ elasticsearch.port }}
- {{ elasticsearch.cluster_port }}
containers:
- name: elasticsearch-client
image: elasticsearch
env:
- name: NODE_DATA
value: "false"
- name: NODE_MASTER
value: "false"
daemon:
files:
- elasticsearch.yml
- log4j2
command: /usr/share/elasticsearch/bin/elasticsearch
files:
elasticsearch.yml:
path: /usr/share/elasticsearch/config/elasticsearch.yml
content: elasticsearch.yml.j2
log4j2:
path: /usr/share/elasticsearch/config/log4j2.properties
content: log4j2.properties.j2

View File

@ -0,0 +1,32 @@
dsl_version: 0.8.0
service:
name: elasticsearch-data
headless: true
ports:
- {{ elasticsearch.port }}
- {{ elasticsearch.cluster_port }}
containers:
- name: elasticsearch-data
image: elasticsearch
volumes:
- name: elasticsearch-data
path: /usr/share/elasticsearch/data
type: empty-dir
readOnly: false
env:
- name: NODE_DATA
value: "true"
- name: NODE_MASTER
value: "false"
daemon:
files:
- elasticsearch.yml
- log4j2
command: /usr/share/elasticsearch/bin/elasticsearch
files:
elasticsearch.yml:
path: /usr/share/elasticsearch/config/elasticsearch.yml
content: elasticsearch.yml.j2
log4j2:
path: /usr/share/elasticsearch/config/log4j2.properties
content: log4j2.properties.j2

View File

@ -7,10 +7,16 @@ service:
containers:
- name: elasticsearch
image: elasticsearch
env:
- name: NODE_DATA
value: "false"
- name: NODE_MASTER
value: "true"
daemon:
command: /usr/share/elasticsearch/bin/elasticsearch
files:
- elasticsearch.yml
- log4j2
command: /usr/share/elasticsearch/bin/elasticsearch
- name: cron
image: cron
daemon:
@ -34,3 +40,6 @@ files:
path: /etc/cron.d/curator
content: curator-cronjob
perm: "0644"
log4j2:
path: /usr/share/elasticsearch/config/log4j2.properties
content: log4j2.properties.j2

View File

@ -5,6 +5,14 @@ configs:
cluster_port:
cont: 9300
retention_period: 30
namespace: ccp
url:
elasticsearch:
deb: https://artifacts.elastic.co/packages/5.x/apt
gpg_key: https://artifacts.elastic.co/GPG-KEY-elasticsearch
versions:
elasticsearch_version: "2.4.0"
elasticsearch_version: "5.2.2"
elasticsearch_major_version: "5.x"
elasticsearch_curator_version: "4.1.0"

View File

@ -1,11 +1,14 @@
node.name: "{{ network_topology["private"]["address"] }}"
network.host: [ "127.0.0.1", "{{ network_topology["private"]["address"] }}" ]
cluster.name: "ELASTIC"
node.master: true
node.data: true
gateway.expected_nodes: 1
node.data: ${NODE_DATA}
node.master: ${NODE_MASTER}
path.conf: "/etc/elasticsearch"
path.data: "/var/lib/elasticsearch/data"
path.logs: "/var/log/elasticsearch"
path.scripts: "/etc/elasticsearch/scripts"
network.host: 0.0.0.0
cloud:
kubernetes:
service: {{ address('elasticsearch').split(".")[0] }}
namespace: {{ namespace }}
discovery:
type: kubernetes
plugin.mandatory: discovery-kubernetes

View File

@ -0,0 +1,9 @@
status = error
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
rootLogger.level = info
rootLogger.appenderRef.console.ref = console