From 1b2e95532b6dfeb46adbd2fbf5e0a1ef83854c86 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Thu, 8 Oct 2020 21:24:35 -0600 Subject: [PATCH 1/2] automatically run collector on container startup. fixes #73 --- rootfs/etc/services.d/collector-once/run | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rootfs/etc/services.d/collector-once/run diff --git a/rootfs/etc/services.d/collector-once/run b/rootfs/etc/services.d/collector-once/run new file mode 100644 index 0000000..46369a1 --- /dev/null +++ b/rootfs/etc/services.d/collector-once/run @@ -0,0 +1,14 @@ +#!/usr/bin/with-contenv bash + +echo "waiting for scrutiny service to start" +s6-svwait -u /var/run/s6/services/scrutiny + +#tell s6 to only run this script once +s6-svc -O /var/run/s6/services/collector-once + +# wait until scrutiny is "Ready" +while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/api/health)" != "200" ]]; do sleep 5; done + + +echo "starting scrutiny collector" +/scrutiny/bin/scrutiny-collector-metrics run From b09ec3b9124dd332db90340ad817b7c654d8c8e2 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Fri, 9 Oct 2020 03:27:12 -0600 Subject: [PATCH 2/2] install curl for checking if webserver is ready. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 19746c4..4da8630 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -34,7 +34,7 @@ ENV PATH="/scrutiny/bin:${PATH}" ADD https://github.com/dshearer/jobber/releases/download/v1.4.4/jobber_1.4.4-1_amd64.deb /tmp/ RUN apt install /tmp/jobber_1.4.4-1_amd64.deb -RUN apt-get update && apt-get install -y smartmontools=7.0-0ubuntu1~ubuntu18.04.1 ca-certificates && update-ca-certificates +RUN apt-get update && apt-get install -y smartmontools=7.0-0ubuntu1~ubuntu18.04.1 ca-certificates curl && update-ca-certificates ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/ RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /