From d11a399a5c7586f9cf016bb5e3bdd35352511a6c Mon Sep 17 00:00:00 2001 From: Gleb Tcivie Date: Wed, 26 Jun 2024 11:20:46 +0300 Subject: [PATCH] Rearanged the docker files and added empty README.md --- README.md | 0 docker-compose.yml | 13 ++++++++----- .../exporter/Dockerfile.exporter | 8 ++++---- docker/grafana/Dockerfile.grafana | 7 +++++++ docker/grafana/datasources.yml | 19 +++++++++++++++++++ .../prometheus/prometheus.yml | 0 6 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 README.md rename Dockerfile => docker/exporter/Dockerfile.exporter (55%) create mode 100644 docker/grafana/Dockerfile.grafana create mode 100644 docker/grafana/datasources.yml rename prometheus.yml => docker/prometheus/prometheus.yml (100%) diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml index ab8b052..49dc2c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3" - volumes: prometheus_data: grafana_data: @@ -17,10 +15,12 @@ services: - "9090:9090" volumes: - prometheus_data:/prometheus - - ./prometheus.yml:/etc/prometheus/prometheus.yml + - ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml grafana: - image: grafana/grafana-oss:10.4.2 + build: + context: . + dockerfile: ./docker/grafana/Dockerfile.grafana restart: unless-stopped ports: - "3000:3000" @@ -28,9 +28,12 @@ services: - mesh-bridge volumes: - grafana_data:/var/lib/grafana + - ./docker/grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml exporter: - build: . + build: + context: . + dockerfile: ./docker/exporter/Dockerfile.exporter restart: unless-stopped extra_hosts: - "host.docker.internal:host-gateway" diff --git a/Dockerfile b/docker/exporter/Dockerfile.exporter similarity index 55% rename from Dockerfile rename to docker/exporter/Dockerfile.exporter index 8fb30ee..9664ec9 100644 --- a/Dockerfile +++ b/docker/exporter/Dockerfile.exporter @@ -2,10 +2,10 @@ FROM python LABEL author="Gleb Tcivie" WORKDIR /app -COPY requirements.txt . -COPY .env . +COPY ../../requirements.txt . +COPY ../../.env . RUN pip3 install -r requirements.txt -COPY exporter/ exporter -COPY main.py . +COPY ../../exporter exporter +COPY ../../main.py . CMD ["python3", "-u", "main.py"] \ No newline at end of file diff --git a/docker/grafana/Dockerfile.grafana b/docker/grafana/Dockerfile.grafana new file mode 100644 index 0000000..ff2c3a9 --- /dev/null +++ b/docker/grafana/Dockerfile.grafana @@ -0,0 +1,7 @@ +FROM grafana/grafana-oss:10.4.2 + +# Install the Redis datasource plugin +RUN grafana-cli plugins install redis-datasource + +# Copy the datasource configuration +COPY docker/grafana/datasources.yml /etc/grafana/provisioning/datasources/datasources.yml \ No newline at end of file diff --git a/docker/grafana/datasources.yml b/docker/grafana/datasources.yml new file mode 100644 index 0000000..54ae4d0 --- /dev/null +++ b/docker/grafana/datasources.yml @@ -0,0 +1,19 @@ +apiVersion: 1 +datasources: + - name: prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + isDefault: true + editable: true + jsonData: + httpMethod: POST + + - name: redis-datasource + type: redis-datasource + access: proxy + url: redis://redis:6379/0 + isDefault: false + editable: true + jsonData: + client: standalone \ No newline at end of file diff --git a/prometheus.yml b/docker/prometheus/prometheus.yml similarity index 100% rename from prometheus.yml rename to docker/prometheus/prometheus.yml