import files
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
FROM alpine:latest as dist
|
||||
LABEL maintainer 1001Pharmacies <technique+docker@1001pharmacies.com>
|
||||
ARG DOCKER_BUILD_DIR
|
||||
|
||||
ARG CURATOR_VERSION=5.8.3
|
||||
|
||||
RUN apk --no-cache add \
|
||||
bash \
|
||||
py-pip \
|
||||
&& pip install elasticsearch-curator==${CURATOR_VERSION}
|
||||
|
||||
COPY ${DOCKER_BUILD_DIR}/docker-entrypoint.sh /
|
||||
COPY ${DOCKER_BUILD_DIR}/config.yml /etc/curator/
|
||||
COPY ${DOCKER_BUILD_DIR}/action.yml /etc/curator/
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
FROM dist as local
|
||||
ARG DOCKER_BUILD_DIR
|
||||
|
||||
# install cronlock
|
||||
ADD https://raw.github.com/kvz/cronlock/master/cronlock /usr/bin/cronlock
|
||||
RUN chmod +rx /usr/bin/cronlock
|
||||
|
||||
# install ssmtp
|
||||
RUN apk --no-cache add ssmtp && \
|
||||
echo "FromLineOverride=YES" >> /etc/ssmtp/ssmtp.conf
|
||||
|
||||
FROM local as debug
|
||||
ARG DOCKER_BUILD_DIR
|
||||
|
||||
FROM local as tests
|
||||
ARG DOCKER_BUILD_DIR
|
||||
|
||||
FROM tests as preprod
|
||||
ARG DOCKER_BUILD_DIR
|
||||
|
||||
COPY build/curator/cronlock.conf /etc/cronlock.conf
|
||||
COPY build/curator/ssmtp.conf /etc/ssmtp/ssmtp.conf
|
||||
|
||||
FROM preprod as prod
|
||||
ARG DOCKER_BUILD_DIR
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
actions:
|
||||
1:
|
||||
action: delete_indices
|
||||
description: >-
|
||||
Delete indices older than ${UNIT_COUNT:1} ${UNIT:months} based on index name, for apm-*
|
||||
and logs-* 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: True
|
||||
disable_action: False
|
||||
filters:
|
||||
- filtertype: pattern
|
||||
kind: regex
|
||||
value: '^(apm|logs)-.*$'
|
||||
- filtertype: age
|
||||
source: name
|
||||
direction: older
|
||||
timestring: '%Y.%m.%d'
|
||||
unit: ${UNIT:months}
|
||||
unit_count: ${UNIT_COUNT:1}
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
client:
|
||||
hosts: ${HOSTS:elasticsearch}
|
||||
port: ${PORT:9200}
|
||||
url_prefix:
|
||||
use_ssl: ${USE_SSL:False}
|
||||
certificate:
|
||||
client_cert:
|
||||
client_key:
|
||||
ssl_no_validate: False
|
||||
http_auth:
|
||||
timeout: ${TIMEOUT:30}
|
||||
master_only: ${MASTER_ONLY:False}
|
||||
logging:
|
||||
loglevel: ${LOGLEVEL:INFO}
|
||||
logfile:
|
||||
logformat: ${LOGFORMAT:default}
|
||||
blacklist: ['elasticsearch', 'urllib3']
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
set -o errexit
|
||||
|
||||
trap 'kill -SIGQUIT $PID' INT
|
||||
|
||||
CRON_DAILY_COMMAND="/usr/bin/curator --config /etc/curator/config.yml /etc/curator/action.yml"
|
||||
[ "${DEPLOY:-}" = "true" ] && CRON_DAILY_COMMAND="cronlock ${CRON_DAILY_COMMAND}"
|
||||
|
||||
cat > /etc/periodic/daily/curator <<EOF
|
||||
#!/bin/sh
|
||||
${CRON_DAILY_COMMAND}
|
||||
EOF
|
||||
chmod +x /etc/periodic/daily/curator
|
||||
|
||||
[ $# -eq 0 ] && exec crond -f -L/dev/stdout || exec "$@" &
|
||||
PID=$! && wait
|
||||
Reference in New Issue
Block a user