-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
289 lines (267 loc) · 7.58 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
# Golang port of Overleaf
# Copyright (C) 2022-2024 Jakob Ackermann <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
networks:
internal:
internal: true
proxy:
internal: true
public:
services:
postgres:
image: postgres:14
networks:
- internal
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- ~/overleaf-go/pg:/var/lib/postgresql/data
- ./db:/docker-entrypoint-initdb.d
redis:
image: redis:5
networks:
- internal
volumes:
- ~/overleaf-go/redis:/data
minio:
image: minio/minio:RELEASE.2022-10-29T06-21-33Z
networks:
- internal
command: server /data
environment:
- MINIO_ROOT_PASSWORD
- MINIO_ROOT_USER
- MINIO_REGION
volumes:
- ~/overleaf-go/minio:/data
build-minio-setup:
image: golang:1.22.6
network_mode: bridge
working_dir: /go/src/cmd/minio-setup
command: go build -tags osusergo,netgo -o ${TMP_DIR}/binaries/minio-setup
volumes:
- ./:/go/src
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries
minio-setup:
depends_on:
minio:
condition: service_started
build-minio-setup:
condition: service_completed_successfully
networks:
- internal
image: debian:buster-slim
entrypoint: ${TMP_DIR}/binaries/minio-setup
environment:
- ACCESS_KEY
- BUCKET
- CLEANUP_OTHER_S3_KEYS
- MINIO_ENDPOINT
- MINIO_REGION
- MINIO_ROOT_USER
- MINIO_ROOT_PASSWORD
- MINIO_SECURE
- S3_POLICY_NAME
- S3_POLICY_CONTENT
- SECRET_KEY
volumes:
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries:ro
build-frontend-build:
image: golang:1.22.6
network_mode: bridge
working_dir: /go/src/cmd/frontend-build
command: go build -tags osusergo,netgo -o ${TMP_DIR}/binaries/frontend-build
volumes:
- ./:/go/src
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries
assets:
build: https://github.com/das7pad/overleaf-node.git#main
depends_on:
build-frontend-build:
condition: service_completed_successfully
network_mode: bridge
command:
- sh
- '-exc'
- '${TMP_DIR}/binaries/frontend-build
--dst=/tmp/public.tar.gz
--src=$(pwd)
--pre-compress=2
--watch=false
&& tar -x -f /tmp/public.tar.gz -C ${TMP_DIR}/assets'
volumes:
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries:ro
- ${TMP_DIR}/assets:${TMP_DIR}/assets
nginx:
image: nginx:1.22
depends_on:
overleaf:
condition: service_started
assets:
condition: service_completed_successfully
networks:
- internal
- public
ports:
- ${NGINX_PUBLIC_LISTEN_ADDRESS}:${NGINX_INTERNAL_PORT}
environment:
- BACKEND=overleaf:3000
- NGINX_INTERNAL_PORT
- TMP_DIR
volumes:
- ./services/nginx/default.conf:/etc/nginx/templates/default.conf.template:ro
- ./services/nginx/entrypoint.sh:/docker-entrypoint.d/99-overleaf.sh:ro
- ${TMP_DIR}/output:${TMP_DIR}/output:ro
- ${TMP_DIR}/assets:${TMP_DIR}/assets:ro
build-linked-url-proxy:
image: golang:1.22.6
network_mode: bridge
working_dir: /go/src/services/linked-url-proxy
command: go build -tags osusergo,netgo -o ${TMP_DIR}/binaries/linked-url-proxy
volumes:
- ./:/go/src
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries
linked-url-proxy:
image: debian:buster-slim
depends_on:
build-linked-url-proxy:
condition: service_completed_successfully
networks:
- proxy
- public
user: ${DOCKER_USER}
entrypoint: ${TMP_DIR}/binaries/linked-url-proxy
environment:
- LISTEN_ADDRESS=0.0.0.0
- PROXY_TOKEN
volumes:
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries:ro
build-pull-texlive-images:
image: golang:1.22.6
network_mode: bridge
working_dir: /go/src/cmd/pull-texlive-images
command: go build -tags osusergo,netgo -o ${TMP_DIR}/binaries/pull-texlive-images
volumes:
- ./:/go/src
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries
pull-texlive-images:
image: debian:buster-slim
depends_on:
build-pull-texlive-images:
condition: service_completed_successfully
network_mode: none
user: ${DOCKER_USER}
group_add:
- ${DOCKER_SOCKET_GROUP_ID}
entrypoint: ${TMP_DIR}/binaries/pull-texlive-images
environment:
- CLSI_OPTIONS
- DOCKER_HOST
volumes:
- ${DOCKER_SOCKET}:${DOCKER_SOCKET}
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries:ro
build-execAgent:
image: golang:1.22.6
network_mode: bridge
working_dir: /go/src/services/clsi
command:
- sh
- '-exc'
- 'make execAgent/local && mv execAgent ${TMP_DIR}/binaries/execAgent'
volumes:
- ./:/go/src
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries
build-overleaf:
image: golang:1.22.6
network_mode: bridge
working_dir: /go/src/cmd/overleaf
command: go build -tags osusergo,netgo -o ${TMP_DIR}/binaries/overleaf
volumes:
- ./:/go/src
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries
setup-data-dirs:
image: debian:buster-slim
network_mode: none
command:
- chown
- '${DOCKER_USER}:'
- ${TMP_DIR}
volumes:
- ${TMP_DIR}:${TMP_DIR}
ready:
image: debian:buster-slim
depends_on:
nginx:
condition: service_started
network_mode: none
entrypoint: echo
command:
- |
---
Setup finished!
Overleaf-Go is ready on ${PUBLIC_URL} .
Go to ${PUBLIC_URL}register to create your first account.
Enjoy!
---
overleaf:
build:
context: ./services/spelling
target: aspell-cache
depends_on:
assets:
condition: service_completed_successfully
build-overleaf:
condition: service_completed_successfully
build-execAgent:
condition: service_completed_successfully
linked-url-proxy:
condition: service_started
minio:
condition: service_started
minio-setup:
condition: service_completed_successfully
postgres:
condition: service_started
pull-texlive-images:
condition: service_completed_successfully
redis:
condition: service_started
setup-data-dirs:
condition: service_completed_successfully
networks:
- internal
- proxy
user: ${DOCKER_USER}
group_add:
- ${DOCKER_SOCKET_GROUP_ID}
entrypoint: ${TMP_DIR}/binaries/overleaf
environment:
- CLSI_OPTIONS
- COPY_EXEC_AGENT_SRC=${TMP_DIR}/binaries/execAgent
- DOCKER_HOST
- DOCUMENT_UPDATER_OPTIONS
- LISTEN_ADDRESS=0.0.0.0
- PORT=3000
- POSTGRES_HOST=postgres:5432
- PUBLIC_URL
- REAL_TIME_OPTIONS
- REDIS_HOST=redis:6379
- SPELLING_OPTIONS
- WEB_OPTIONS
volumes:
- ${DOCKER_SOCKET}:${DOCKER_SOCKET}
- ${TMP_DIR}:${TMP_DIR}
- ${TMP_DIR}/assets:${TMP_DIR}/assets:ro
- ${TMP_DIR}/binaries:${TMP_DIR}/binaries:ro