-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
187 lines (184 loc) · 6.67 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
version: "3.9"
include:
- path: ./minio/minio-docker-compose.yml
project_directory: ./minio
env_file:
- ./.env
services:
reverse-proxy:
image: traefik:v2.9
command:
- "--providers.docker"
- "--providers.file.directory=/configuration/"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
- "--entrypoints.websecure.address=:443"
# - "--api.dashboard=true"
# - "--api.insecure=true"
environment:
- SSL_CERT_CRT=${SSL_CERT_CRT}
- SSL_CERT_KEY=${SSL_CERT_KEY}
ports:
- "80:80"
- "443:443"
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yaml:/configuration/traefik.yml
- /etc/ssl:/etc/ssl
frontend:
build: ./frontend
env_file:
- ./frontend/.env
environment:
- BASE_URL=${BASE_URL}
labels:
- "traefik.enable=true"
# Router for handling specific redirection (e.g., from / to /base_url/)
- "traefik.http.routers.redirect-to-base.priority=10"
- "traefik.http.routers.redirect-to-base.tls=true"
- "traefik.http.routers.redirect-to-base.rule=Host(`localhost`) && (Path(`/`) || PathPrefix(`/`))"
- "traefik.http.routers.redirect-to-base.middlewares=redirect-to"
- "traefik.http.middlewares.redirect-to.redirectregex.regex=^https?:\\/\\/([^\\/]+)\\/?$$"
- "traefik.http.middlewares.redirect-to.redirectregex.replacement=https://$$1${BASE_URL}"
- "traefik.http.middlewares.redirect-to.redirectregex.permanent=true"
# Router for handling the frontend, with the base URL, and stripping the prefix from the request because
# the frontend is not aware of the base URL (e.g., /base_url/... -> /...)
- "traefik.http.routers.frontend.priority=100"
- "traefik.http.routers.frontend.tls=true"
- "traefik.http.routers.frontend.rule=PathPrefix(`${BASE_URL}`)"
- "traefik.http.routers.frontend.middlewares=frontend-stripprefix,compress"
- "traefik.http.middlewares.compress.compress=true"
- "traefik.http.middlewares.frontend-stripprefix.stripprefix.prefixes=${BASE_URL_WITHOUT_SLASH}"
restart: unless-stopped
depends_on:
- couchdb
- reverse-proxy
azure-cron:
build: azure-cron
env_file:
- ./frontend/.env
environment:
- COUCHDB_USER=${COUCHDB_USER}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD}
- COUCHDB_HOST=couchdb
depends_on:
couchdb:
condition: service_healthy
init-couchdb:
image: python:3.12-alpine
command: /add_jwt_keys_to_local_ini_file.sh
env_file:
- ./frontend/.env
volumes:
- ./couchdb/add_jwt_keys_to_local_ini_file.sh:/add_jwt_keys_to_local_ini_file.sh
- ./couchdb/local.ini:/local.ini
couchdb:
image: couchdb:3.3
env_file:
- ./frontend/.env
environment:
- COUCHDB_USER=${COUCHDB_USER}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD}
- COUCHDB_HOST=couchdb
labels:
- "traefik.http.routers.couchdb.priority=1000"
- "traefik.http.routers.couchdb.tls=true"
- "traefik.http.routers.couchdb.rule=PathPrefix(`${BASE_URL_WITHOUT_SLASH}${DB_PREFIX}`)"
- "traefik.http.routers.couchdb.middlewares=couchdb-stripprefix,test-compress"
- "traefik.http.middlewares.couchdb-stripprefix.stripprefix.prefixes=${BASE_URL_WITHOUT_SLASH}${DB_PREFIX}"
- "traefik.http.middlewares.couchdb-stripprefix.stripprefix.forceSlash=false"
- "traefik.http.services.couchdb.loadbalancer.server.port=5984"
- "traefik.http.middlewares.test-compress.compress=true"
depends_on:
init-couchdb:
condition: service_completed_successfully
expose:
- '5984'
- '4369'
- '9100'
ports:
- "5984:5984"
restart: unless-stopped
volumes:
- couchdb_data:/opt/couchdb/data/
- ./couchdb/local.ini:/opt/couchdb/etc/local.d/local.ini
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5984"]
interval: 1m30s
timeout: 30s
retries: 5
start_period: 10s
couchdb-setup:
environment:
- COUCHDB_USER=${COUCHDB_USER}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD}
- COUCHDB_HOST=couchdb
labels:
- "traefik.http.services.couchdb-setup.loadbalancer.server.port=9999"
build: ./couchdb-setup
depends_on:
- couchdb
data-setup:
build: ./data-setup
env_file:
- .env
environment:
- aws_key=${S3_ACCESS_KEY_ID}
- aws_secret=${S3_SECRET_ACCESS_KEY}
- s3_host_base=${S3_ENDPOINT_HOSTNAME}
- cmd=sync-local-to-s3
- DEST_S3=s3://${S3_Bucket}
# volumes:
# - ./data-setup/s3_cdn_dump:/opt/src
# - ./data-setup/.s3cfg:/root/.s3cfg
depends_on:
- nginx-minio
rest-api:
build: ./rest-api
env_file:
- .env
environment:
- AUTH_SERVER="http://couchdb:5984"
expose:
- '5050'
ports:
- "5050:5050"
labels:
- "traefik.http.routers.restAPI.priority=1001"
- "traefik.http.routers.restAPI.tls=true"
- "traefik.http.routers.restAPI.rule=PathPrefix(`${BASE_URL_WITHOUT_SLASH}${API_PREFIX}`)"
- "traefik.http.services.restAPI.loadbalancer.server.port=5050"
- "traefik.http.routers.restAPI.middlewares=restAPI-middleware@docker,test-compress,rest-api-ratelimit"
- "traefik.http.middlewares.restAPI-middleware.stripprefix.prefixes=${BASE_URL_WITHOUT_SLASH}${API_PREFIX}"
- "traefik.http.middlewares.rest-api-ratelimit.ratelimit.average=50"
- "traefik.http.middlewares.rest-api-ratelimit.ratelimit.burst=25"
- "traefik.http.middlewares.rest-api-ratelimit.ratelimit.period=1"
- "traefik.http.middlewares.test-compress.compress=true"
restart: unless-stopped
depends_on:
- couchdb
s3_server:
build: ./s3_server
restart: unless-stopped
environment:
- DNS=${DNS}
- S3_ENDPOINT_HOSTNAME=${S3_ENDPOINT_HOSTNAME}
- S3_ENDPOINT_PROTOCOL=${S3_ENDPOINT_PROTOCOL}
- S3_BUCKET_NAME=${S3_Bucket}
labels:
- "traefik.http.routers.s3Server.priority=1002"
- "traefik.http.routers.s3Server.tls=true"
- "traefik.http.routers.s3Server.rule=PathPrefix(`${BASE_URL_WITHOUT_SLASH}${S3_PREFIX}`)"
- "traefik.http.routers.s3Server.middlewares=s3Server-stripprefix"
- "traefik.http.middlewares.s3Server-stripprefix.stripprefix.prefixes=${BASE_URL_WITHOUT_SLASH}${S3_PREFIX}"
- "traefik.http.services.s3Server.loadbalancer.server.port=5660"
expose:
- '5660'
ports:
- "5660:5660"
volumes:
couchdb_data:
driver: local