-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
86 lines (80 loc) · 2.71 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
84
85
86
#
# My Zigbee
#
# Based on -> https://www.zigbee2mqtt.io/guide/getting-started/#installation
#
# Note: No 'version' field. This allows to use 'healtcheck'.
#version: '3.8'
services:
zigbee2mqtt:
container_name: zigbee2mqtt
image: koenkk/zigbee2mqtt:latest
#image: koenkk/zigbee2mqtt:latest-dev
#restart: unless-stopped
# enable once it doesn't seem to need it ;)
depends_on:
mosquitto:
condition: service_healthy
environment:
- TZ=Europe/Helsinki
devices:
- /dev/ttyACM0:/dev/ttyZIGBEE
volumes:
- ./data.z:/app/data:rw
#- ./data.z.dev:/app/data:rw
#- /run/udev:/run/udev:ro #Disabled. Only needed if you need to make 'udev' rules for port access over reboots.
ports:
- "8088:8088"
#
healthcheck:
test: wget -nv -t1 --spider localhost:8088 || exit 1
interval: 20s
timeout: 3s
#retries: 5
mosquitto:
container_name: mqtt
image: eclipse-mosquitto:2.0
restart: unless-stopped
volumes:
# Had difficulty sharing 'shared.mosquitto' as one folder - container overwrote access rights.
# Mosquitto docs mention sharing separately, so doing so.
#
# Mosquitto seems to need write access to the config.
# <<
# chown: /mosquitto/config/mosquitto.conf: Read-only file system
# chown: /mosquitto/config: Read-only file system
# chown: /mosquitto/config: Read-only file system
# <<
#
- ./data.m/config:/mosquitto/config:rw
- ./data.m/data:/mosquitto/data:delegated
- ./data.m/log:/mosquitto/log:delegated
ports:
- "1883:1883"
- "9001:9001"
#
# Health check to keep dependent services from starting when we're still launching. Makes things more determenistic.
#
# Based on -> https://github.com/eclipse/mosquitto/issues/1270#issuecomment-601039291
#
# NOTE: THIS IS NOT PROPERLY TESTED. Tune the command if necessary. Better to use 'mosquitto_sub'
# (to test actual MQTT) but if needed, one could add a Websocket end point and check it with 'wget'.
# 'eclipse-mosquitto:2.0' image has 'wget', but not 'curl'.
#
# Note: Docker Compose officially only takes '1' as "unhealthy".
#
# Note: This DOES cause some extra logging.. (tbd. how to omit that?)
#
healthcheck:
test: mosquitto_sub -t '$$SYS/#' -E || exit 1
start_period: 10s
start_interval: 2s
interval: 2m
timeout: 3s
retries: 5
# About the fields, see:
#
# - "health check with higher [..]" (docker/compose GitHub issue)
# -> https://github.com/docker/compose/issues/10461
# - SO self-answer:
# -> https://stackoverflow.com/a/76761303/14455