aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Szumski <doug@stackhpc.com>2019-03-14 11:54:30 +0000
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-11-28 18:26:35 +0000
commit37de8920aa7394089731c0fae75034c2c3d137ca (patch)
tree622b9a4716744de2f013df53b1426e8805dec1c0
parent666531893cef0bf6fadae43c05d3906998cf8c6e (diff)
downloadkolla-37de8920aa7394089731c0fae75034c2c3d137ca.tar.gz
kolla-37de8920aa7394089731c0fae75034c2c3d137ca.zip
Add Elasticsearch Curator Docker image
Kolla provides log aggregation, but no solution to set retention periods for aggregated logs. It therefore accumulates log data indefinitely unless a user manually intervenes. This change adds Elasticsearch Curator which provides a mechanism for automating such retention periods [1]. [1] https://www.elastic.co/guide/en/elasticsearch/client/curator/current/about.html The container contains cron to support running Curator periodically. Change-Id: Ief2c554a64ef6cc971635d7e2a718f63c310fbf6
-rw-r--r--docker/elasticsearch/elasticsearch-curator/Dockerfile.j240
-rw-r--r--docker/elasticsearch/elasticsearch-curator/extend_start.sh8
-rw-r--r--docker/elasticsearch/elasticsearch/Dockerfile.j2 (renamed from docker/elasticsearch/Dockerfile.j2)0
-rw-r--r--docker/elasticsearch/elasticsearch/extend_start.sh (renamed from docker/elasticsearch/extend_start.sh)0
-rw-r--r--releasenotes/notes/add-elasticsearch-curator-88089d04f7ccd549.yaml4
5 files changed, 52 insertions, 0 deletions
diff --git a/docker/elasticsearch/elasticsearch-curator/Dockerfile.j2 b/docker/elasticsearch/elasticsearch-curator/Dockerfile.j2
new file mode 100644
index 000000000..7497163bc
--- /dev/null
+++ b/docker/elasticsearch/elasticsearch-curator/Dockerfile.j2
@@ -0,0 +1,40 @@
+FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
+LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
+
+{% block elasticsearch_curator_header %}{% endblock %}
+
+{% import "macros.j2" as macros with context %}
+
+{% if base_package_type == 'rpm' %}
+ {% set elasticsearch_curator_packages = [
+ 'cronie',
+ 'python3-pip',
+ ] %}
+{% elif base_package_type == 'deb' %}
+ {% set elasticsearch_curator_packages = [
+ 'cron',
+ 'python3-pip',
+ 'python3-setuptools'
+ ] %}
+{% endif %}
+
+{{ macros.install_packages(elasticsearch_curator_packages | customizable("packages")) }}
+
+{{ macros.configure_user(name='elasticsearch') }}
+
+{% set elasticsearch_curator_pip_packages = [
+ 'elasticsearch-curator'
+] %}
+
+RUN {{ macros.install_pip(elasticsearch_curator_pip_packages | customizable("pip_packages"), constraints=false, pip_version="pip3") }} \
+ && mkdir -p /etc/elasticsearch-curator \
+ && chown -R elasticsearch: /etc/elasticsearch-curator
+
+COPY extend_start.sh /usr/local/bin/kolla_extend_start
+RUN chmod 755 /usr/local/bin/kolla_extend_start
+
+{% block elasticsearch_curator_base_footer %}{% endblock %}
+{% block footer %}{% endblock %}
+
+# NOTE(dszumski): Cron runs as root but should be configured to launch Curator
+# by the elasticsearch user.
diff --git a/docker/elasticsearch/elasticsearch-curator/extend_start.sh b/docker/elasticsearch/elasticsearch-curator/extend_start.sh
new file mode 100644
index 000000000..8af0cdd15
--- /dev/null
+++ b/docker/elasticsearch/elasticsearch-curator/extend_start.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# NOTE(dszumski): Cron runs as root but should be configured to launch Curator
+# by the elasticsearch user. Therefore this directory needs to be owned by
+# the elasticsearch user.
+if [[ ! -d "/var/log/kolla/elasticsearch" ]]; then
+ install -d -m 0755 -o elasticsearch -g elasticsearch /var/log/kolla/elasticsearch
+fi
diff --git a/docker/elasticsearch/Dockerfile.j2 b/docker/elasticsearch/elasticsearch/Dockerfile.j2
index 7856444b9..7856444b9 100644
--- a/docker/elasticsearch/Dockerfile.j2
+++ b/docker/elasticsearch/elasticsearch/Dockerfile.j2
diff --git a/docker/elasticsearch/extend_start.sh b/docker/elasticsearch/elasticsearch/extend_start.sh
index b39f5b334..b39f5b334 100644
--- a/docker/elasticsearch/extend_start.sh
+++ b/docker/elasticsearch/elasticsearch/extend_start.sh
diff --git a/releasenotes/notes/add-elasticsearch-curator-88089d04f7ccd549.yaml b/releasenotes/notes/add-elasticsearch-curator-88089d04f7ccd549.yaml
new file mode 100644
index 000000000..79bd070ca
--- /dev/null
+++ b/releasenotes/notes/add-elasticsearch-curator-88089d04f7ccd549.yaml
@@ -0,0 +1,4 @@
+---
+features:
+ - |
+ Adds Elasticsearch Curator for managing aggregated log data.