Boavizta / cloud-scanner

📡 Get Boavizta impact data for your aws cloud account usage.
GNU Affero General Public License v3.0
32 stars 7 forks source link

Document how to persist prometheus data when the container is recreated #434

Closed demeringo closed 5 months ago

demeringo commented 5 months ago

Problem

When using the sample docker-compose file, cloud scanner metrics scrapped by prometheus are not persisted if the prometheus container is deleted and recreated.

Reason is that we store data directly inside prometheus container, so data lifecycle is the one of the container.

Solution

Use bind mount an external data volume to the prometheus container.

# Create persistent volume for your data
docker volume create prometheus-data
# Start Prometheus container
docker run \
    -p 9090:9090 \
    -v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml \
    -v prometheus-data:/prometheus \
    prom/prometheus

Update the docker-compose file to use this external data volume instead of the default. This is similar to what we do for grafana: declare the volume , and mount it to the container in the docker-compose file.

Describe this in the documentation.

Alternatives

Additional context or elements

velbur commented 1 month ago

Thank you! Very helpful!