-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathcompose.yaml
More file actions
268 lines (266 loc) · 11.5 KB
/
compose.yaml
File metadata and controls
268 lines (266 loc) · 11.5 KB
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
name: ${COMPOSE_PROJECT_NAME:?error}
# https://docs.docker.com/reference/compose-file/networks/
networks:
api:
minio:
postgres:
redis:
# https://docs.docker.com/reference/compose-file/services
services:
api:
# https://docs.docker.com/reference/compose-file/build/
build:
# https://docs.docker.com/reference/compose-file/build/#args
args:
- API_GID=${API_GID:?error}
- API_UID=${API_UID:?error}
# https://docs.docker.com/reference/compose-file/build/#context
context: ./
# https://docs.docker.com/reference/compose-file/build/#dockerfile
dockerfile: ./docker/api.Containerfile
# https://docs.docker.com/reference/compose-file/build/#target
target: production
# https://docs.docker.com/reference/compose-file/services/#depends_on
depends_on:
minio:
condition: service_healthy
# Should be set to false when a third party minio service could be used in the api service and the `minio` compose profile is disabled.
required: false
postgres:
condition: service_healthy
# Should be set to false when a third party postgres service could be used in the api service the and the `postgres` compose profile is disabled.
required: false
redis:
condition: service_healthy
# Should be set to false when a third party redis service could be used in the api service and the `redis` compose profile is disabled.
required: false
# https://docs.docker.com/compose/environment-variables/
# https://docs.docker.com/reference/compose-file/services/#environment
environment:
- API_ADMINISTRATOR_USER_EMAIL_ADDRESS=${API_ADMINISTRATOR_USER_EMAIL_ADDRESS:?error}
- API_ADMINISTRATOR_USER_NAME=${API_ADMINISTRATOR_USER_NAME:?error}
- API_ADMINISTRATOR_USER_PASSWORD=${API_ADMINISTRATOR_USER_PASSWORD:?error}
- API_BASE_URL=${API_BASE_URL:?error}
- API_COMMUNITY_FACEBOOK_URL=${API_COMMUNITY_FACEBOOK_URL:?error}
- API_COMMUNITY_GITHUB_URL=${API_COMMUNITY_GITHUB_URL:?error}
- API_COMMUNITY_INACTIVITY_TIMEOUT_DURATION=${API_COMMUNITY_INACTIVITY_TIMEOUT_DURATION:?error}
- API_COMMUNITY_INSTAGRAM_URL=${API_COMMUNITY_INSTAGRAM_URL:?error}
- API_COMMUNITY_LINKEDIN_URL=${API_COMMUNITY_LINKEDIN_URL:?error}
- API_COMMUNITY_NAME=${API_COMMUNITY_NAME:?error}
- API_COMMUNITY_REDDIT_URL=${API_COMMUNITY_REDDIT_URL:?error}
- API_COMMUNITY_SLACK_URL=${API_COMMUNITY_SLACK_URL:?error}
- API_COMMUNITY_WEBSITE_URL=${API_COMMUNITY_WEBSITE_URL:?error}
- API_COMMUNITY_X_URL=${API_COMMUNITY_X_URL:?error}
- API_COMMUNITY_YOUTUBE_URL=${API_COMMUNITY_YOUTUBE_URL:?error}
- API_HOST=${API_HOST:?error}
- API_IS_APPLY_DRIZZLE_MIGRATIONS=${API_IS_APPLY_DRIZZLE_MIGRATIONS:?error}
- API_IS_GRAPHIQL=${API_IS_GRAPHIQL:?error}
- API_IS_PINO_PRETTY=${API_IS_PINO_PRETTY:?error}
- API_JWT_EXPIRES_IN=${API_JWT_EXPIRES_IN:?error}
- API_JWT_SECRET=${API_JWT_SECRET:?error}
- API_AUTH_JWT_SECRET=${API_AUTH_JWT_SECRET:-}
- API_LOG_LEVEL=${API_LOG_LEVEL:?error}
- API_MINIO_ACCESS_KEY=${API_MINIO_ACCESS_KEY:?error}
- API_MINIO_END_POINT=${API_MINIO_END_POINT:?error}
- API_MINIO_PORT=${API_MINIO_PORT:?error}
- API_MINIO_SECRET_KEY=${API_MINIO_SECRET_KEY:?error}
- API_MINIO_USE_SSL=${API_MINIO_USE_SSL:?error}
- API_PORT=${API_PORT:?error}
- API_POSTGRES_DATABASE=${API_POSTGRES_DATABASE:?error}
- API_POSTGRES_HOST=${API_POSTGRES_HOST:?error}
- API_POSTGRES_PASSWORD=${API_POSTGRES_PASSWORD:?error}
- API_POSTGRES_PORT=${API_POSTGRES_PORT:?error}
- API_POSTGRES_SSL_MODE=${API_POSTGRES_SSL_MODE:?error}
- API_POSTGRES_USER=${API_POSTGRES_USER:?error}
- API_REDIS_HOST=${API_REDIS_HOST:?error}
- API_REDIS_PORT=${API_REDIS_PORT:?error}
- API_GRAPHQL_SCALAR_FIELD_COST=${API_GRAPHQL_SCALAR_FIELD_COST:?error}
- API_GRAPHQL_SCALAR_RESOLVER_FIELD_COST=${API_GRAPHQL_SCALAR_RESOLVER_FIELD_COST:?error}
- API_GRAPHQL_OBJECT_FIELD_COST=${API_GRAPHQL_OBJECT_FIELD_COST:?error}
- API_GRAPHQL_LIST_FIELD_COST=${API_GRAPHQL_LIST_FIELD_COST:?error}
- API_GRAPHQL_NON_PAGINATED_LIST_FIELD_COST=${API_GRAPHQL_NON_PAGINATED_LIST_FIELD_COST:?error}
- API_GRAPHQL_MUTATION_BASE_COST=${API_GRAPHQL_MUTATION_BASE_COST:?error}
- API_GRAPHQL_SUBSCRIPTION_BASE_COST=${API_GRAPHQL_SUBSCRIPTION_BASE_COST:?error}
- API_RATE_LIMIT_BUCKET_CAPACITY=${API_RATE_LIMIT_BUCKET_CAPACITY:?error}
- API_RATE_LIMIT_REFILL_RATE=${API_RATE_LIMIT_REFILL_RATE:?error}
- CI=${CI:?error}
- NODE_ENV=${NODE_ENV:?error}
- API_FRONTEND_URL=${API_FRONTEND_URL:?error}
# https://docs.docker.com/reference/compose-file/build/#using-build-and-image
# https://docs.docker.com/reference/compose-file/build/#publishing-built-images
# https://docs.docker.com/reference/compose-file/services/#image
# image: ghcr.io/talawa/api:latest
# https://docs.docker.com/reference/dockerfile/#healthcheck
# https://docs.docker.com/reference/compose-file/services/#healthcheck
healthcheck:
interval: 10s
retries: 3
start_interval: 1s
start_period: 5s
test: ["CMD-SHELL", "node /home/talawa/api/docker/apiHealthcheck.js"]
timeout: 10s
# https://docs.docker.com/reference/compose-file/services/#init
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
init: true
# https://docs.docker.com/reference/compose-file/services/#networks
networks:
- api
- minio
- postgres
- redis
# https://docs.docker.com/reference/compose-file/services/#profiles
profiles:
- api
# https://docs.docker.com/reference/compose-file/services/#restart
restart: unless-stopped
caddy:
# https://docs.docker.com/reference/compose-file/services/#depends_on
depends_on:
api:
condition: service_healthy
required: true
# https://docs.docker.com/compose/environment-variables/
# https://docs.docker.com/reference/compose-file/services/#environment
environment:
- CADDY_TALAWA_API_DOMAIN_NAME=${CADDY_TALAWA_API_DOMAIN_NAME:?error}
- CADDY_TALAWA_API_EMAIL=${CADDY_TALAWA_API_EMAIL:?error}
- CADDY_TALAWA_API_HOST=${CADDY_TALAWA_API_HOST:?error}
- CADDY_TALAWA_API_PORT=${CADDY_TALAWA_API_PORT:?error}
# https://caddyserver.com/docs/install#docker
# https://hub.docker.com/_/caddy
image: caddy:2.8.4-alpine
# https://docs.docker.com/reference/compose-file/services/#networks
networks:
- api
# https://docs.docker.com/reference/compose-file/services/#ports
ports:
- name: caddy_http
published: ${CADDY_HTTP_MAPPED_PORT:?error}
target: 80
- name: caddy_https
published: ${CADDY_HTTPS_MAPPED_PORT:?error}
target: 443
- name: caddy_http3
protocol: udp
published: ${CADDY_HTTP3_MAPPED_PORT:?error}
target: 443
# https://docs.docker.com/reference/compose-file/services/#profiles
profiles:
- caddy
# https://docs.docker.com/reference/compose-file/services/#restart
restart: unless-stopped
# https://docs.docker.com/reference/compose-file/services/#volumes
volumes:
- source: caddy_config
target: /config
type: volume
- source: caddy_data
target: /data
type: volume
- source: ./docker/Caddyfile
target: /etc/caddy/Caddyfile
type: bind
# # for serving talawa admin using caddy
# - source: ./docker/admin
# target: /srv
# type: bind
minio:
# https://docs.docker.com/compose/environment-variables/
# https://docs.docker.com/reference/compose-file/services/#environment
environment:
- MINIO_BROWSER=${MINIO_BROWSER:?error}
# https://min.io/docs/minio/linux/reference/minio-server/settings/root-credentials.html#envvar.MINIO_ROOT_PASSWORD
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:?error}
# https://min.io/docs/minio/linux/reference/minio-server/settings/root-credentials.html#root-user
- MINIO_ROOT_USER=${MINIO_ROOT_USER:?error}
# https://docs.docker.com/reference/compose-file/services/#command
command: server /data --console-address ":9001"
# https://docs.docker.com/reference/dockerfile/#healthcheck
# https://docs.docker.com/reference/compose-file/services/#healthcheck
healthcheck:
interval: 10s
retries: 3
start_interval: 1s
start_period: 5s
# https://github.com/minio/minio/issues/18373
# https://min.io/docs/minio/linux/reference/minio-mc/mc-ready.html
test: ["CMD-SHELL", "mc ready local"]
timeout: 10s
# https://docs.docker.com/reference/compose-file/services/#image
# https://hub.docker.com/r/minio/minio
image: minio/minio:RELEASE.2024-12-18T13-15-44Z
# https://docs.docker.com/reference/compose-file/services/#networks
networks:
- minio
# https://docs.docker.com/reference/compose-file/services/#profiles
profiles:
- minio
# https://docs.docker.com/reference/compose-file/services/#restart
restart: unless-stopped
# https://docs.docker.com/reference/compose-file/services/#volumes
volumes:
- source: minio_data
target: /data
type: volume
postgres:
# https://docs.docker.com/compose/environment-variables/
# https://docs.docker.com/reference/compose-file/services/#environment
environment:
# https://github.com/docker-library/docs/blob/master/postgres/README.md#postgres_db
- POSTGRES_DB=${POSTGRES_DB:?error}
# https://github.com/docker-library/docs/blob/master/postgres/README.md#postgres_password
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?error}
# https://github.com/docker-library/docs/blob/master/postgres/README.md#postgres_user
- POSTGRES_USER=${POSTGRES_USER:?error}
# https://docs.docker.com/reference/dockerfile/#healthcheck
# https://docs.docker.com/reference/compose-file/services/#healthcheck
healthcheck:
interval: 10s
retries: 3
start_interval: 1s
start_period: 5s
# https://stackoverflow.com/questions/60193781/postgres-with-docker-compose-gives-fatal-role-root-does-not-exist-error
# https://www.postgresql.org/docs/current/app-pg-isready.html
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
timeout: 10s
# https://docs.docker.com/reference/compose-file/services/#image
# https://hub.docker.com/_/postgres
image: postgres:17.2-alpine3.21
# https://docs.docker.com/reference/compose-file/services/#networks
networks:
- postgres
# https://docs.docker.com/reference/compose-file/services/#profiles
profiles:
- postgres
# https://docs.docker.com/reference/compose-file/services/#restart
restart: unless-stopped
# https://docs.docker.com/reference/compose-file/services/#volumes
volumes:
- source: postgres_data
target: /var/lib/postgresql/data
type: volume
redis:
image: redis:8.0-M02-alpine
healthcheck:
interval: 10s
retries: 3
start_interval: 1s
start_period: 5s
test: ["CMD", "redis-cli", "ping"]
timeout: 10s
networks:
- redis # Connect Redis to the Redis network
restart: unless-stopped
volumes:
- source: redis_data
target: /data
type: volume
profiles:
- redis
# https://docs.docker.com/reference/compose-file/volumes/
volumes:
caddy_config:
caddy_data:
minio_data:
postgres_data:
redis_data: