-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-2.yml
184 lines (178 loc) · 4.99 KB
/
docker-compose-2.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
version: "3.8"
name: ile
networks:
vnet:
driver: bridge
ipam:
config:
- subnet: 192.168.130.0/24
volumes:
redis_data:
driver: local
driver_opts:
o: bind
type: none
device: ${PWD}/data_redis
services:
redis:
build:
context: ${PWD}
no_cache: false
pull: true
# https://github.com/docker-library/redis/blob/master/7.0/Dockerfile
# https://redis.io/docs/management/config-file/
dockerfile_inline: |
FROM redis:7.0.12
RUN mkdir -p /usr/local/etc/redis
COPY <<EOF /usr/local/etc/redis/redis.conf
save 3600 1 300 100 60 10000
appendonly yes
requirepass ${ILE_REDIS_PASSWORD}
dir /data
EOF
RUN set -eux \
&& groupadd -g "${ILE_NONROOT_GID}" nonroot \
&& useradd -u "${ILE_NONROOT_UID}" -g "${ILE_NONROOT_GID}" nonroot
RUN chown -R nonroot:nonroot /data
USER nonroot
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
image: ile-redis:0.0.1
user: nonroot:nonroot
restart: always
hostname: redis
networks:
vnet:
ipv4_address: 192.168.130.20
volumes:
- redis_data:/data
logging:
options:
max-size: 10m
max-file: 1
healthcheck:
# https://questdb.io/doc-s/operations/health-monitoring/
test: timeout -s 15 5 redis-cli -h localhost -p 6379 -a ${ILE_REDIS_PASSWORD} ping | grep -qaFi PONG || exit 1
interval: 30s
timeout: 10s
start_period: 20s
retries: 3
deploy:
restart_policy:
condition: any
delay: 5s
resources:
limits:
cpus: '0.4'
reservations:
cpus: '0.3'
tcp-cache:
build:
context: ${PWD}/ile_tcp_cache
args:
ILE_NONROOT_UID: ${ILE_NONROOT_UID}
ILE_NONROOT_GID: ${ILE_NONROOT_GID}
no_cache: false
pull: true
image: ile-tcp-cache:0.0.1
user: nonroot:nonroot
restart: always
networks:
vnet:
ipv4_address: 192.168.130.21
extra_hosts:
- questdb:192.168.130.10
ports:
- "9152:9152"
environment:
- ITC_MY_TCP_BIND_HOST=0.0.0.0
- ITC_MY_TCP_BIND_PORT=9152
- ITC_TARGET_TCP_HOST=${ITC_TARGET_TCP_HOST}
- ITC_TARGET_TCP_PORT=9009
- ITC_REDIS_HOST=redis
- ITC_REDIS_PORT=6379
- ITC_REDIS_PASSWORD=${ILE_REDIS_PASSWORD}
logging:
options:
max-size: 10m
max-file: 1
depends_on:
redis:
condition: service_started
restart: true
deploy:
restart_policy:
condition: any
delay: 5s
resources:
limits:
cpus: '0.4'
reservations:
cpus: '0.3'
# https://hub.docker.com/_/telegraf
# https://www.influxdata.com/blog/docker-run-telegraf-as-non-root/
telegraf2:
build:
context: ${PWD}
no_cache: false
pull: true
# https://github.com/influxdata/influxdata-docker/blob/master/telegraf/1.27/Dockerfile
dockerfile_inline: |
FROM telegraf:1.27.2
RUN set -eux \
&& groupadd -g "${ILE_NONROOT_GID}" nonroot \
&& useradd -u "${ILE_NONROOT_UID}" -g "${ILE_NONROOT_GID}" nonroot
USER nonroot:999
CMD telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d
image: ile-telegraf2:0.0.1
user: nonroot:999
restart: always
network_mode: host
extra_hosts:
- ile-tcp-cache:192.168.130.21
environment:
- HOST_ETC=/hostfs/etc
- HOST_PROC=/hostfs/proc
- HOST_SYS=/hostfs/sys
- HOST_VAR=/hostfs/var
- HOST_RUN=/hostfs/run
- HOST_MOUNT_PREFIX=/hostfs
- LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnvidia-ml.so
- ILT_SOCKET_WRITER_ADDRESS=tcp://ile-tcp-cache:9152
- ILT_HEALTH_SERVICE_ADDRESS=http://127.0.0.1:8653
volumes:
- /:/hostfs:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${PWD}/ile_telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
- ${PWD}/ile_telegraf/telegraf-nvidia.conf:/etc/telegraf/telegraf.d/telegraf-nvidia.conf:ro
- /usr/bin/nvidia-smi:/usr/bin/nvidia-smi:ro
- /usr/lib/x86_64-linux-gnu/libnvidia-ml.so:/usr/lib/x86_64-linux-gnu/libnvidia-ml.so:ro
devices:
- /dev/nvidiactl:/dev/nvidiactl
- /dev/nvidia0:/dev/nvidia0
security_opt:
# https://github.com/influxdata/telegraf/issues/6574
- apparmor:unconfined
logging:
options:
max-size: 10m
max-file: 1
healthcheck:
# https://github.com/influxdata/telegraf/blob/release-1.27/plugins/outputs/health/README.md
test: timeout -s 15 5 curl -f http://127.0.0.1:8653 || exit 1
interval: 30s
timeout: 10s
start_period: 20s
retries: 3
depends_on:
tcp-cache:
condition: service_started
restart: true
deploy:
restart_policy:
condition: any
delay: 5s
resources:
limits:
cpus: '0.4'
reservations:
cpus: '0.3'