-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcompose.yaml
More file actions
325 lines (325 loc) · 11.2 KB
/
Copy pathcompose.yaml
File metadata and controls
325 lines (325 loc) · 11.2 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# **************************************************************** #
# ham_docker_container - Containers for APRS and ham radio #
# Version 0.1.0 #
# https://github.com/iontodirel/ham_docker_container #
# Copyright (c) 2023 Ion Todirel #
# **************************************************************** #
services:
# ------------------------------------------------------
# direwolfm - Direwolf modem container
# ------------------------------------------------------
#
# Exposes typically ports 8010 and 8020 to the host (this can be configured from .env)
# Has a volume mounted to read the digirig_config.json or other files (this can be configured from .env)
# A private network is created and exposed between the direwolf container
# and the aprx container, so that aprx can use port 8020 (typically)
# to access the Direwolf TCN KISS TNC
# This container is given access to the host via --privileged such
# that we can access USB sound cards and USB serial ports
#
# You can create multiple simultanously running containers
# based on the Direwolf container directory
# ------------------------------------------------------
direwolfm:
env_file:
- ".env"
environment:
- SERVICE_NAME=${MODEM0_SERVICE_NAME}
- WS_SERVICE_NAME=${SVC_CONTROL_WS_SERVICE_NAME}
- WS_PORT=${SVC_CONTROL_WS_REST_PORT}
build:
context: .
dockerfile: ./direwolf/Dockerfile
image: "direwolf"
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "10"
ports:
# exposing KISS and AGWP ports to the host
- "${MODEM0_AGWP_PORT}:${MODEM0_PRIV_AGWP_PORT}"
- "${MODEM0_KISS_PORT}:${MODEM0_PRIV_KISS_PORT}"
volumes:
# find_devices configuration, shared such that configuration
# can be changed without rebuilding the container
- ${MODEM0_FD_CONFIG_FILE_NAME}:${MODEM0_PRIV_FD_CONFIG_FILE_NAME}
# share volume with host, for logging, so Direwolf logs can be read on the host
- ${MODEM0_LOG_DIR}:${MODEM0_PRIV_LOG_DIR}
# Direwolf configuration, shared such that configuration
# can be changed (wiht automatic service restart) without rebuilding the container
- ${MODEM0_DW_CONFIG_FILE_NAME}:${MODEM0_PRIV_DW_CONFIG_FILE_NAME}
networks:
- direwolfm_network
- service_network
privileged: true
labels:
- "autoheal=true"
- "ham_docker_container_name=${MODEM0_SERVICE_NAME}"
depends_on:
- svc_control_ws
healthcheck:
test: ["CMD", "pwsh", "-ExecutionPolicy", "Bypass", "-File", "/healthcheck.ps1"]
interval: "10s" # the interval to to perform health check
start_period: "60s" # how long it takes to start the container
retries: 1 # how many times to retry until the container becomes unhealty
timeout: "30s" # how long until the health check completes
restart: always
# ------------------------------------------------------
# direwolfl - Direwolf modem loopback container
# ------------------------------------------------------
direwolfl:
env_file:
- ".env"
environment:
- SERVICE_NAME=${MODEM1_SERVICE_NAME}
- WS_SERVICE_NAME=${SVC_CONTROL_WS_SERVICE_NAME}
- WS_PORT=${SVC_CONTROL_WS_REST_PORT}
build:
context: .
dockerfile: ./direwolf/Dockerfile
image: "direwolf"
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "10"
ports:
# exposing KISS and AGWP ports to the host
- "${MODEM1_AGWP_PORT}:${MODEM1_PRIV_AGWP_PORT}"
- "${MODEM1_KISS_PORT}:${MODEM1_PRIV_KISS_PORT}"
volumes:
# find_devices configuration, shared such that configuration
# can be changed without rebuilding the container
- ${MODEM1_FD_CONFIG_FILE_NAME}:${MODEM1_PRIV_FD_CONFIG_FILE_NAME}
# share volume with host, for logging, so Direwolf logs can be read on the host
- ${MODEM1_LOG_DIR}:${MODEM1_PRIV_LOG_DIR}
# Direwolf configuration, shared such that configuration
# can be changed (wiht automatic service restart) without rebuilding the container
- ${MODEM1_DW_CONFIG_FILE_NAME}:${MODEM1_PRIV_DW_CONFIG_FILE_NAME}
networks:
- service_network
privileged: true
labels:
- "autoheal=true"
- "ham_docker_container_name=${MODEM1_SERVICE_NAME}"
depends_on:
- svc_control_ws
healthcheck:
test: ["CMD", "pwsh", "-ExecutionPolicy", "Bypass", "-File", "/healthcheck.ps1"]
interval: "10s" # the interval to to perform health check
start_period: "60s" # how long it takes to start the container
retries: 1 # how many times to retry until the container becomes unhealty
timeout: "30s" # how long until the health check completes
restart: always
# ------------------------------------------------------
# aprx - repeater container
# ------------------------------------------------------
aprx:
env_file:
- ".env"
environment:
- SERVICE_NAME=${APRX_SERVICE_NAME}
build:
context: .
dockerfile: ./aprx/Dockerfile
image: "aprx"
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "10"
volumes:
# for access to the aprx.conf file
- ${APRX_CONFIG_FILE}:${APRX_PRIV_CONFIG_FILE}
# for logging being accessible on the host
- ${APRX_LOG_DIR}:${APRX_PRIV_LOG_DIR}
networks:
- direwolfm_network
- service_network
depends_on:
- direwolfm
- svc_control_ws
labels:
- autoheal=true
- ham_docker_container_name=${APRX_SERVICE_NAME}
healthcheck:
test: ["CMD", "pwsh", "-ExecutionPolicy", "Bypass", "-File", "/healthcheck.ps1"]
interval: 10s # the interval to to perform health check
start_period: 60s # how long it takes to start the aprx container
# health checks won't count until after this period expires
retries: 1 # how many times to retry until the container becomes unhealty
timeout: 30s # how long until the health check completes
restart: always
# # ------------------------------------------------------
# # gps - gpsd container
# # ------------------------------------------------------
# # exposes port 8888 (typically), can be changed with GPS_HOST_PORT from .env
# # can use "cgps -s localhost:8888" on the host to check (apt-get install gpsd-clients)
# #
# # This container is given access to the host via --privileged such
# # that we can access USB serial ports
gps:
env_file:
- ".env"
environment:
- SERVICE_NAME=${GPS_SERVICE_NAME}
build:
context: .
dockerfile: ./gps/Dockerfile
image: "gps"
logging:
driver: "json-file"
options:
max-size: "500k"
max-file: "10"
ports:
# exposes GPS service onto the host
- "${GPS_GPSD_PORT}:${GPS_PRIV_GPSD_PORT}"
volumes:
# enables updating find_devices config without rebuilding the container
- ${GPS_FD_CONFIG_FILE_NAME}:${GPS_PRIV_FD_CONFIG_FILE_NAME}
networks:
- gps_network
- service_network
privileged: true
labels:
- "autoheal=true"
- "ham_docker_container_name=${GPS_SERVICE_NAME}"
healthcheck:
test: ["CMD", "pwsh", "-ExecutionPolicy", "Bypass", "-File", "/healthcheck.ps1"]
interval: "10s" # the interval to to perform health check
start_period: "30s" # how long it takes to start the container
retries: 1 # how many times to retry until the container becomes unhealty
timeout: "15s" # how long until the health check completes
depends_on:
- svc_control_ws
restart: always
# ------------------------------------------------------
# db - database container
# ------------------------------------------------------
db:
env_file:
- ".env"
environment:
- MYSQL_DATABASE=${DB_MYSQL_DB_NAME}
- MYSQL_ROOT_PASSWORD=${DB_MYSQL_PASSWORD}
- MYSQL_PASSWORD=${DB_MYSQL_PASSWORD}
- MYSQL_USER=${DB_MYSQL_USER}
image: mysql
labels:
- autoheal=true
- "ham_docker_container_name=${DB_MYSQL_SERVICE_NAME}"
volumes:
- ${DB_MYSQL_DATA_DIR}:${DB_PRIV_MYSQL_DATA_DIR}
ports:
- ${DB_MYSQL_PORT}:${DB_PRIV_MYSQL_PORT}
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
interval: 10s
start_period: 60s
retries: 5
timeout: 20s
networks:
- db_network
restart: always
# ------------------------------------------------------
# svc_control_ws - status web service container
# ------------------------------------------------------
svc_control_ws:
env_file:
- ".env"
build:
context: .
dockerfile: ./webservice/Dockerfile
image: "service_control_ws"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
labels:
- autoheal=true
- "ham_docker_container_name=${SVC_CONTROL_WS_SERVICE_NAME}"
ports:
- ${SVC_CONTROL_WS_WS_PORT}:${SVC_CONTROL_WS_WS_PORT}
- ${SVC_CONTROL_WS_REST_PORT}:${SVC_CONTROL_WS_REST_PORT}
volumes:
- ${SVC_CONTROL_WS_DOCKER_SOCKET}:${SVC_CONTROL_WS_DOCKER_SOCKET}
- ./settings.json:${SVC_CONTROL_WS_PRIV_SETTINGS_FILE_NAME}
healthcheck:
test: ["CMD", "pwsh", "-ExecutionPolicy", "Bypass", "-File", "/healthcheck.ps1"]
interval: 10s
start_period: 30s
retries: 1
timeout: 10s
networks:
- db_network
- service_network
depends_on:
- db
restart: always
privileged: true
# ------------------------------------------------------
# webapp - web administration app
# ------------------------------------------------------
webapp:
env_file:
- ".env"
build:
context: .
dockerfile: ./webapp/Dockerfile
image: "webapp"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
labels:
- autoheal=true
- "ham_docker_container_name=${WEBAPP_SERVICE_NAME}"
ports:
- ${WEBAPP_PORT}:${WEBAPP_PORT}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:${WEBAPP_PORT}"]
interval: 30s
start_period: 30s
retries: 1
timeout: 10s
networks:
- service_network
depends_on:
- svc_control_ws
restart: always
# ------------------------------------------------------
# autoheal - docker health monitoring container
# ------------------------------------------------------
# automatically restarts containers that are in unhealthy state
# container image from: https://hub.docker.com/r/willfarrell/autoheal
autoheal:
env_file:
- .env
image: willfarrell/autoheal:latest
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
labels:
- "ham_docker_container_name=${AUTOHEAL_SERVICE_NAME}"
tty: true
environment:
- AUTOHEAL_CONTAINER_LABEL=all
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
networks:
service_network:
name: ws
driver: bridge
direwolfm_network:
driver: bridge
gps_network:
driver: bridge
db_network:
driver: bridge