Refactor dockerfile update compose example

This commit is contained in:
Mike Conrad
2025-05-21 16:35:00 -04:00
parent 3c44fcc062
commit f5aceea6fa
4 changed files with 16 additions and 11 deletions

73
compose.yml Normal file
View File

@ -0,0 +1,73 @@
---
name: sentry
services:
reverse-proxy:
image: traefik:latest
command: --api.insecure=true --providers.docker
ports:
- 80:80
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik
scraper:
labels:
- "traefik.enable=true"
- "traefik.docker.network=sentry_traefik"
- "traefik.http.routers.scraper.rule=Host(`sentry.docker.localhost`)"
- "traefik.http.services.scraper.loadbalancer.server.port=3333"
- "traefik.http.routers.scraper.entrypoints=http"
- "traefik.http.routers.scraper.service=scraper"
networks:
- traefik
- redis
- database
depends_on:
db:
condition: service_healthy
db:
image: postgres:16
environment:
- POSTGRES_PASSWORD=password
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "postgres"]
interval: 5s
timeout: 60s
retries: 5
start_period: 5s
networks:
- database
volumes:
- pg_data:/var/lib/postgresql/data
grafana:
image: grafana/grafana:latest
labels:
- "traefik.enable=true"
- "traefik.docker.network=sentry_traefik"
- "traefik.http.routers.grafana.rule=Host(`grafana.docker.localhost`)"
- "traefik.http.routers.grafana.entrypoints=http"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
- "traefik.http.routers.grafana.service=grafana"
networks:
- traefik
- database
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
interval: 10s
timeout: 30s
retries: 5
start_period: 30s
redis:
image: redis:latest
networks:
- redis
networks:
traefik:
driver: bridge
database:
driver: bridge
redis:
driver: bridge
volumes:
pg_data: {}