-
Notifications
You must be signed in to change notification settings - Fork 1
/
prod.compose.yml
186 lines (171 loc) · 4.98 KB
/
prod.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
version: "3"
services:
# API Gateway #
traefik:
image: traefik:v2.10
restart: unless-stopped
command: --api.insecure=true --providers.docker
ports:
- "8001:80"
- "8002:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- video-sharing-platform
# User Service #
user-management:
restart: unless-stopped
build:
context: ./user-management
dockerfile: Dockerfile
depends_on:
- user-db
- traefik
labels:
- "traefik.http.routers.user-management.rule=(PathPrefix(`/users`) || PathPrefix(`/auth`))"
networks:
- video-sharing-platform
env_file:
- ./user-management/.env.docker
user-db:
image: postgres:15-alpine
restart: unless-stopped
environment:
POSTGRES_USER: devdocker
POSTGRES_PASSWORD: dbpassword
POSTGRES_DB: user-docker-db
networks:
- video-sharing-platform
volumes:
- user-data:/var/lib/postgresql/data
# --- END --- #
# Media Service #
media-handler:
restart: always
build:
context: ./media-handler
dockerfile: Dockerfile
depends_on:
- media-db
- media-cache
- traefik
labels:
- "traefik.http.routers.media-handler.rule=PathPrefix(`/media`)"
- "traefik.http.routers.media-handler.middlewares=user-auth"
- "traefik.http.middlewares.user-auth.forwardauth.address=http://traefik/auth/verify_token"
- "traefik.http.middlewares.user-auth.forwardauth.authResponseHeadersRegex=^X-Auth-" # Copy Headers starting with X-Auth-
networks:
- video-sharing-platform
env_file:
- ./media-handler/.env.docker
media-cache:
image: redis:7-alpine
networks:
- video-sharing-platform
media-db:
image: mongo:latest
restart: unless-stopped
networks:
- video-sharing-platform
volumes:
- media-data:/data/db
# --- END --- #
# Video Processing Service #
video-service:
restart: unless-stopped
build:
context: ./video-processing
dockerfile: Dockerfile
depends_on:
- video-bucket
- video-redis
networks:
- video-sharing-platform
env_file:
- ./video-processing/.env.docker
video-redis:
image: redis:7-alpine
restart: unless-stopped
networks:
- video-sharing-platform
video-bucket:
build:
context: ./video-processing
dockerfile: bucket.dockerfile
command: server /data/
# --console-address :9001
restart: unless-stopped
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
# For Proxy
MINIO_SERVER_URL: https://videosite.ddns.net
# MINIO_BROWSER_REDIRECT_URL: https://videosite.ddns.net
MINIO_NOTIFY_AMQP_ENABLE_PRIMARY: "on"
MINIO_NOTIFY_AMQP_DURABLE_PRIMARY: "on"
MINIO_NOTIFY_AMQP_URL_PRIMARY: "amqp://guest:guest@events-queue:5672"
MINIO_NOTIFY_AMQP_EXCHANGE_PRIMARY: "uploadevents"
MINIO_NOTIFY_AMQP_ROUTING_KEY_PRIMARY: "uploadlogs"
MINIO_NOTIFY_AMQP_EXCHANGE_TYPE_PRIMARY: "direct"
depends_on:
- events-queue
ports:
# - "8003:9001" # Web Interface
- "9000:9000" # For s3 access
networks:
- video-sharing-platform
labels:
- "traefik.http.routers.video-bucket.rule=PathPrefix(`/bucket`)"
- "traefik.http.routers.video-bucket.middlewares=path-rewrite"
- "traefik.http.middlewares.path-rewrite.replacepathregex.regex=^/bucket(.*)$$"
- "traefik.http.middlewares.path-rewrite.replacepathregex.replacement=$${1}"
volumes:
- video-bucket-volume:/data
# --- END --- #
bucket-initialize:
image: minio/mc
depends_on:
- video-bucket
# FIXME (SECURITY!): `download` access allows listing of bucket contents
entrypoint: >
/bin/bash -c "
sleep 15;
/usr/bin/mc config host add miniobucket http://video-bucket:9000 minioadmin minioadmin;
/usr/bin/mc mb miniobucket/{images,misc,video-bucket,transcoded-bucket};
/usr/bin/mc anonymous set download miniobucket/images;
/usr/bin/mc anonymous set download miniobucket/misc;
/usr/bin/mc anonymous set download miniobucket/video-bucket;
/usr/bin/mc anonymous set download miniobucket/transcoded-bucket;
/usr/bin/mc event add miniobucket/video-bucket arn:minio:sqs::PRIMARY:amqp --event put;
exit 0;
"
networks:
- video-sharing-platform
# --- END --- #
# Events Queue #
events-queue:
image: rabbitmq:3.13-alpine
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
networks:
- video-sharing-platform
# S3 Service
s3-service:
build:
context: ./s3-service
dockerfile: dev.dockerfile
depends_on:
- traefik
env_file: ./s3-service/.env.docker
labels:
- "traefik.http.routers.video-service.rule=PathPrefix(`/assets`)"
networks:
- video-sharing-platform
# --- END --- #
networks:
video-sharing-platform:
volumes:
user-data:
media-data:
video-bucket-volume: