From e3857a45f9526faa47b222c4973ca54c169be35e Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 9 Dec 2023 20:34:50 +0100 Subject: [PATCH] Develop: Add Prometheus test server configuration #213 #3730 #3943 Signed-off-by: Michael Mayer --- docker-compose.yml | 24 ++++++++++++++++++++---- prometheus.yml | 16 ++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 prometheus.yml diff --git a/docker-compose.yml b/docker-compose.yml index c9767dcf5..19140c165 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -148,7 +148,7 @@ services: MARIADB_PASSWORD: "photoprism" MARIADB_ROOT_PASSWORD: "photoprism" - ## HTTPS Reverse Proxy (recommended) ## + ## HTTPS Reverse Test Proxy ## includes "*.localssl.dev" SSL certificate for test environments ## Docs: https://doc.traefik.io/traefik/ traefik: @@ -161,13 +161,13 @@ services: volumes: - "/var/run/docker.sock:/var/run/docker.sock" # enables Traefik to watch services - ## Keycloak OpenID Connect Provider + ## Keycloak Test Identity Provider ## Login: user / photoprism ## Admin: admin / photoprism keycloak: - image: quay.io/keycloak/keycloak:22.0 - command: "start-dev" # development mode, do not use this in production! + image: quay.io/keycloak/keycloak:23.0 container_name: keycloak + command: "start-dev" # development mode, do not use this in production! links: - "traefik:localssl.dev" - "traefik:app.localssl.dev" @@ -191,6 +191,22 @@ services: KC_DB_USERNAME: "keycloak" KC_DB_PASSWORD: "keycloak" + ## Prometheus Test Server + ## Docs: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#oauth2 + prometheus: + image: prom/prometheus:latest + container_name: prometheus + labels: + - "traefik.enable=true" + - "traefik.http.services.prometheus.loadbalancer.server.port=9090" + - "traefik.http.routers.prometheus.entrypoints=websecure" + - "traefik.http.routers.prometheus.rule=Host(`prometheus.localssl.dev`)" + - "traefik.http.routers.prometheus.tls.domains[0].main=localssl.dev" + - "traefik.http.routers.prometheus.tls.domains[0].sans=*.localssl.dev" + - "traefik.http.routers.prometheus.tls=true" + volumes: + - "./prometheus.yml:/etc/prometheus/prometheus.yml" + ## Dummy LDAP Directory Server ## Docs: https://glauth.github.io/docs/ dummy-ldap: diff --git a/prometheus.yml b/prometheus.yml new file mode 100644 index 000000000..e2d5e4b35 --- /dev/null +++ b/prometheus.yml @@ -0,0 +1,16 @@ +global: + scrape_interval: 15s + scrape_timeout: 10s +scrape_configs: + - job_name: "photoprism" + metrics_path: "/api/v1/metrics" + oauth2: + client_id: "cs5cpu17n6gj2qo5" + client_secret: "xcCbOrw6I0vcoXzhnOmXhjpVSyFq0l0e" + token_url: "http://photoprism:2342/api/v1/oauth/token" + scopes: + - 'metrics' + endpoint_params: + grant_type: "client_credentials" + static_configs: + - targets: ["photoprism:2342"] \ No newline at end of file