-
Notifications
You must be signed in to change notification settings - Fork 972
/
docker-compose.yml
255 lines (247 loc) · 7.24 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
version: '3.9'
services:
avideo:
build:
context: .
args:
SOCKET_PORT: ${SOCKET_PORT}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DB_MYSQL_HOST: ${DB_MYSQL_HOST}
DB_MYSQL_PORT: ${DB_MYSQL_PORT}
DB_MYSQL_NAME: ${DB_MYSQL_NAME}
DB_MYSQL_USER: ${DB_MYSQL_USER}
DB_MYSQL_PASSWORD: ${DB_MYSQL_PASSWORD}
SERVER_NAME: ${SERVER_NAME}
ENABLE_PHPMYADMIN: ${ENABLE_PHPMYADMIN}
PHPMYADMIN_PORT: ${PHPMYADMIN_PORT}
PHPMYADMIN_ENCODER_PORT: ${PHPMYADMIN_ENCODER_PORT}
CREATE_TLS_CERTIFICATE: ${CREATE_TLS_CERTIFICATE}
TLS_CERTIFICATE_FILE: ${TLS_CERTIFICATE_FILE}
TLS_CERTIFICATE_KEY: ${TLS_CERTIFICATE_KEY}
CONTACT_EMAIL: ${CONTACT_EMAIL}
SYSTEM_ADMIN_PASSWORD: ${SYSTEM_ADMIN_PASSWORD}
WEBSITE_TITLE: ${WEBSITE_TITLE}
MAIN_LANGUAGE: ${MAIN_LANGUAGE}
restart: "unless-stopped"
environment:
SOCKET_PORT: ${SOCKET_PORT:-2053}
HTTP_PORT: ${HTTP_PORT:-80}
HTTPS_PORT: ${HTTPS_PORT:-443}
DB_MYSQL_HOST: "${DB_MYSQL_HOST:-database}"
DB_MYSQL_PORT: ${DB_MYSQL_PORT:-3306}
DB_MYSQL_NAME: "${DB_MYSQL_NAME:-avideo}"
DB_MYSQL_USER: "${DB_MYSQL_USER:-avideo}"
DB_MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD:-avideo}"
SERVER_NAME: "${SERVER_NAME:-localhost}"
ENABLE_PHPMYADMIN: "${ENABLE_PHPMYADMIN:-yes}"
PHPMYADMIN_PORT: ${PHPMYADMIN_PORT:-8081}
PHPMYADMIN_ENCODER_PORT: ${PHPMYADMIN_ENCODER_PORT:-8082}
CREATE_TLS_CERTIFICATE: "${CREATE_TLS_CERTIFICATE:-yes}"
TLS_CERTIFICATE_FILE: "${TLS_CERTIFICATE_FILE:-/etc/apache2/ssl/localhost.crt}"
TLS_CERTIFICATE_KEY: "${TLS_CERTIFICATE_KEY:-/etc/apache2/ssl/localhost.key}"
CONTACT_EMAIL: "${CONTACT_EMAIL:-admin@localhost}"
SYSTEM_ADMIN_PASSWORD: "${SYSTEM_ADMIN_PASSWORD:-password}"
WEBSITE_TITLE: "${WEBSITE_TITLE:-AVideo}"
MAIN_LANGUAGE: "${MAIN_LANGUAGE:-en_US}"
NGINX_RTMP_PORT: "${NGINX_RTMP_PORT:-1935}"
NGINX_HTTP_PORT: "${NGINX_HTTP_PORT:-8080}"
NGINX_HTTPS_PORT: "${NGINX_HTTPS_PORT:-8443}"
MEMCACHED_HOST: memcached
env_file:
- .env
ports:
- "${SOCKET_PORT:-2053}:${SOCKET_PORT:-2053}"
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- "./.compose/HLS:/HLS"
- "./:/var/www/html/AVideo"
- "./.compose/videos:/var/www/html/AVideo/videos"
- "./.compose/encoder:/var/www/html/AVideo/Encoder"
- "./.compose/letsencrypt:/etc/letsencrypt/"
depends_on:
database:
condition: service_healthy
database_encoder:
condition: service_healthy
memcached:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail http://localhost || exit 1"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: "${CPUS_LIMIT:-3}"
memory: "${MEMORY_LIMIT:-8G}"
reservations:
cpus: "${CPUS_LIMIT:-1}"
memory: "${MEMORY_LIMIT:-2G}"
networks:
- app_net
live:
build:
context: .
dockerfile: Dockerfile.live
restart: "unless-stopped"
volumes:
- "./.compose/HLS:/HLS"
- "./.compose/letsencrypt:/etc/letsencrypt/"
environment:
SERVER_NAME: "${SERVER_NAME:-localhost}"
CREATE_TLS_CERTIFICATE: "${CREATE_TLS_CERTIFICATE:-yes}"
TLS_CERTIFICATE_FILE: "${TLS_CERTIFICATE_FILE:-/etc/apache2/ssl/localhost.crt}"
TLS_CERTIFICATE_KEY: "${TLS_CERTIFICATE_KEY:-/etc/apache2/ssl/localhost.key}"
NGINX_RTMP_PORT: "${NGINX_RTMP_PORT:-1935}"
NGINX_HTTP_PORT: "${NGINX_HTTP_PORT:-8080}"
NGINX_HTTPS_PORT: "${NGINX_HTTPS_PORT:-8443}"
MEMCACHED_HOST: memcached
env_file:
- .env
ports:
- "${NGINX_RTMP_PORT:-1935}:1935"
- "${NGINX_HTTP_PORT:-8080}:8080"
- "${NGINX_HTTPS_PORT:-8443}:8443"
depends_on:
avideo:
condition: service_healthy
database:
condition: service_healthy
memcached:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail http://localhost:8080 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: "2"
memory: "4G"
reservations:
cpus: "1"
memory: "2G"
networks:
- app_net
database:
build:
context: .
dockerfile: Dockerfile.mariadb
restart: "unless-stopped"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_INITDB_SKIP_TZINFO: 1
MYSQL_DATABASE: "${DB_MYSQL_NAME}"
MYSQL_USER: "${DB_MYSQL_USER}"
MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD}"
volumes:
- ./.compose/db:/var/lib/mysql
healthcheck:
test: "mariadb-admin ping -h localhost -u $DB_MYSQL_USER -p$DB_MYSQL_PASSWORD"
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: "2"
memory: "10G"
reservations:
cpus: '1'
memory: '4G'
networks:
- app_net
database_encoder:
build:
context: .
dockerfile: Dockerfile.mariadb
restart: "unless-stopped"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_INITDB_SKIP_TZINFO: 1
MYSQL_DATABASE: "${DB_MYSQL_NAME}_encoder"
MYSQL_USER: "${DB_MYSQL_USER}"
MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD}"
volumes:
- ./.compose/db_encoder:/var/lib/mysql
healthcheck:
test: "mariadb-admin ping -h localhost -u $DB_MYSQL_USER -p$DB_MYSQL_PASSWORD"
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: "0.5"
memory: "1G"
networks:
- app_net
phpmyadmin:
image: "phpmyadmin/phpmyadmin"
restart: "unless-stopped"
environment:
PMA_HOST: "${DB_MYSQL_HOST}"
PMA_PORT: ${DB_MYSQL_PORT}
PMA_CONTROLUSER: "${DB_MYSQL_USER}"
PMA_CONTROLPASS: "${DB_MYSQL_PASSWORD}"
HIDE_PHP_VERSION: "true"
ports:
- "${PHPMYADMIN_PORT:-8081}:80"
depends_on:
- database
deploy:
resources:
limits:
cpus: "0.25"
memory: "1G"
networks:
- app_net
phpmyadmin_encoder:
image: "phpmyadmin/phpmyadmin"
restart: "unless-stopped"
environment:
PMA_HOST: "${DB_MYSQL_HOST}_encoder"
PMA_PORT: ${DB_MYSQL_PORT}
PMA_CONTROLUSER: "${DB_MYSQL_USER}"
PMA_CONTROLPASS: "${DB_MYSQL_PASSWORD}"
HIDE_PHP_VERSION: "true"
ports:
- "${PHPMYADMIN_ENCODER_PORT:-8082}:80"
depends_on:
- database_encoder
deploy:
resources:
limits:
cpus: "0.25"
memory: "1G"
networks:
- app_net
memcached:
image: memcached:alpine
restart: "unless-stopped"
command: >
sh -c "memcached -m 128 -c 1024 -t ${NPROC:-2} -vv"
ports:
- "${MEMCACHE_PORT:-11211}:11211"
deploy:
resources:
limits:
cpus: '1'
memory: "4G"
reservations:
cpus: '0.5'
memory: '512M'
networks:
- app_net
environment:
- NPROC=${NPROC:-2}
networks:
app_net:
driver: bridge
ipam:
config:
- subnet: "${NETWORK_SUBNET:-172.21.1.0/16}"