-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
executable file
·196 lines (181 loc) · 7.31 KB
/
docker-compose.yml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
version: "3.1"
x-shared-influxdb-variables: &shared-influxdb-variables
# InfluxDB will create the specified database and an admin account with the specified credentials.
# More info: https://github.com/influxdata/influxdata-docker/pull/102
INFLUXDB_DB: ${INFLUXDB_V2_DB}
INFLUXDB_ADMIN_USER: ${INFLUXDB_INITIAL_SETUP_ADMIN}
INFLUXDB_ADMIN_PASSWORD: ${INFLUXDB_INITIAL_SETUP_PASSWORD}
INFLUXDB_ADMIN_TOKEN: ${INFLUXDB_TOKEN}
services:
mosquitto:
image: eclipse-mosquitto
container_name: mosquitto
restart: always
volumes:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
ports:
- 1883:1883
- 9001:9001
influxdb:
container_name: $INFLUXDB_DOCKER_CONTAINER_NAME
image: influxdb:2.4.0
volumes:
- ./influxdv2/data:/var/lib/influxdb2
- ./influxdv2/config:/etc/influxdb2
restart: always
env_file:
- ./.env
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_RETENTION: 1w
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORGANISATION}
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET}
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_TOKEN}
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_INITIAL_SETUP_ADMIN}
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_INITIAL_SETUP_PASSWORD}
<< : *shared-influxdb-variables
networks:
- monitoring-proxy
labels:
- "traefik.http.routers.influxdb-ssl.entryPoints=influxdb-port"
- "traefik.http.routers.influxdb-ssl.rule=host(`$MONITORING_DOMAIN`)"
- "traefik.http.routers.influxdb-ssl.tls=true"
- "traefik.http.routers.influxdb-ssl.tls.certResolver=lets-encrypt-ssl"
- "traefik.http.routers.influxdb-ssl.service=influxdb-ssl"
- "traefik.http.services.influxdb-ssl.loadBalancer.server.port=$INFLUXDB_PORT"
grafana:
container_name: $GRAFANA_DOCKER_CONTAINER_NAME
image: grafana/grafana:9.0.2
volumes:
- type: volume
source: grafana-data
target: /var/lib/grafana
- type: bind
source: ./grafana/provisioning
target: /etc/grafana/provisioning
read_only: true
env_file:
- ./.env
environment:
GF_PATHS_DATA: /var/lib/grafana
GF_PATHS_PLUGINS: /var/lib/grafana/plugins
GF_PATHS_PROVISIONING: /etc/grafana/provisioning
GF_SERVER_HTTP_PORT: 3000
GF_SERVER_MONITORING_DOMAIN: ${MONITORING_DOMAIN}
GF_SERVER_ROOT_URL: https://${MONITORING_DOMAIN}
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD}
GF_LOG_MODE: console
# Variables for setting up the InfluxDB data source
<< : *shared-influxdb-variables
networks:
- monitoring-proxy
restart: always
depends_on:
- $INFLUXDB_DOCKER_CONTAINER_NAME
labels:
# Router for redirecting HTTP traffic to the router receiving HTTPS traffic.
- "traefik.http.routers.grafana.entryPoints=port80"
- "traefik.http.routers.grafana.rule=host(`$MONITORING_DOMAIN`)"
- "traefik.http.routers.grafana.middlewares=grafana-redirect"
- "traefik.http.middlewares.grafana-redirect.redirectScheme.scheme=https"
- "traefik.http.middlewares.grafana-redirect.redirectScheme.permanent=true"
- "traefik.http.routers.grafana-ssl.entryPoints=port443"
- "traefik.http.routers.grafana-ssl.rule=host(`$MONITORING_DOMAIN`)"
- "traefik.http.routers.grafana-ssl.tls=true"
- "traefik.http.routers.grafana-ssl.tls.certResolver=lets-encrypt-ssl"
- "traefik.http.routers.grafana-ssl.service=grafana-ssl"
- "traefik.http.services.grafana-ssl.loadBalancer.server.port=3000"
nginx:
container_name: nginx
image: nginx
volumes:
- type: bind
source: ./site-content/
target: /usr/share/nginx/html
ports:
- "8080:80"
env_file:
- ./.env
labels:
# http
- "traefik.http.routers.nginx.entryPoints=port80"
- "traefik.http.routers.nginx.rule=host(`lesni.space`)"
#- "traefik.http.routers.nginx.middlewares=nginx-redirect"
#- "traefik.http.middlewares.nginx-redirect.redirectScheme.scheme=https"
#- "traefik.http.middlewares.nginx-redirect.redirectScheme.permanent=true"
- "traefik.http.routers.nginx-ssl.entryPoints=port443"
- "traefik.http.routers.nginx-ssl.rule=host(`lesni.space`)"
- "traefik.http.routers.nginx-ssl.tls=true"
- "traefik.http.routers.nginx-ssl.tls.certResolver=lets-encrypt-ssl"
- "traefik.http.routers.nginx-ssl.service=nginx-ssl"
- "traefik.http.services.nginx-ssl.loadBalancer.server.port=80"
networks:
- monitoring-proxy
restart: always
traefik:
container_name: traefik
image: traefik:v2.8.1
volumes:
- type: volume
source: traefik-data
target: /letsencrypt
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
env_file:
- ./.env
networks:
- monitoring-proxy
restart: always
ports:
- "80:80"
- "443:443"
- "$INFLUXDB_PORT:$INFLUXDB_PORT"
command:
- "--providers.docker=true"
- "--entryPoints.port443.address=:443"
- "--entryPoints.port80.address=:80"
- "--entryPoints.influxdb-port.address=:$INFLUXDB_PORT"
- "--certificatesResolvers.lets-encrypt-ssl.acme.tlsChallenge=true"
- "--certificatesResolvers.lets-encrypt-ssl.acme.storage=/letsencrypt/acme.json"
- "--certificatesresolvers.lets-encrypt-ssl.acme.caServer=${CA_SERVER}"
- "--certificatesResolvers.lets-encrypt-ssl.acme.email=${LETS_ENCRYPT_EMAIL}"
telegraf:
image: telegraf
container_name: telegraf
restart: always
environment:
HOST_PROC: /rootfs/proc
HOST_SYS: /rootfs/sys
HOST_ETC: /rootfs/etc
volumes:
- ./telegraf_configs:/etc/telegraf:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /sys:/rootfs/sys:ro
- /proc:/rootfs/proc:ro
- /etc:/rootfs/etc:ro
links:
- influxdb
env_file:
- ./.env
environment:
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORGANISATION}
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET}
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_TOKEN}
networks:
- monitoring-proxy
restart: always
networks:
monitoring-proxy:
driver: bridge
volumes:
# influxdb-config:
# external: false
grafana-data:
external: false
traefik-data:
external: false