diff --git a/Dockerfile b/Dockerfile index 82e340b..da9e871 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,6 @@ ARG VERSION=2.30.3 # install Prometheus RUN curl -L https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.linux-amd64.tar.gz | tar zxvf - --strip-components 1 -COPY start.sh /app/pkg/ +COPY docker / CMD [ "/app/pkg/start.sh" ] diff --git a/docker/app/code/default_prometheus_variables.sh b/docker/app/code/default_prometheus_variables.sh new file mode 100755 index 0000000..b479aee --- /dev/null +++ b/docker/app/code/default_prometheus_variables.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects +export retention_time="15d" diff --git a/start.sh b/docker/app/pkg/start.sh similarity index 50% rename from start.sh rename to docker/app/pkg/start.sh index f269987..7a68d4b 100755 --- a/start.sh +++ b/docker/app/pkg/start.sh @@ -11,5 +11,14 @@ fi chown -R cloudron:cloudron /app/data +if [ ! -f /app/data/prometheus_variables.sh ]; then + echo "=> Copy default prometheus variable file since it does not exist" + cp /app/code/default_prometheus_variables.sh /app/data/prometheus_variables.sh +fi + +echo "=> Source custom variables" +source /app/data/prometheus_variables.sh + echo "=> Starting Prometheus" -exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml --storage.tsdb.path=/app/data/runtime +echo "=> Starting with retention time of $retention_time" +exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml --storage.tsdb.path=/app/data/runtime --storage.tsdb.retention.time="${retention_time:-15d}" diff --git a/test/package-lock.json b/test/package-lock.json index 0252d01..104d531 100644 --- a/test/package-lock.json +++ b/test/package-lock.json @@ -33,9 +33,9 @@ "integrity": "sha512-8UT/J+xqCYfn3fKtOznAibsHpiuDshCb0fwgWxRazTT19Igp9ovoXMPhXyLD6m3CKQGTMHgqoxaFfMWaL40Rnw==" }, "@types/node": { - "version": "16.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.1.tgz", - "integrity": "sha512-4/Z9DMPKFexZj/Gn3LylFgamNKHm4K3QDi0gz9B26Uk0c8izYf97B5fxfpspMNkWlFupblKM/nV8+NA9Ffvr+w==", + "version": "16.10.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", + "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==", "optional": true }, "@types/yauzl": { @@ -617,9 +617,9 @@ "dev": true }, "is-glob": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.2.tgz", - "integrity": "sha512-ZZTOjRcDjuAAAv2cTBQP/lL59ZTArx77+7UzHdWW/XB1mrfp7DEaVpKmZ0XIzx+M7AxfhKcqV+nMetUQmFifwg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "requires": { "is-extglob": "^2.1.1" }