-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
127 lines (117 loc) · 4 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
version: '3'
services:
# Postgres - Primary Source of truth
postgres:
container_name: postgres
image: 'postgres:latest'
environment:
POSTGRES_DB: youtube
POSTGRES_USER: saurabh
POSTGRES_PASSWORD: super_secret_password
# postgres exposed for connecting pg-admin or other tools to db.
ports:
- 5432:5432
# Elastic Search - Additional index over primary SQL datastore to make search efficient and faster
# Apart from the the service writing data from Google API, all micro services interact with elastic
# as its easliy scalable by increasing nodes and shards in the cluster.
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
volumes:
- elastic-data:/usr/share/elasticsearch/data
environment:
- discovery.type=single-node
ports:
- 9300:9300
- 9200:9200
# logstash - automatically syncs data from postgres to elastic
logstash:
image: docker.elastic.co/logstash/logstash:7.3.1
container_name: logstash
volumes:
- ./logstash/pusher.conf:/usr/share/logstash/config/pusher.conf:ro
- ./logstash/logstash.yml:/usr/share/logstash/config/logstash.yml
- ./logstash/jdbc/postgresql-42.2.6.jar:/usr/share/logstash/logstash-core/lib/jars/postgresql-42.2.6.jar:ro
ports:
- '5044:5044'
- '9600:9600'
command: bash -c "/usr/share/logstash/bin/logstash-plugin install logstash-input-jdbc && logstash -f /usr/share/logstash/config/pusher.conf"
depends_on:
- elasticsearch
# kibana - interface for directly interacting with elastic to debugging and testing - its to elastic, what pgAdmin is to postgres
kibana:
image: kibana:7.14.0
environment:
SERVER_NAME: kibana
ELASTICSEARCH_URL: http://elasticsearch:9200
ports:
- 5601:5601
# nginx - routes requests to appropriate microservices depending upon endpoint and serves static assets
nginx:
restart: always
build:
dockerfile: Dockerfile.dev
context: ./nginx
ports:
- '3050:80'
# dashboard micro service - interacts with elastic and returns paginated response for latest entries
dashboard-service:
container_name: dashboard-service
build:
dockerfile: Dockerfile.dev
context: ./dashboard-service
volumes:
- /app/node_modules
- ./dashboard-service:/app
environment:
ELASTIC_HOST: elasticsearch
ELASTIC_PORT: '9200'
depends_on:
- elasticsearch
# Search micro service - interacts with elastic and searches for the a search term, retusn reponses in a paginated form
search-service:
container_name: search-service
environment:
ELASTIC_HOST: elasticsearch
ELASTIC_PORT: '9200'
build:
dockerfile: Dockerfile.dev
context: ./search-service
volumes:
- /app/node_modules
- ./search-service:/app
# Update Datastore micro service - interacts with google api and bulk writes results into postgres
update-datastore-service:
container_name: update-datastore-service
build:
dockerfile: Dockerfile.dev
context: ./update-datastore-service
environment:
PGUSER: saurabh
PGHOST: postgres
PGDATABASE: youtube
PGPASSWORD: super_secret_password
PGPORT: 5432
SEARCH_TERM: cricket
# API Keys Encoded
GOOGLE_API_KEYS: >
QUl6YVN5Q1kwQ1hBN2NDMUMxNzcwbHh5eWtadGpGbmpwNloxMlo0
QUl6YVN5QmhKWUdVT2NONk43N3ZXZS1OSDBJYWxIa2RXOWNwNzhv
QUl6YVN5Qlc3bHlNTzBCUUFFVXE0ekZ5X2VYU1cybko3a1l4WUFj
SEED_COUNT: '1000'
# interval in number of seconds to get data from the API
UPDATE_FREQUENCY: '50'
volumes:
- /app/node_modules
- ./update-datastore-service:/app
# Sample React Application for Dashboard
client:
container_name: client
build:
dockerfile: Dockerfile
context: ./client
volumes:
- /app/node_modules
- ./client:/app
volumes:
elastic-data: