From 41d59d998a096667437ca76321cf024228f2d346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrba?= Date: Sat, 5 Oct 2024 09:07:25 +0200 Subject: [PATCH] Setup custom prometheus docker image that should be deployed to railway --- .dockerignore | 4 ++ .../build-prometheus-docker-image.yml | 37 +++++++++++++++++++ docker-compose.yml | 2 +- prometheus/Dockerfile | 3 ++ .../prometheus-local.yml | 0 prometheus/prometheus-railway.yml | 16 ++++++++ 6 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/build-prometheus-docker-image.yml create mode 100644 prometheus/Dockerfile rename docker/prometheus.yml => prometheus/prometheus-local.yml (100%) create mode 100644 prometheus/prometheus-railway.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5de3c8e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.idea +.vscode +.fleet +dubs-bot.iml diff --git a/.github/workflows/build-prometheus-docker-image.yml b/.github/workflows/build-prometheus-docker-image.yml new file mode 100644 index 0000000..5373a5c --- /dev/null +++ b/.github/workflows/build-prometheus-docker-image.yml @@ -0,0 +1,37 @@ +name: Build Prometheus Docker image + +on: + push: + paths: + - prometheus/** + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + with: + install: true + + - name: Login to container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + push: true + context: ./prometheus + tags: ghcr.io/jirkavrba/dubs-bot/prometheus:latest diff --git a/docker-compose.yml b/docker-compose.yml index c38a09f..7caa5b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,4 +17,4 @@ services: ports: - "9090:9090" volumes: - - "./docker/prometheus.yml:/etc/prometheus/prometheus.yml" + - "./prometheus/prometheus-local.yml:/etc/prometheus/prometheus.yml" diff --git a/prometheus/Dockerfile b/prometheus/Dockerfile new file mode 100644 index 0000000..8515071 --- /dev/null +++ b/prometheus/Dockerfile @@ -0,0 +1,3 @@ +FROM prom/prometheus:latest + +COPY ./prometheus-railway.yml /etc/prometheus/prometheus.yml diff --git a/docker/prometheus.yml b/prometheus/prometheus-local.yml similarity index 100% rename from docker/prometheus.yml rename to prometheus/prometheus-local.yml diff --git a/prometheus/prometheus-railway.yml b/prometheus/prometheus-railway.yml new file mode 100644 index 0000000..5f9ee7f --- /dev/null +++ b/prometheus/prometheus-railway.yml @@ -0,0 +1,16 @@ +scrape_configs: + - job_name: prometheus + honor_labels: true + static_configs: + - targets: + - "api.railway.internal" + scrape_interval: 30s + scrape_timeout: 5s + body_size_limit: 10MB + sample_limit: 1000 + target_limit: 35 + label_limit: 35 + label_name_length_limit: 210 + label_value_length_limit: 210 + metrics_path: /prometheus + scheme: http