Compare commits

...

3 Commits

6 changed files with 44 additions and 24 deletions

View File

@ -1,8 +1,5 @@
networks:
minecraft:
driver: bridge
name: minecraft
grafana:
metrics:
external: true
traefik:
external: true
@ -14,7 +11,7 @@ services:
restart: unless-stopped
networks:
- traefik
- minecraft
- metrics
ports:
- "25567:25565"
volumes:
@ -47,8 +44,7 @@ services:
container_name: minecraft_creative
restart: unless-stopped
networks:
- grafana
- minecraft
- metrics
ports:
- "25566:25565"
- "9226:9225"
@ -80,8 +76,7 @@ services:
container_name: minecraft_2023
networks:
- traefik
- grafana
- minecraft
- metrics
ports:
- "25565:25565"
- "9225:9225"
@ -114,7 +109,7 @@ services:
image: itzg/minecraft-server:latest
container_name: minecraft_skyblock
networks:
- minecraft
- metrics
ports:
- "25564:25565"
volumes:
@ -139,7 +134,7 @@ services:
image: joshi425/minecraft_exporter:latest
container_name: minecraft_2023_metrics
networks:
- minecraft
- metrics
ports:
- 2565:2565
volumes:

View 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'

View File

@ -1,3 +1 @@
olomana.ini
docker-compose.yml
.env

View File

@ -6,6 +6,9 @@
Create/Fill in the following files in a `grafana` directory under this one using the templates.
- `grafana.ini`
- `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
Make sure that in additionto mounting the 2 files above to their respective containers, grafana container has the following mount:

View File

@ -1,7 +1,7 @@
networks:
grafana-network:
metrics:
driver: bridge
name: grafana
name: metrics
traefik:
external: true
minecraft:
@ -13,17 +13,17 @@ volumes:
services:
grafana:
image: grafana/grafana
user: "USER:GROUP"
user: "1003:1005"
container_name: grafana
restart: unless-stopped
networks:
- grafana-network
- metrics
- traefik
volumes:
- ./grafana.ini:/etc/grafana/grafana.ini
- /pwspool/software/grafana:/var/lib/grafana
labels:
- traefik.http.routers.grafana.rule=Host(`SITE_URL`)
- traefik.http.routers.grafana.rule=Host(`grafana.whitney.rip`)
- traefik.http.routers.grafana.tls=true
- traefik.http.routers.grafana.tls.certresolver=lets-encrypt
- traefik.http.services.grafana.loadbalancer.server.port=3000
@ -34,10 +34,10 @@ services:
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
user: "USER:GROUP"
user: "1003:1005"
restart: unless-stopped
networks:
- grafana-network
- metrics
pid: host
command:
- "--path.rootfs=/host"
@ -45,14 +45,16 @@ services:
- "/:/host:ro,rslave"
depends_on:
- prometheus
labels:
- traefik.enable=false
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
networks:
- grafana-network
- minecraft
- metrics
- traefik
volumes:
- "./prometheus.yml:/etc/prometheus.yml"
- prometheus_data:/prometheus
@ -61,4 +63,13 @@ services:
- "--storage.tsdb.path=/prometheus"
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
- "--web.console.templates=/usr/share/prometheus/consoles"
labels:
- 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

View File

@ -15,4 +15,8 @@ scrape_configs:
scrape_interval: 5s
static_configs:
- targets: ['minecraft_2023_metrics:2565']
- job_name: 'pws_news'
scrape_interval: 30s
metrics_path: /metrics
static_configs:
- targets: ['pws-news-backend:8000']