Move elasticsearch service to actual repo

Change-Id: I977d6a40a5b700278ff4b69861341cf3b434e7da
This commit is contained in:
Peter Razumovsky 2017-03-10 13:21:51 +00:00
parent 330d9ebbad
commit 39ba855c31
8 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,8 @@
FROM {{ image_spec("base-tools") }}
MAINTAINER {{ maintainer }}
RUN apt-get -y install --no-install-recommends \
cron \
logrotate \
&& apt-get clean \
&& pip install --no-cache-dir elasticsearch-curator=={{ elasticsearch_curator_version }}

View File

@ -0,0 +1,20 @@
FROM {{ image_spec("base-tools") }}
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 usermod -a -G microservices elasticsearch \
&& chown -R 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
USER elasticsearch

View File

@ -0,0 +1,36 @@
dsl_version: 0.7.0
service:
name: elasticsearch
ports:
- {{ elasticsearch.port }}
- {{ elasticsearch.cluster_port }}
containers:
- name: elasticsearch
image: elasticsearch
daemon:
command: /usr/share/elasticsearch/bin/elasticsearch
files:
- elasticsearch.yml
- name: cron
image: cron
daemon:
command: cron -f
files:
- es-curator-config
- es-curator-action-delete-indice
- es-curator-cronjob
files:
elasticsearch.yml:
path: /usr/share/elasticsearch/config/elasticsearch.yml
content: elasticsearch.yml.j2
es-curator-config:
path: /etc/curator/curator.yaml
content: curator.yaml.j2
es-curator-action-delete-indice:
path: /etc/curator/action-delete-indice.yaml
content: curator-action-delete-indice.yaml.j2
es-curator-cronjob:
path: /etc/cron.d/curator
content: curator-cronjob
perm: "0644"

View File

@ -0,0 +1,29 @@
---
# Remember, leave a key empty if there is no value. None will be a string,
# not a Python "NoneType"
actions:
1:
action: delete_indices
description: >-
Delete indices older than {{ elasticsearch.retention_period }} days
(based on index name), for 'log-' prefixed indices. Ignore the error
if the filter does not result in an actionable list of indices
(ignore_empty_list) and exit cleanly.
options:
ignore_empty_list: True
timeout_override:
continue_if_exception: False
disable_action: False
filters:
- filtertype: pattern
kind: prefix
value: log-
exclude:
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: {{ elasticsearch.retention_period }}
exclude:

View File

@ -0,0 +1 @@
@daily root curator --config /etc/curator/curator.yaml /etc/curator/action-delete-indice.yaml

View File

@ -0,0 +1,13 @@
---
# Remember, leave a key empty if there is no value. None will be a string,
# not a Python "NoneType"
client:
hosts:
- localhost
port: {{ elasticsearch.port.cont }}
url_prefix:
use_ssl: False
certificate:
ssl_no_validate: False
timeout: 30
master_only: True

View File

@ -0,0 +1,10 @@
configs:
elasticsearch:
port:
cont: 9200
cluster_port:
cont: 9300
retention_period: 30
versions:
elasticsearch_version: "2.4.0"
elasticsearch_curator_version: "4.1.0"

View File

@ -0,0 +1,11 @@
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
path.conf: "/etc/elasticsearch"
path.data: "/var/lib/elasticsearch/data"
path.logs: "/var/log/elasticsearch"
path.scripts: "/etc/elasticsearch/scripts"