-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
368 lines (296 loc) · 12.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
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# ex: set tabstop=8 softtabstop=0 expandtab shiftwidth=2 smarttab:
---
services:
### Use for testing with CockroachDB, but currently blocked by bug
### Source: https://help.nextcloud.com/t/any-luck-using-cockroachdb-with-nextcloud-in-docker/143409/2?u=dvaerum
### Issue Tracker: https://github.com/cockroachdb/cockroach/issues/94897
# db:
# image: cockroachdb/cockroach:latest
# command: >-
# start-single-node
# --sql-addr :5432
# --insecure
# --vmodule=exec_log=2
# # entrypoint: "bash -x cockroach.sh start-single-node --sql-addr :5432"
# restart: always
# volumes:
# - ./extra-files/cockroachdb/init-scripts:/docker-entrypoint-initdb.d
# - database_data:/cockroach/cockroach-data
# environment:
# COCKROACH_DATABASE: "${MYSQL_DATABASE}"
# COCKROACH_USER: "${MYSQL_USER}"
# COCKROACH_PASSWORD: "${MYSQL_PASSWORD}"
db:
image: postgres:${DATABASE_POSTGRESQL_VERSION}
command: -c 'max_connections=200'
restart: always
volumes:
- ./extra-files/postgresql/init-scripts:/docker-entrypoint-initdb.d
- database_postgresql:/var/lib/postgresql/data
environment:
POSTGRES_DB: "postgres"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "${DATABASE_ROOT_PASSWORD}"
POSTGRES_NEXTCLOUD_DB: "${DATABASE_NAME}"
POSTGRES_NEXTCLOUD_USER: "${DATABASE_USER}"
POSTGRES_NEXTCLOUD_PASSWORD: "${DATABASE_PASSWORD}"
PGDATA: "/var/lib/postgresql/data/${DATABASE_POSTGRESQL_VERSION}"
# db:
# image: mariadb:latest
# command: >-
# --transaction-isolation=READ-COMMITTED
# --binlog-format=ROW
# --innodb-file-per-table=1
# --skip-innodb-read-only-compressed
# --skip-name-resolve
# restart: always
#
# volumes:
# - database_mysql:/var/lib/mysql
#
# environment:
# MYSQL_DATABASE: "${DATABASE_NAME}"
# MYSQL_USER: "${DATABASE_USER}"
# MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
# MYSQL_ROOT_PASSWORD: "${DATABASE_ROOT_PASSWORD}"
redis:
image: redis
restart: always
command: redis-server --requirepass "${REDIS_HOST_PASSWORD}"
app:
build: &service_app_build
context: ./build/app
args:
IMAGE_TAG: "${NEXTCLOUD_VERSION}-${NEXTCLOUD_BRANCH}"
XDEBUG_MODE: "${XDEBUG_MODE:-off}"
# entrypoint: /bin/sh -x /entrypoint.sh php-fpm
restart: always
volumes: &service_app_volumes
- ./extra-files/nextcloud/post-installation:/docker-entrypoint-hooks.d/post-installation
- ./extra-files/nextcloud/post-upgrade:/docker-entrypoint-hooks.d/post-upgrade
- ./extra-files/nextcloud/before-starting:/docker-entrypoint-hooks.d/before-starting
- nextcloud:/var/www/html
- nextcloud_apps:/var/www/html/custom_apps
- nextcloud_config:/var/www/html/config
- nextcloud_data:/var/www/html/data
environment: &service_app_environment
### For using with PostgreSQL
POSTGRES_HOST: db
POSTGRES_DB: "${DATABASE_NAME}"
POSTGRES_USER: "${DATABASE_USER}"
POSTGRES_PASSWORD: "${DATABASE_PASSWORD}"
### For using with MySQL/MariaDB
# MYSQL_HOST: db
# MYSQL_DATABASE: "${DATABASE_NAME}"
# MYSQL_USER: "${DATABASE_USER}"
# MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
REDIS_HOST: redis
REDIS_HOST_POST: 6379
REDIS_HOST_PASSWORD: "${REDIS_HOST_PASSWORD}"
NEXTCLOUD_ADMIN_USER: "${NEXTCLOUD_ADMIN_USERNAME}"
NEXTCLOUD_ADMIN_PASSWORD: "${NEXTCLOUD_ADMIN_PASSWORD}"
NEXTCLOUD_TRUSTED_DOMAINS: "${NEXTCLOUD_TRUSTED_DOMAINS}"
TRUSTED_PROXIES: "${NEXTCLOUD_TRUSTED_PROXIES}"
NC_default_phone_region: "${NC_DEFAULT_PHONE_REGION}"
NC_default_locale: "${NC_DEFAULT_LOCALE}"
NC_query_log_file: "${NC_QUERY_LOG_FILE:-}"
DOMAIN_NEXTCLOUD: "${DOMAIN_NEXTCLOUD:-}"
DOMAIN_COLLABORA: "${DOMAIN_COLLABORA:-}"
DOMAIN_ONLYOFFICE: "${DOMAIN_ONLYOFFICE:-}"
depends_on:
- db
- redis
app-inner-services:
build: *service_app_build
user: www-data
entrypoint:
- "/usr/bin/env"
- "bash"
- "-c"
- >-
epoch=$$(date +%s);
touch_file_scan_path=files-scan-all.touch;
touch_preview_generate_path=preview-generate-all.touch;
if [[ ! -f $$touch_file_scan_path ]] || [[ $$(( $$epoch - 3600 * 24 * 6 )) -gt $$(stat --format=%Y $$touch_file_scan_path) ]]; then
php occ files:scan --all && touch $$touch_file_scan_path;
fi;
if [[ ! -f $$touch_preview_generate_path ]] || [[ $$(( $$epoch - 3600 * 24 * 6 )) -gt $$(stat --format=%Y $$touch_preview_generate_path) ]]; then
php occ preview:generate-all && touch $$touch_preview_generate_path;
fi;
while sleep 180; do
php cron.php;
php occ preview:pre-generate;
done;
restart: always
volumes: *service_app_volumes
environment: *service_app_environment
depends_on:
- app
app-nginx:
build:
context: ./build/nginx
dockerfile: Containerfile
restart: always
networks:
default:
aliases:
- "${DOMAIN_NEXTCLOUD}"
volumes:
- nextcloud:/var/www/html
- nextcloud_apps:/var/www/html/custom_apps
- nextcloud_config:/var/www/html/config
- nextcloud_data:/var/www/html/data
depends_on:
- app
### NOTES for labels: ###
# These labels are used to configure the container Traefik (https://doc.traefik.io/traefik/).
# Traefik is used as our LB (Load Balander) for handling incoming connection and forward them
# to the correct containers.
labels:
# Enable this container to be load balancered by Traefik
- "traefik.enable=true"
# Create middleware for redirect all HTTP connections to HTTPS
- "traefik.http.middlewares.nextcloud_redirect_http2https.redirectscheme.scheme=https"
# Make the redirect permanent
- "traefik.http.middlewares.nextcloud_redirect_http2https.redirectscheme.permanent=true"
# Select the endpoint from Traefik which is used for incoming connection.
# Normally the endpoint `web` is going to be on port 80 (HTTP).
- "traefik.http.routers.nextcloud_http.entrypoints=web"
# List of all the domains there will forwarded to this container
- "traefik.http.routers.nextcloud_http.rule=Host(`${DOMAIN_NEXTCLOUD}`)"
# Select the middleware from Traefik which is used for incoming connection.
- "traefik.http.routers.nextcloud_http.middlewares=nextcloud_redirect_http2https"
# Create middleware to replace the path for well-known requests
- "traefik.http.middlewares.nextcloud_known_dav.replacepathregex.regex=^/.well-known/(cal|card)dav"
- "traefik.http.middlewares.nextcloud_known_dav.replacepathregex.replacement=/remote.php/dav/"
- "traefik.http.middlewares.nextcloud_known_others.replacepathregex.regex=^/.well-known/(webfinger|nodeinfo)"
- "traefik.http.middlewares.nextcloud_known_others.replacepathregex.replacement=/index.php/.well-known/$$1"
# Select the endpoint from Traefik which is used for incoming connection.
# Normally the endpoint `websecure` is going to be on port 443 (HTTPS).
- "traefik.http.routers.nextcloud_https.entrypoints=websecure"
# List of all the domains there will forwarded to this container
- "traefik.http.routers.nextcloud_https.rule=Host(`${DOMAIN_NEXTCLOUD}`)"
# Get SSL/TLS certificate from Let's Encrypt by resolving the HTTPS challenge.
- "traefik.http.routers.nextcloud_https.tls.certresolver=http_challenge_resolver"
# In order to select which port on this container the connections from Traefik should be farwarded to,
# there needs to be defined a service.
# This service defineds that we load balancer should farward connections to port 80
- "traefik.http.services.nextcloud_https.loadbalancer.server.port=80"
# Select the middleware from Traefik which is used for incoming connection.
- "traefik.http.routers.nextcloud_https.middlewares=nextcloud_known_dav,nextcloud_known_others"
onlyoffice:
### READ The onlyoffice/Dockerfile for more info!
build: ./build/onlyoffice
restart: always
stdin_open: true
tty: true
networks:
default:
aliases:
- "${DOMAIN_ONLYOFFICE}"
environment:
JWT_ENABLED: "false"
volumes:
- onlyoffice_data:/var/www/onlyoffice/Data
- onlyoffice_log:/var/log/onlyoffice
### NOTES for labels:
# These labels are used to configure the container Traefik (https://doc.traefik.io/traefik/).
# Traefik is used as our LB (Load Balander) for handling incoming connection and forward them
# to the correct containers.
labels:
# Enable this container to be load balancered by Traefik
- "traefik.enable=true"
# Create middleware for redirect all HTTP connections to HTTPS
- "traefik.http.middlewares.onlyoffice_redirect_http2https.redirectscheme.scheme=https"
# Make the redirect permanent
- "traefik.http.middlewares.onlyoffice_redirect_http2https.redirectscheme.permanent=true"
# Select the endpoint from Traefik which is used for incoming connection.
# Normally the endpoint `web` is going to be on port 80 (HTTP).
- "traefik.http.routers.onlyoffice_http.entrypoints=web"
# List of all the domains there will forwarded to this container
- "traefik.http.routers.onlyoffice_http.rule=Host(`${DOMAIN_ONLYOFFICE}`)"
# Select the middleware from Traefik which is used for incoming connection.
- "traefik.http.routers.onlyoffice_http.middlewares=onlyoffice_redirect_http2https"
# Select the endpoint from Traefik which is used for incoming connection.
# Normally the endpoint `websecure` is going to be on port 443 (HTTPS).
- "traefik.http.routers.onlyoffice_https.entrypoints=websecure"
# List of all the domains there will forwarded to this container
- "traefik.http.routers.onlyoffice_https.rule=Host(`${DOMAIN_ONLYOFFICE}`)"
# Workaround a bug in OnlyOffice, see the issue tracker: https://github.com/ONLYOFFICE/DocumentServer/issues/2186
- "traefik.http.middlewares.onlyoffice_redirect_http2https_header.headers.contentSecurityPolicy=upgrade-insecure-requests"
- "traefik.http.routers.onlyoffice_https.middlewares=onlyoffice_redirect_http2https_header"
# Get SSL/TLS certificate from Let's Encrypt by resolving the HTTPS challenge.
- "traefik.http.routers.onlyoffice_https.tls.certresolver=http_challenge_resolver"
# In order to select which port on this container the connections from Traefik should be farwarded to,
# there needs to be defined a service.
# This service defineds that we load balancer should farward connections to port 80
- "traefik.http.services.onlyoffice_https.loadbalancer.server.port=80"
elasticsearch:
image: elasticsearch:${ELASTIC_SEARCH_VERSION}
# build:
# context: ./build/elasticsearch
# args:
# IMAGE_TAG: "${ELASTIC_SEARCH_VERSION}"
restart: always
environment:
discovery.type: single-node
xpack.security.enabled: "false"
xpack.security.transport.ssl.enabled: "false"
ES_JAVA_OPTS: "${ELASTIC_JAVA_OPTS:-}"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
volumes:
nextcloud:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/nextcloud"
nextcloud_apps:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/nextcloud_apps"
nextcloud_config:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/nextcloud_config"
nextcloud_data:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/nextcloud_data"
# database_mysql:
# driver: local
# driver_opts:
# o: bind
# type: none
# device: "${DATA_PATH:-./data}/database_data/mysql"
database_postgresql:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/database_data/postgresql"
onlyoffice_data:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/onlyoffice_data"
onlyoffice_log:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/onlyoffice_log"
elasticsearch_data:
driver: local
driver_opts:
o: bind
type: none
device: "${DATA_PATH:-./data}/elasticsearch_data"