-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.yaml
190 lines (184 loc) · 5.13 KB
/
common.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
# Healthcheck reference:
# https://github.com/peter-evans/docker-compose-healthcheck
x-supervisor-vols: &supervisor-vols
volumes:
- type: bind
source: ${DATA_DIR:-./data}/processes
target: /etc/supervisor/conf.d
- type: bind
source: ${DATA_DIR:-./data}/appdata/
target: /app/data/
- type: bind
source: ${LOGS_DIR:-./data/logs}/collect_stats
target: /var/log/infinimetrics
x-web-vols: &web-vols
volumes:
- type: bind
source: ${DATA_DIR:-./data}/processes
target: /etc/supervisor/conf.d
- type: bind
source: ${DATA_DIR:-./data}/appdata/
target: /app/data/
- type: volume
source: infinimetrics-static
target: /app/collected_static
- type: bind
source: ${DATA_DIR:-./data}/private
target: /etc/ssl/private/
# for logs collection
- type: bind
source: ${DATA_DIR:-./data}/tmp/
target: /tmp/infinimetrics/
- type: bind
source: ${LOGS_DIR:-./data/logs}/collect_stats
target: /var/log/infinimetrics/collect_stats
# Cron
- type: bind
source: ${LOGS_DIR:-./data/logs}/cron
target: /var/log/infinimetrics/cron
# For calculating data usage of each partition
- type: bind
source: ${POSTGRES_DIR:-./data/postgres}
target: /app/postgres-data
read_only: true
- type: bind
source: ${CLICKHOUSE_DIR:-./data/clickhouse}
target: /app/clickhouse-data
read_only: true
x-cron-vols: &cron-vols
volumes:
- type: bind
source: ${LOGS_DIR:-./data/logs}/cron
target: /var/log/infinimetrics/cron
- type: bind
source: ${DATA_DIR:-./data}/appdata/
target: /app/data/
# For calculating data usage of each partition
- type: bind
source: ${POSTGRES_DIR:-./data/postgres}
target: /app/postgres-data
read_only: true
- type: bind
source: ${CLICKHOUSE_DIR:-./data/clickhouse}
target: /app/clickhouse-data
read_only: true
- type: bind
source: ./docker/conf/crontab
target: /etc/cron.d/infinimetrics
x-dot-env: &dot-env
env_file:
- ./.env
- ./.env.user
x-common-env: &common-env
environment:
CLICKHOUSE_URL: http://clickhouse:8123/
POSTGRES_HOST: postgres
POSTGRES_DB: infinimetrics
POSTGRES_PORT: 5432
services:
nginx:
container_name: infinimetrics_nginx
ports:
- 443:443
- 80:80
hostname: nginx
image: ${NGINX_IMAGE:-}
restart: always
volumes:
- type: volume
source: infinimetrics-static
target: /app/collected_static
- type: bind
source: ./docker/conf/nginx.conf
target: /etc/nginx/conf.d/default.conf
- type: bind
source: ${DATA_DIR:-./data}/private/
target: /etc/ssl/private/
- type: bind
source: ${DATA_DIR:-./data}/tmp/
target: /tmp/infinimetrics/
<<: [*common-env, *dot-env]
postgres:
container_name: infinimetrics_postgres
command: -c config_file=/etc/postgresql.conf
hostname: postgres
restart: always
build:
dockerfile: ./docker/Dockerfile.postgres
context: .
args:
- POSTGRES_IMAGE=${POSTGRES_IMAGE:-}
volumes:
- type: bind
source: ${POSTGRES_DIR:-./data/postgres}
target: /var/lib/postgresql/data
- type: bind
source: ./docker/conf/postgresql.conf
target: /etc/postgresql.conf
healthcheck:
test: [
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-postgres}"
]
interval: 10s
timeout: 5s
retries: 5
<<: [*common-env, *dot-env]
clickhouse:
container_name: infinimetrics_clickhouse
hostname: clickhouse
restart: always
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
- type: bind
source: ${CLICKHOUSE_DIR:-./data/clickhouse}
target: /opt/clickhouse/
- type: bind
source: ./docker/conf/clickhouse-config.xml
target: /etc/clickhouse-server/config.xml
- type: bind
source: ./docker/conf/clickhouse-users.xml
target: /etc/clickhouse-server/users.xml
<<: [*common-env, *dot-env]
healthcheck:
test: [
"CMD-SHELL",
"http_proxy='' wget -nv -t1 --spider 'http://localhost:8123/' || exit 1",
]
interval: 10s
timeout: 10s
retries: 30
collect_stats:
container_name: infinimetrics_collect_stats
hostname: collect_stats
restart: always
<<: [*supervisor-vols, *common-env, *dot-env]
entrypoint: []
# to enable zombie process reaping
init: true
command: ["/usr/bin/supervisord"]
healthcheck:
test: curl --fail http://localhost:9001 || exit 1
interval: 10s
timeout: 10s
retries: 10
cron:
container_name: infinimetrics_cron
restart: always
init: true
entrypoint: ["/app/cron.sh"]
<<: [*cron-vols, *common-env, *dot-env]
web:
container_name: infinimetrics_web
hostname: infinimetrics
restart: always
<<: [*web-vols, *common-env, *dot-env]
entrypoint: "/app/entrypoint.sh"
init: true
healthcheck:
test: curl --fail http://localhost:8000 || exit 1
timeout: 30s
retries: 10