From 3cc95ca251ca7e49ab226144d6131dcabcac18f1 Mon Sep 17 00:00:00 2001 From: ale Date: Sat, 2 Oct 2021 17:30:50 +0100 Subject: [PATCH 1/3] Use S6 instead of chaperone --- Dockerfile | 2 +- conf/services.d/curator/run | 12 ++++++++++++ conf/services.d/elasticsearch-exporter/run | 4 ++++ conf/services.d/elasticsearch/finish | 3 +++ conf/services.d/elasticsearch/run | 3 +++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 conf/services.d/curator/run create mode 100755 conf/services.d/elasticsearch-exporter/run create mode 100755 conf/services.d/elasticsearch/finish create mode 100755 conf/services.d/elasticsearch/run diff --git a/Dockerfile b/Dockerfile index c9b003e..413eba1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.git.autistici.org/ai3/docker/chaperone-base:master +FROM registry.git.autistici.org/ai3/docker/s6-base:master COPY elastic.gpg /etc/apt/trusted.gpg.d/ COPY conf /tmp/conf diff --git a/conf/services.d/curator/run b/conf/services.d/curator/run new file mode 100755 index 0000000..0146026 --- /dev/null +++ b/conf/services.d/curator/run @@ -0,0 +1,12 @@ +#!/bin/sh + +period=${CURATOR_CRON_PERIOD_SECS:-86400} +offset=$(printf '%d' 0x$(head -c 2 /dev/urandom | xxd -p)) +offset=$(( $offset % $period )) + +sleep $offset +while true; do + /usr/bin/curator-cron + sleep $period +done + diff --git a/conf/services.d/elasticsearch-exporter/run b/conf/services.d/elasticsearch-exporter/run new file mode 100755 index 0000000..a2ef400 --- /dev/null +++ b/conf/services.d/elasticsearch-exporter/run @@ -0,0 +1,4 @@ +#!/bin/sh + +exec /usr/sbin/elasticsearch_exporter --es.indices --es.uri http://127.0.0.1:${PORT:-8000} --web.listen-address :${EXPORTER_PORT:-8001} + diff --git a/conf/services.d/elasticsearch/finish b/conf/services.d/elasticsearch/finish new file mode 100755 index 0000000..b6531b3 --- /dev/null +++ b/conf/services.d/elasticsearch/finish @@ -0,0 +1,3 @@ +#!/usr/bin/execlineb -S0 + +s6-svscanctl -t /var/run/s6/services diff --git a/conf/services.d/elasticsearch/run b/conf/services.d/elasticsearch/run new file mode 100755 index 0000000..18d18b1 --- /dev/null +++ b/conf/services.d/elasticsearch/run @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /usr/share/elasticsearch/bin/elasticsearch -E http.port=${PORT:-8000} -- GitLab From 4379a47fe5e86ac6367083b5ceac126b0561f947 Mon Sep 17 00:00:00 2001 From: ale Date: Sat, 2 Oct 2021 17:31:05 +0100 Subject: [PATCH 2/3] Remove old chaperone config --- conf/chaperone.d/curator-cron.conf | 5 ----- conf/chaperone.d/elasticsearch-exporter.conf | 4 ---- conf/chaperone.d/elasticsearch.conf | 5 ----- 3 files changed, 14 deletions(-) delete mode 100644 conf/chaperone.d/curator-cron.conf delete mode 100644 conf/chaperone.d/elasticsearch-exporter.conf delete mode 100644 conf/chaperone.d/elasticsearch.conf diff --git a/conf/chaperone.d/curator-cron.conf b/conf/chaperone.d/curator-cron.conf deleted file mode 100644 index 41872a9..0000000 --- a/conf/chaperone.d/curator-cron.conf +++ /dev/null @@ -1,5 +0,0 @@ -curator-cron.service: { - type: cron, - interval: "19 2 * * *", - command: "/usr/bin/curator-cron", -} diff --git a/conf/chaperone.d/elasticsearch-exporter.conf b/conf/chaperone.d/elasticsearch-exporter.conf deleted file mode 100644 index d8ecae4..0000000 --- a/conf/chaperone.d/elasticsearch-exporter.conf +++ /dev/null @@ -1,4 +0,0 @@ -exporter.service: { - command: "/bin/sh -c 'exec /usr/sbin/elasticsearch_exporter --es.indices --es.uri http://127.0.0.1:${PORT} --web.listen-address :${EXPORTER_PORT}'", - restart: true, -} diff --git a/conf/chaperone.d/elasticsearch.conf b/conf/chaperone.d/elasticsearch.conf deleted file mode 100644 index e59ff07..0000000 --- a/conf/chaperone.d/elasticsearch.conf +++ /dev/null @@ -1,5 +0,0 @@ -elasticsearch.service: { - command: "/bin/sh -c 'exec /usr/share/elasticsearch/bin/elasticsearch -E http.port=${PORT}'", - kill_signal: SIGTERM, - exit_kills: true, -} -- GitLab From 89b4d5c4d3568dad31ceb68ff45bacd52a78fd3f Mon Sep 17 00:00:00 2001 From: ale Date: Sat, 2 Oct 2021 17:33:58 +0100 Subject: [PATCH 3/3] Require ca-certificates for build stage --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 55a7f28..17c2b10 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ # Packages that are only used to build the container. These will be # removed once we're done. -BUILD_PACKAGES="curl rsync apt-transport-https" +BUILD_PACKAGES="ca-certificates curl rsync apt-transport-https" # Packages to install. PACKAGES=" -- GitLab