forked from zabbix/zabbix-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
224 lines (201 loc) · 6.69 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
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
version: '2.4'
services:
zabbix-server:
image: zabbix/zabbix-server-pgsql:ubuntu-5.0.16
cpu_quota: 5000 # 1000 = 1%
mem_reservation: 64M
ports:
- "10051:10051"
volumes:
- /etc/localtime:/etc/localtime:ro
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
env_file:
- ./deploy_configs/env_vars/.env_db_pgsql
- ./deploy_configs/env_vars/.env_srv
depends_on:
- postgres-server
networks:
zbx_net_backend:
zbx_net_frontend:
stop_grace_period: 30s
sysctls:
- net.ipv4.ip_local_port_range=1024 65000
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
restart: always
zabbix-web-nginx-pgsql:
image: zabbix/zabbix-web-nginx-pgsql:ubuntu-5.0.16
cpu_quota: 80000 # 1000 = 1%
mem_reservation: 256M
volumes:
- /etc/localtime:/etc/localtime:ro
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
env_file:
- ./deploy_configs/env_vars/.env_db_pgsql
- ./deploy_configs/env_vars/.env_web
depends_on:
- postgres-server
- zabbix-server
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
zbx_net_backend:
zbx_net_frontend:
stop_grace_period: 10s
sysctls:
- net.core.somaxconn=65535
labels:
- "traefik.enable=true"
- "traefik.http.routers.zabbix.entrypoints=http,https"
- "traefik.http.routers.zabbix.rule=Host(`zabbix.zabbix-web24.duckdns.org`)"
- "traefik.http.routers.zabbix.tls=true"
- "traefik.http.routers.zabbix.tls.certresolver=staging"
- "traefik.http.services.zabbix.loadbalancer.server.port=8080"
restart: always
zabbix-agent:
image: zabbix/zabbix-agent:ubuntu-5.0.16
cpu_quota: 5000 # 1000 = 1%
mem_reservation: 8M
ports:
- "10050:10050"
volumes:
- /etc/localtime:/etc/localtime:ro
- ./zbx_env/etc/zabbix/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
env_file:
- ./deploy_configs/env_vars/.env_agent
privileged: true
pid: "host"
networks:
zbx_net_backend:
aliases:
- zabbix-server-agent
stop_grace_period: 5s
restart: always
postgres-server:
image: postgres:12 # Поменять на ubuntu?
cpu_quota: 80000 # 1000 = 1%
mem_reservation: 256M
volumes:
- ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw
env_file:
- ./deploy_configs/env_vars/.env_db_pgsql
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
stop_grace_period: 1m
networks:
zbx_net_backend:
restart: always
grafana: # optional more functional and creative UI for zabbix
image: grafana/grafana:8.2.0-ubuntu
cpu_quota: 80000 # 1000 = 1%
mem_reservation: 128M
volumes:
- grafana_storage:/var/lib/grafana
- ./deploy_configs/grafana/grafana.ini:/etc/grafana/grafana.ini
env_file:
- ./deploy_configs/grafana/.env_grafana
depends_on:
- zabbix-server
- postgres-server
- zabbix-web-nginx-pgsql
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.entrypoints=http,https"
- "traefik.http.routers.grafana.rule=Host(`grafana.zabbix-web24.duckdns.org`)"
# - "traefik.http.routers.grafana.rule=Host(`zabbix-web24.duckdns.org`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.tls=true"
- "traefik.http.routers.grafana.tls.certresolver=staging"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:3000/" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
zbx_net_backend:
zbx_net_frontend:
restart: always
traefik:
image: traefik:v2.5.3
cpu_quota: 10000 # 1000 = 1%
mem_reservation: 64M
ports:
- "80:80"
- "443:443"
volumes:
- traefik-ssl-certs:/ssl-certs
- ./deploy_configs/traefik/:/etc/traefik/
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`traefik.zabbix-web24.duckdns.org`)"
- "traefik.http.services.dashboard.loadbalancer.server.port=8080"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.entrypoints=http,https"
- "traefik.http.routers.dashboard.middlewares=secheaders@file"
- "traefik.http.routers.dashboard.tls.certresolver=staging"
# Basic Authentication for Traefik Dashboard
# Generate password: sudo apt update && sudo apt install apache2-utils && htpasswd -nb USER PASSWORD
# You need to escape all $ sings ($ --> $$)
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=traefik-auth"
- "traefik.http.middlewares.traefik-auth.basicauth.users=admin:$$apr1$$dQS.9m8b$$99bHXnFsbxXaa5StcfPRk/"
healthcheck:
test: [ "CMD", "wget", "http://localhost:8082/ping","--spider" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
security_opt:
- no-new-privileges:true
networks:
zbx_net_backend:
zbx_net_frontend:
restart: always
networks:
zbx_net_frontend:
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "false"
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
zbx_net_backend:
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "false"
ipam:
driver: default
config:
- subnet: 172.16.239.0/24
volumes: # Persistent data
grafana_storage:
traefik-ssl-certs: