-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yaml
124 lines (117 loc) · 3.62 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
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
version: '2.4'
services:
mariadb:
image: tobi312/rpi-mariadb:10.6-alpine
#container_name: sensors-mariadb
#restart: unless-stopped
volumes:
#- mariadb-data:/var/lib/mysql:rw
- ./mariadb:/var/lib/mysql:rw
- ./sensors_create_table.sql:/docker-entrypoint-initdb.d/sensors_create_table.sql:ro
environment:
TZ: ${TZ:-UTC}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
ports:
#- 3306:3306
- 3306
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD || exit 1
#test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD || exit 1
interval: 60s
timeout: 5s
retries: 5
#start_period: 30s
networks:
net-sensors:
aliases:
- mysql
- db
dht22:
#build:
# context: ./
# dockerfile: alpine.armhf.python.Dockerfile
image: tobi312/rpi-sensors:python-alpine
#image: tobi312/rpi-sensors:python-debian
#container_name: sensors-dht22
#restart: unless-stopped
privileged: ${PRIVILEGED_MODE_ENABLE:-false}
environment:
TZ: ${TZ:-UTC}
LOGLEVEL: ${LOGLEVEL:-INFO}
GPIO_PIN_DHT22: ${GPIO_PIN_DHT22:-4}
DHT22_SLEEPTIME: ${DHT22_SLEEPTIME:-60}
DHT22_ID: ${DHT22_ID:-1}
DB_HOST: ${DB_HOST:-mariadb}
DB_PORT: ${DB_PORT:-3306}
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
MQTT_HOST: ${MQTT_HOST}
MQTT_PORT: ${MQTT_PORT:-1883}
MQTT_SSL_ENABLED: ${MQTT_SSL_ENABLED:-False}
MQTT_USER: ${MQTT_USER}
MQTT_PASSWORD: ${MQTT_PASSWORD}
MQTT_CLIENTNAME: ${MQTT_CLIENTNAME:-sensor-1}
MQTT_TOPIC: ${MQTT_TOPIC:-sensors}
devices:
- /dev/gpiomem
#volumes:
# - ./dht_sensor.py:/service/dht_sensor.py:ro
depends_on:
mariadb:
condition: ${DEPENDS_CONDITION:-service_healthy}
networks:
net-sensors:
#entrypoint: [ "/bin/sh", "-c", "--" ]
#command: [ "while true; do sleep 60; done;" ]
# copy and paste "dht22" when you have more than one sensor, then rename to "dht22-2" and change GPIO-PIN and ID (2).
web:
#build:
# context: ./
# dockerfile: alpine.armhf.web_nginx.Dockerfile
image: tobi312/rpi-sensors:web-nginx-alpine
#image: tobi312/php:8.0-fpm-nginx-alpine-arm
#image: tobi312/php:8.0-apache-arm
#container_name: sensors-web
#restart: unless-stopped
ports:
- "${WEB_PORT:-80}:80"
#- "80:80"
#- "443:443"
#volumes:
# - ./html:/var/www/html:rw
environment:
TZ: ${TZ:-UTC}
PHP_ERRORS: ${WEB_PHP_ERRORS:-1}
## next env only with apache
#ENABLE_APACHE_REMOTEIP: ${WEB_ENABLE_REMOTEIP:-0}
#ENABLE_APACHE_STATUS: ${WEB_ENABLE_STATUS:-1}
## next env only with nginx
ENABLE_NGINX_REMOTEIP: ${WEB_ENABLE_REMOTEIP:-0}
ENABLE_NGINX_STATUS: ${WEB_ENABLE_STATUS:-1}
## Database (php to mariadb)
DB_HOST: ${DB_HOST:-mariadb}
DB_PORT: ${DB_PORT:-3306}
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
healthcheck:
#test: curl --fail http://127.0.0.1:80/server-status || exit 1
test: curl --fail http://127.0.0.1:80/nginx_status || exit 1
interval: 60s
timeout: 10s
retries: 3
#start_period: 10s
depends_on:
mariadb:
condition: ${DEPENDS_CONDITION:-service_healthy}
networks:
net-sensors:
networks:
net-sensors:
name: net-sensors
#volumes:
# mariadb-data: