about summary refs log tree commit diff
path: root/docker-compose.yml
blob: 481a6e1e487483b502dcf14ea46d67fa76da7d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
version: '3'

services:
  postgresql:
    image: postgres
    volumes:
      - db-data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    labels:
      - "traefik.backend=postgresql"
      - "traefik.frontend.rule=Host:postgresql.docker.localhost"
      - "traefik.port=5432"
      - "traefik.enable=true"

  ################################################################################ 
  # Reverse Proxy / Load Balancer
  ################################################################################ 
  traefik:
    image: traefik
    command: --api --docker
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:traefik.docker.localhost"
      - "traefik.port=8080"
      - "traefik.enable=true"

  ################################################################################ 
  # Monitoring
  ################################################################################ 
  prometheus:
    image: prom/prometheus
    ports:
      - "9090:9090"
    labels:
      - "traefik.backend=prometheus"
      - "traefik.frontend.rule=Host:prometheus.docker.localhost"
      - "traefik.port=9090"
      - "traefik.enable=true"
    networks:
      - public
    volumes:
      - "./prometheus.yml:/etc/prometheus/prometheus.yml"
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
  
  postgresql-exporter:
    image: wrouesnel/postgres_exporter:v0.4.1
    networks:
      - public
    environment:
      - DATA_SOURCE_NAME=postgresql://localhost:5432/?sslmode=disable
    ports:
      - "9187:9187"
    labels:
      - "traefik.backend=postgresql-exporter"
      - "traefik.frontend.rule=Host:postgresql-exporter.docker.localhost"
      - "traefik.port=9187"
      - "traefik.enable=true"
  
  grafana:
    image: grafana/grafana
    labels:
      - "traefik.backend=grafana"
      - "traefik.frontend.rule=Host:grafana.docker.localhost"
      - "traefik.port=3000"
      - "traefik.enable=true"
    volumes:
      - "grafana_data:/var/lib/grafana"
  
volumes:
  grafana_data: {}
  db-data: {} 

networks:
  public: