From 66e86f65098a467d15ba4e93b5a9a6af4b18d057 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Thu, 16 Dec 2021 10:42:54 +0100
Subject: [PATCH] L2SS-536: Extend prometheus retention, and keep the
 monitoring data between container restarts

---
 docker-compose/prometheus.yml        | 5 +++++
 docker-compose/prometheus/Dockerfile | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/docker-compose/prometheus.yml b/docker-compose/prometheus.yml
index 1e9ce6f1a..e7924c1a7 100644
--- a/docker-compose/prometheus.yml
+++ b/docker-compose/prometheus.yml
@@ -7,6 +7,9 @@
 
 version: '2'
 
+volumes:
+  prometheus-data: {}
+
 services:
   prometheus:
     image: prometheus
@@ -15,6 +18,8 @@ services:
     container_name: ${CONTAINER_NAME_PREFIX}prometheus
     networks:
       - control
+    volumes:
+      - prometheus-data:/prometheus
     ports:
       - "9090:9090"
     logging:
diff --git a/docker-compose/prometheus/Dockerfile b/docker-compose/prometheus/Dockerfile
index cc1494f98..ad8e5165b 100644
--- a/docker-compose/prometheus/Dockerfile
+++ b/docker-compose/prometheus/Dockerfile
@@ -1,3 +1,5 @@
 FROM prom/prometheus
 
 COPY prometheus.yml /etc/prometheus/prometheus.yml
+
+CMD ["--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus", "--web.console.libraries=/usr/share/prometheus/console_libraries", "--web.console.templates=/usr/share/prometheus/consoles", "--storage.tsdb.retention.time=31d"]
-- 
GitLab