-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.prod.yml
181 lines (171 loc) · 5.04 KB
/
docker-compose.prod.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
version: '3.7'
services:
flask_api:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/flask-api
build:
context: ./services/flask
# container_name: flask_api # Do not use when in a swarm; cannot scale a service beyond 1 container if you have specified a custom name
volumes:
- ./services/flask/:/usr/src/app/
ports:
- "5000:5000"
env_file:
- env.prod
environment:
- MODE=${MODE}
- AUTH_TOKEN=${AUTH_TOKEN}
- MONGO_HOST=${MONGO_HOST}
- MONGO_PORT=${MONGO_PORT}
- MONGO_INITDB_DATABASE=${MONGO_INITDB_DATABASE}
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- DATABASE_USERNAME=${DATABASE_USERNAME}
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
- ELASTICSEARCH_HOST=${ELASTICSEARCH_HOST}
- ELASTIC_USERNAME=${ELASTIC_USERNAME}
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
depends_on:
- mongodb
- elasticsearch
networks:
- frontend
- backend
mongodb:
image: mongo:4.4
volumes:
- mongodb_data:/data/db
expose:
- "27017"
env_file:
- env.prod
environment:
- MONGO_HOST=${MONGO_HOST}
- MONGO_PORT=${MONGO_PORT}
- MONGO_INITDB_DATABASE=${MONGO_INITDB_DATABASE}
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- DATABASE_USERNAME=${DATABASE_USERNAME}
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
networks:
- backend
mongo_express:
image: mongo-express
ports:
- "8085:8081"
env_file:
- env.prod
environment:
- ME_CONFIG_BASICAUTH_USERNAME=${DATABASE_USERNAME}
- ME_CONFIG_BASICAUTH_PASSWORD=${DATABASE_PASSWORD}
- ME_CONFIG_MONGODB_SERVER=${MONGO_HOST}
- ME_CONFIG_MONGODB_PORT=${MONGO_PORT}
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_INITDB_ROOT_USERNAME}
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
depends_on:
- mongodb
networks:
- backend
nginx:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/nginx
build:
context: ./services/nginx
ports:
- "80:80"
- "443:443"
depends_on:
- flask_api
networks:
- frontend
- backend
elasticsearch:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/elasticsearch
build:
context: elasticsearch/
args:
ELK_VERSION: ${ELK_VERSION}
env_file:
- env.prod
environment:
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
ELASTIC_CLUSTER_NAME: ${ELASTIC_CLUSTER_NAME}
ELASTIC_NODE_NAME: ${ELASTIC_NODE_NAME}
ELASTIC_INIT_MASTER_NODE: ${ELASTIC_INIT_MASTER_NODE}
ELASTIC_DISCOVERY_SEEDS: ${ELASTIC_DISCOVERY_SEEDS}
ES_JAVA_OPTS: -Xmx${ELASTICSEARCH_HEAP} -Xms${ELASTICSEARCH_HEAP}
bootstrap.memory_lock: "true"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 200000
hard: 200000
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
secrets:
- source: elasticsearch.keystore
target: /usr/share/elasticsearch/config/elasticsearch.keystore
- source: elastic.certificates
target: /usr/share/elasticsearch/config/certs/elastic-certificates.p12
expose:
- "9200"
- "9300"
networks:
- backend
kibana:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/kibana
build:
context: kibana/
args:
ELK_VERSION: ${ELK_VERSION}
ports:
- 5605:5601
depends_on:
- elasticsearch
env_file:
- env.prod
environment:
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
ELASTICSEARCH_HOST_PORT: ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
volumes:
- ./kibana/config/:/usr/share/kibana/config:ro
networks:
- backend
logstash:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/logstash
build:
context: logstash/
args:
ELK_VERSION: ${ELK_VERSION}
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:ro
depends_on:
- elasticsearch
env_file:
- env.prod
environment:
ELASTIC_USERNAME: ${ELASTIC_USERNAME}
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
ELASTICSEARCH_HOST_PORT: ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}
LS_JAVA_OPTS: "-Xmx${LOGSTASH_HEAP} -Xms${LOGSTASH_HEAP}"
networks:
- backend
networks:
frontend:
driver: bridge
backend:
driver: bridge
volumes:
elasticsearch-data:
driver: local
mongodb_data:
driver: local
secrets:
elasticsearch.keystore:
file: ./secrets/elasticsearch.keystore
elastic.certificates:
file: ./secrets/elastic-certificates.p12