forked from NTHU-LSALAB/NTHU-Distributed-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
191 lines (172 loc) · 4.08 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
version: '3.9'
x-common-env: &common-env
GOPATH: /go
GOCACHE: /src/.cache/gocache
MONGO_URL: mongodb://mongo:27017/
MONGO_DATABASE: nthu_distributed_system
POSTGRES_URL: postgres://postgres@postgres:5432/postgres?sslmode=disable
REDIS_ADDR: redis:6379
KAFKA_PRODUCER_ADDRS: kafka:29092
KAFKA_PRODUCER_TOPIC: video
KAFKA_CONSUMER_ADDRS: kafka:29092
KAFKA_CONSUMER_TOPIC: video
KAFKA_CONSUMER_GROUP: video-stream
MINIO_ENDPOINT: play.min.io
MINIO_BUCKET: videos
MINIO_USERNAME: Q3AM3UQ867SPQQA43P2F
MINIO_PASSWORD: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
x-common-build: &common-build
image: justin0u0/golang-protoc:protoc-3.19.3-golang-1.17
working_dir: /src
environment:
<<: *common-env
volumes:
- .:/src
- ~/go/pkg/mod/cache:/go/pkg/mod/cache
services:
mongo:
image: mongo:5
postgres:
image: postgres:14-alpine
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
redis:
image: redis:6.2-alpine
zookeeper:
image: confluentinc/cp-zookeeper:7.0.1
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:7.0.1
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:29092
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
ports:
- 9092:9092
depends_on:
- zookeeper
prometheus:
image: prom/prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
generate:
<<: *common-build
command:
- make
- generate
lint:
image: golangci/golangci-lint:v1.44.2
working_dir: /src
environment:
GOLANGCI_LINT_CACHE: /src/.cache/golangci-lint-cache
volumes:
- .:/src
command:
- make
- lint
test:
<<: *common-build
command:
- make
- test
depends_on:
- mongo
- redis
- postgres
build:
<<: *common-build
command:
- make
- build
image:
image: nthu-distributed-system:latest
build:
context: .
environment:
<<: *common-env
video-api:
image: nthu-distributed-system:latest
environment:
<<: *common-env
COMMENT_SERVER_ADDR: comment-api:8081
METER_NAME: video.api
METER_HISTOGRAM_BOUNDARIES: "10,100,200,500,1000"
command:
- /cmd
- video
- api
depends_on:
- mongo
- redis
- kafka
video-gateway:
image: nthu-distributed-system:latest
environment:
<<: *common-env
GRPC_SERVER_ADDR: video-api:8081
command:
- /cmd
- video
- gateway
ports:
- 10080:8080
video-stream:
image: nthu-distributed-system:latest
environment:
<<: *common-env
command:
- /cmd
- video
- stream
depends_on:
- mongo
- kafka
comment-api:
image: nthu-distributed-system:latest
environment:
<<: *common-env
VIDEO_SERVER_ADDR: video-api:8081
METER_NAME: comment.api
METER_HISTOGRAM_BOUNDARIES: "10,100,200,500,1000"
command:
- /cmd
- comment
- api
depends_on:
- postgres
- redis
comment-gateway:
image: nthu-distributed-system:latest
environment:
<<: *common-env
GRPC_SERVER_ADDR: comment-api:8081
command:
- /cmd
- comment
- gateway
ports:
- 10081:8080
comment-migration:
image: nthu-distributed-system:latest
environment:
MIGRATION_SOURCE: file:///static/modules/comment/migration
MIGRATION_URL: postgres://postgres@postgres:5432/postgres?sslmode=disable
command:
- /cmd
- comment
- migration
depends_on:
- postgres