-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
224 lines (212 loc) · 6.21 KB
/
docker-compose.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
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: '3.8'
services:
bilara-backend:
depends_on:
nginx:
condition: service_healthy
elasticsearch:
condition: service_healthy
worker_pr:
condition: service_started
worker_commit:
condition: service_started
worker_sync:
condition: service_started
db:
condition: service_healthy
redis:
condition: service_started
build:
context: ./backend
dockerfile: backend.dockerfile
container_name: bilara-backend
volumes:
- ./backend:/app
- certs:/app/certs
env_file:
- .env
restart: always
setup:
image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
container_name: elasticsearch_setup
volumes:
- certs:/usr/share/elasticsearch/config/certs
- ./scripts/elasticsearch_setup.sh:/scripts/elasticsearch_setup.sh
user: "0"
entrypoint: ["/bin/bash", "/scripts/elasticsearch_setup.sh"]
healthcheck:
test: [ "CMD-SHELL", "[ -f config/certs/elasticsearch/elasticsearch.crt ]" ]
interval: 1s
timeout: 5s
retries: 120
env_file:
- .env
elasticsearch:
depends_on:
setup:
condition: service_healthy
image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
container_name: elasticsearch
volumes:
- certs:/usr/share/elasticsearch/config/certs
- elasticsearch_data:/usr/share/elasticsearch/data
ports:
- ${ES_REQUESTS_PORT}:${ES_REQUESTS_PORT}
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms1g -Xmx1g
- node.name=elasticsearch
- cluster.name=${CLUSTER_NAME}
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=true
- xpack.security.http.ssl.key=certs/elasticsearch/elasticsearch.key
- xpack.security.http.ssl.certificate=certs/elasticsearch/elasticsearch.crt
- xpack.security.http.ssl.certificate_authorities=certs/ca/ca.crt
- xpack.security.transport.ssl.enabled=true
- xpack.security.transport.ssl.key=certs/elasticsearch/elasticsearch.key
- xpack.security.transport.ssl.certificate=certs/elasticsearch/elasticsearch.crt
- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
- xpack.security.transport.ssl.verification_mode=certificate
- xpack.license.self_generated.type=${LICENSE}
healthcheck:
test:
[
"CMD-SHELL",
"curl -s --cacert config/certs/ca/ca.crt https://localhost:${ES_REQUESTS_PORT} | grep -q 'missing authentication credentials'",
]
interval: 10s
timeout: 10s
retries: 10
env_file:
- .env
restart: always
kibana:
depends_on:
elasticsearch:
condition: service_healthy
image: docker.elastic.co/kibana/kibana:${STACK_VERSION}
container_name: kibana
ports:
- ${KIBANA_PORT}:${KIBANA_PORT}
volumes:
- certs:/usr/share/kibana/config/certs
- kibana_data:/usr/share/kibana/data
environment:
- SERVERNAME=kibana
- ELASTICSEARCH_HOSTS=${ES_URL}:${ES_REQUESTS_PORT}
- ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
- ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES=config/certs/ca/ca.crt
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:${KIBANA_PORT} | grep -q 'HTTP/1.1 302 Found'",
]
interval: 10s
timeout: 10s
retries: 120
env_file:
- .env
db:
image: bitnami/postgresql:15.3.0
volumes:
- postgres_data:/var/lib/postgresql/data/
ports:
- ${POSTGRESQL_PORT}:${POSTGRESQL_PORT}
restart: always
environment:
- POSTGRESQL_DATABASE
- POSTGRESQL_USERNAME
- POSTGRESQL_PASSWORD
- POSTGRESQL_POSTGRES_PASSWORD
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d ${POSTGRESQL_DATABASE} -U ${POSTGRESQL_USERNAME} | grep -q 'accepting connections'"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: "bitnami/redis:7.0.12"
container_name: redis
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- ${REDIS_PORT}:${REDIS_PORT}
restart: always
worker_pr:
depends_on:
redis:
condition: service_started
elasticsearch:
condition: service_healthy
build:
context: ./backend
dockerfile: backend.dockerfile
container_name: worker_pr
volumes:
- ./backend:/app
command: "celery -A app.celery:celery_app worker -Q pr_queue -c 1 --loglevel=info"
env_file:
- .env
restart: always
worker_commit:
depends_on:
redis:
condition: service_started
elasticsearch:
condition: service_healthy
build:
context: ./backend
dockerfile: backend.dockerfile
container_name: worker_commit
volumes:
- ./backend:/app
command: "celery -A app.celery:celery_app worker -Q commit_queue -c 1 --loglevel=info"
env_file:
- .env
restart: always
worker_sync:
depends_on:
redis:
condition: service_started
elasticsearch:
condition: service_healthy
build:
context: ./backend
dockerfile: backend.dockerfile
container_name: worker_sync
volumes:
- ./backend:/app
command: "celery -A app.celery:celery_app worker -Q sync_queue -c 1 --loglevel=info"
env_file:
- .env
restart: always
nginx:
image: bitnami/nginx
container_name: nginx
volumes:
- ./bilara_server_block.conf:/opt/bitnami/nginx/conf/server_blocks/bilara_server_block.conf:ro
- ./logs/nginx/:/var/logs/nginx
- ./frontend:/var/www/html
- certs:/certs
- ./scripts/generate_nginx_certs.sh:/scripts/generate_nginx_certs.sh
ports:
- 9080:80
- ${DOCKER_BACKEND_PORT}:443
entrypoint: ["/bin/bash", "/scripts/generate_nginx_certs.sh"]
healthcheck:
test: ["CMD-SHELL", "test -f /certs/key.pem && test -f /certs/cert.pem"]
interval: 1s
timeout: 5s
retries: 60
restart: unless-stopped
volumes:
certs:
driver: local
elasticsearch_data:
driver: local
kibana_data:
driver: local
postgres_data:
driver: local