From 4465a5ff80ca41e78fa10140e8727134c0307615 Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 18 Apr 2024 10:54:05 +0200 Subject: [PATCH 1/4] feat: graphana and docker now use own docker image --- .github/workflows/release.yml | 13 +++++++++++++ docker-compose.yml | 33 ++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e698e310..5336b788 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,6 +65,19 @@ jobs: DATABASE_PASSWORD JWT_SECRET SSL_PASSWORD + docker-push-prometheus: + runs-on: ubuntu-latest + needs: [ e2e-tests ] + steps: + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: arquisoft/wiq_en2b/prometheus + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: api/monitoring/prometheus docker-push-kiwiq: runs-on: ubuntu-latest needs: [ e2e-tests ] diff --git a/docker-compose.yml b/docker-compose.yml index 8fa734aa..e587ec0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,19 +57,6 @@ depends_on: - WIQ_DB - prometheus: - image: prom/prometheus - container_name: prometheus-${teamname:-defaultASW} - profiles: ["dev", "prod"] - networks: - mynetwork: - volumes: - - ./quiz-api/monitoring/prometheus:/etc/prometheus - - prometheus_data:/prometheus - - /certs:/etc/letsencrypt/kiwiq.run.place:ro - depends_on: - - api - kiwiq: image: ghcr.io/arquisoft/wiq_en2b/kiwiq:latest container_name: kiwiq @@ -99,16 +86,32 @@ - REACT_APP_API_ENDPOINT=${API_URI} networks: mynetwork: + + prometheus: + image: ghcr.io/arquisoft/wiq_en2b/prometheus:latest + container_name: prometheus-${teamname:-defaultASW} + profiles: ["dev", "prod"] + ports: + - "9090:9090" + networks: + mynetwork: + volumes: + - prometheus_data:/prometheus + - /certs:/etc/letsencrypt/kiwiq.run.place:ro + depends_on: + - api grafana: - image: grafana/grafana + image: ghcr.io/arquisoft/wiq_en2b/grafana:latest container_name: grafana-${teamname:-defaultASW} profiles: [ "dev" , "prod"] networks: mynetwork: volumes: - grafana_data:/var/lib/grafana - - ./quiz-api/monitoring/grafana/provisioning:/etc/grafana/provisioning + - /certs:/etc/letsencrypt/kiwiq.run.place:ro + ports: + - "9091:9091" environment: - GF_SERVER_HTTP_PORT=9091 - GF_AUTH_DISABLE_LOGIN_FORM=true From 921e1657ebe5ce5746fffcddf8cdf0a600f5c537 Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 18 Apr 2024 11:11:37 +0200 Subject: [PATCH 2/4] feat: dockerfiles for grafana and prometheus --- api/monitoring/grafana/Dockerfile | 14 ++++++++++++++ api/monitoring/prometheus/Dockerfile | 14 ++++++++++++++ .../prometheus/{ => configuration}/prometheus.yml | 0 3 files changed, 28 insertions(+) create mode 100644 api/monitoring/grafana/Dockerfile create mode 100644 api/monitoring/prometheus/Dockerfile rename api/monitoring/prometheus/{ => configuration}/prometheus.yml (100%) diff --git a/api/monitoring/grafana/Dockerfile b/api/monitoring/grafana/Dockerfile new file mode 100644 index 00000000..624fc546 --- /dev/null +++ b/api/monitoring/grafana/Dockerfile @@ -0,0 +1,14 @@ +FROM grafana/grafana +LABEL authors="dario" +# Define the source and destination directories +COPY_SOURCE = ./provisioning +COPY_DESTINATION = /etc/grafana/provisioning + +# Copy the configuration files +COPY ${COPY_SOURCE}/* ${COPY_DESTINATION} + +# Expose the default Grafana port +EXPOSE 9091 + +# Run Grafana in the foreground +CMD ["grafana-server"] \ No newline at end of file diff --git a/api/monitoring/prometheus/Dockerfile b/api/monitoring/prometheus/Dockerfile new file mode 100644 index 00000000..13f90329 --- /dev/null +++ b/api/monitoring/prometheus/Dockerfile @@ -0,0 +1,14 @@ +FROM prom/prometheus +LABEL authors="dario" +# Define the source and destination directories +COPY_SOURCE = ./configuration +COPY_DESTINATION = /etc/prometheus + +# Copy the configuration files +COPY ${COPY_SOURCE}/* ${COPY_DESTINATION} + +# Expose the default Prometheus port +EXPOSE 9090 + +# Run Prometheus in the foreground +CMD ["prometheus"] diff --git a/api/monitoring/prometheus/prometheus.yml b/api/monitoring/prometheus/configuration/prometheus.yml similarity index 100% rename from api/monitoring/prometheus/prometheus.yml rename to api/monitoring/prometheus/configuration/prometheus.yml From f4cd1e968ce002bec4087efe4ae536b715dd651d Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 18 Apr 2024 11:11:50 +0200 Subject: [PATCH 3/4] feat: grafana in release.yml --- .github/workflows/release.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5336b788..76fff00f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,6 +78,19 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io workdir: api/monitoring/prometheus + docker-push-grafana: + runs-on: ubuntu-latest + needs: [ e2e-tests ] + steps: + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: arquisoft/wiq_en2b/grafana + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: api/monitoring/grafana docker-push-kiwiq: runs-on: ubuntu-latest needs: [ e2e-tests ] From 2be4075a5715001204d1366933b6ba68f7eae43d Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 18 Apr 2024 11:15:56 +0200 Subject: [PATCH 4/4] fix: port changed to 8443 --- api/monitoring/prometheus/configuration/prometheus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/monitoring/prometheus/configuration/prometheus.yml b/api/monitoring/prometheus/configuration/prometheus.yml index 8b0455fd..8a5f0486 100644 --- a/api/monitoring/prometheus/configuration/prometheus.yml +++ b/api/monitoring/prometheus/configuration/prometheus.yml @@ -3,6 +3,6 @@ scrape_configs: metrics_path: '/actuator/prometheus' scrape_interval: 10s static_configs: - - targets: ['host.docker.internal:8080'] + - targets: ['host.docker.internal:8443'] labels: application: 'WIQ API' \ No newline at end of file