mirror of
https://github.com/runyanjake/olomana.git
synced 2026-11-10 13:54:52 -08:00
Add auth-protected prometheus ui
This commit is contained in:
parent
123f310b76
commit
893696ce8d
@ -2,7 +2,7 @@ networks:
|
|||||||
minecraft:
|
minecraft:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
name: minecraft
|
name: minecraft
|
||||||
grafana:
|
metrics:
|
||||||
external: true
|
external: true
|
||||||
traefik:
|
traefik:
|
||||||
external: true
|
external: true
|
||||||
@ -47,7 +47,7 @@ services:
|
|||||||
container_name: minecraft_creative
|
container_name: minecraft_creative
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- grafana
|
- metrics
|
||||||
- minecraft
|
- minecraft
|
||||||
ports:
|
ports:
|
||||||
- "25566:25565"
|
- "25566:25565"
|
||||||
@ -80,7 +80,7 @@ services:
|
|||||||
container_name: minecraft_2023
|
container_name: minecraft_2023
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
- grafana
|
- metrics
|
||||||
- minecraft
|
- minecraft
|
||||||
ports:
|
ports:
|
||||||
- "25565:25565"
|
- "25565:25565"
|
||||||
|
|||||||
9
software-development/infrastructure/grafana/.env.example
Normal file
9
software-development/infrastructure/grafana/.env.example
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Copy to .env and fill in. Docker Compose reads .env automatically.
|
||||||
|
|
||||||
|
# Public hostname Traefik routes to the Prometheus UI
|
||||||
|
PROMETHEUS_HOST=prometheus.whitney.rip
|
||||||
|
|
||||||
|
# Basic auth for the Prometheus UI, in htpasswd format (user:bcrypt-hash).
|
||||||
|
# Generate with: htpasswd -nbB admin 'your-password'
|
||||||
|
# Keep the single quotes so Compose doesn't treat the $ in the hash as variables.
|
||||||
|
PROMETHEUS_BASIC_AUTH='admin:$2y$05$replace_with_generated_hash'
|
||||||
1
software-development/infrastructure/grafana/.gitignore
vendored
Normal file
1
software-development/infrastructure/grafana/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
@ -6,6 +6,9 @@
|
|||||||
Create/Fill in the following files in a `grafana` directory under this one using the templates.
|
Create/Fill in the following files in a `grafana` directory under this one using the templates.
|
||||||
- `grafana.ini`
|
- `grafana.ini`
|
||||||
- `prometheus.yml`
|
- `prometheus.yml`
|
||||||
|
- `.env` (copy from `.env.example`; holds the Prometheus hostname and basic auth hash for Traefik)
|
||||||
|
|
||||||
|
Generate the basic auth value with `htpasswd -nbB admin 'your-password'` and paste it into `.env`, keeping the single quotes.
|
||||||
|
|
||||||
### Volumes
|
### Volumes
|
||||||
Make sure that in additionto mounting the 2 files above to their respective containers, grafana container has the following mount:
|
Make sure that in additionto mounting the 2 files above to their respective containers, grafana container has the following mount:
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
networks:
|
networks:
|
||||||
grafana:
|
metrics:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
name: grafana
|
name: metrics
|
||||||
traefik:
|
traefik:
|
||||||
external: true
|
external: true
|
||||||
minecraft:
|
minecraft:
|
||||||
@ -17,7 +17,7 @@ services:
|
|||||||
container_name: grafana
|
container_name: grafana
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- grafana
|
- metrics
|
||||||
- traefik
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- ./grafana.ini:/etc/grafana/grafana.ini
|
- ./grafana.ini:/etc/grafana/grafana.ini
|
||||||
@ -37,7 +37,7 @@ services:
|
|||||||
user: "1003:1005"
|
user: "1003:1005"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- grafana
|
- metrics
|
||||||
pid: host
|
pid: host
|
||||||
command:
|
command:
|
||||||
- "--path.rootfs=/host"
|
- "--path.rootfs=/host"
|
||||||
@ -53,8 +53,8 @@ services:
|
|||||||
container_name: prometheus
|
container_name: prometheus
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- grafana
|
- metrics
|
||||||
- minecraft
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- "./prometheus.yml:/etc/prometheus.yml"
|
- "./prometheus.yml:/etc/prometheus.yml"
|
||||||
- prometheus_data:/prometheus
|
- prometheus_data:/prometheus
|
||||||
@ -64,5 +64,12 @@ services:
|
|||||||
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
|
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
|
||||||
- "--web.console.templates=/usr/share/prometheus/consoles"
|
- "--web.console.templates=/usr/share/prometheus/consoles"
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=false
|
- traefik.enable=true
|
||||||
|
- traefik.docker.network=traefik
|
||||||
|
- traefik.http.routers.prometheus.rule=Host(`${PROMETHEUS_HOST}`)
|
||||||
|
- traefik.http.routers.prometheus.tls=true
|
||||||
|
- traefik.http.routers.prometheus.tls.certresolver=lets-encrypt
|
||||||
|
- traefik.http.routers.prometheus.middlewares=prometheus-auth
|
||||||
|
- traefik.http.middlewares.prometheus-auth.basicauth.users=${PROMETHEUS_BASIC_AUTH}
|
||||||
|
- traefik.http.services.prometheus.loadbalancer.server.port=9090
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user