Created
May 10, 2022 14:17
-
-
Save RawSanj/0677d1ca6c36f06aff3320483bdd57a0 to your computer and use it in GitHub Desktop.
Traefik Reverse Proxy and Monitoring Stack for Docker containers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
# Traefik Reverse Proxy for routing various applications | |
reverse-proxy: | |
image: traefik:v2.6.6 # The official Traefik docker image | |
restart: unless-stopped | |
labels: | |
- traefik.http.routers.proxy.rule=Host(`proxy.docker.localhost`) | |
- traefik.http.routers.proxy.tls=false | |
- traefik.http.services.proxy.loadbalancer.server.port=8080 | |
- traefik.http.routers.proxy.service=proxy | |
command: | |
- "--api.insecure=true" | |
- "--providers.docker" | |
- "--accesslog=true" | |
ports: | |
- "80:80" | |
- "8080:8080" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events | |
## portainer dashboard for docker-containers | |
portainer: | |
image: portainer/portainer-ce:2.13.0 | |
command: -H unix:///var/run/docker.sock | |
restart: always | |
labels: | |
- traefik.http.routers.portainer.rule=Host(`portainer.docker.localhost`) | |
- traefik.http.routers.portainer.tls=false | |
- traefik.http.services.portainer.loadbalancer.server.port=9000 | |
- traefik.http.routers.portainer.service=portainer | |
ports: | |
- 9000:9000 | |
volumes: | |
- portainer_data:/data | |
- /var/run/docker.sock:/var/run/docker.sock | |
# applications to be dun on docker | |
static: | |
image: rawsanj/static:latest | |
restart: always | |
labels: | |
- traefik.http.routers.grafana.rule=Host(`application.docker.localhost`) | |
- traefik.http.routers.grafana.tls=false | |
ports: | |
- 8080:8080 | |
### Container Monitoring Stack | |
prometheus: | |
image: prom/prometheus:latest | |
volumes: | |
- /srv/monitor-stack/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml | |
ports: | |
- 9090 | |
grafana: | |
image: grafana/grafana:latest | |
labels: | |
- traefik.http.routers.grafana.rule=Host(`grafana.docker.localhost`) | |
- traefik.http.routers.grafana.tls=false | |
volumes: | |
- /srv/monitor-stack/grafana/grafana.ini:/etc/grafana/grafana.ini | |
- /srv/monitor-stack/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources | |
- /srv/monitor-stack/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards | |
- /srv/monitor-stack/grafana/dashboards:/etc/grafana/dashboards | |
ports: | |
- 3000 | |
environment: | |
- GF_SECURITY_ADMIN_PASSWORD=grafanaPa$$w0rd! | |
- GF_USERS_ALLOW_SIGN_UP=false | |
- GF_SERVER_DOMAIN=grafana.docker.localhost | |
links: | |
- prometheus | |
node-exporter: | |
image: prom/node-exporter:latest | |
container_name: monitoring_node_exporter | |
restart: unless-stopped | |
ports: | |
- 9100 | |
cadvisor: | |
image: google/cadvisor:latest | |
labels: | |
- traefik.http.routers.cadvisor.rule=Host(`cadvisor.docker.localhost`) | |
- traefik.http.routers.cadvisor.tls=false | |
container_name: monitoring_cadvisor | |
restart: unless-stopped | |
volumes: | |
- /:/rootfs:ro | |
- /var/run:/var/run:rw | |
- /sys:/sys:ro | |
- /var/lib/docker/:/var/lib/docker:ro | |
ports: | |
- 8080 | |
volumes: | |
portainer_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment