-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
83 lines (78 loc) · 2.04 KB
/
docker-compose.yaml
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
services:
influxdb:
image: influxdb:2.7.10
restart: always
ports:
- "8086:8086"
env_file: ./infra/influxdb.env
networks:
- db
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8086/health"]
interval: 10s
start_period: 10s
volumes:
- db-data:/var/lib/influxdb2
# generate Telegraf user in InfluxDB
telegraf-credentials:
image: influxdb:2.7.10
command: /scripts/telegraf-init.sh
env_file: ./infra/influxdb.env
working_dir: /scripts
networks:
- db
volumes:
- ./infra/mqtt.auth:/scripts/mqtt.auth
- ./infra/telegraf.env:/scripts/telegraf.env
- ./infra/telegraf-init.sh:/scripts/telegraf-init.sh:ro
depends_on:
influxdb:
condition: service_healthy
mosquitto:
image: eclipse-mosquitto:2.0
restart: always
networks:
- mqtt
ports:
- "1883:1883"
- "9001:9001"
entrypoint: /bin/sh
command:
- -c
- |
cp /etc/mosquitto/mqtt.auth /etc/mosquitto/password_file
chmod 0700 /etc/mosquitto/password_file
chown mosquitto: /etc/mosquitto/password_file
mosquitto_passwd -U /etc/mosquitto/password_file
/docker-entrypoint.sh /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf
depends_on:
telegraf-credentials:
condition: service_completed_successfully
volumes:
- mqtt-data:/mosquitto/data
- mqtt-logs:/mosquitto/log
- ./infra/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- ./infra/mqtt.auth:/etc/mosquitto/mqtt.auth:ro
telegraf:
image: telegraf:1.30-alpine
restart: always
env_file: ./infra/telegraf.env
networks:
- db
- mqtt
depends_on:
telegraf-credentials:
condition: service_completed_successfully
influxdb:
condition: service_healthy
mosquitto:
condition: service_started
volumes:
- ./infra/telegraf-config.toml:/etc/telegraf/telegraf.conf:ro
volumes:
db-data:
mqtt-data:
mqtt-logs:
networks:
db:
mqtt: