Repository navigation
Expand file tree
/
Copy pathcompose.dev.yaml
More file actions
300 lines (289 loc) · 9.21 KB
/
Copy pathcompose.dev.yaml
File metadata and controls
300 lines (289 loc) · 9.21 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
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
# compose.dev.yaml (DEVELOPMENT - explicit dev overlay)
# Run with: COMPOSE_DISABLE_ENV_FILE=1 docker compose -p r9lab_dev -f compose.yaml -f compose.dev.yaml up
x-backend-runtime-secrets: &backend-runtime-secrets
- database_app_password
- database_migration_password
- database_backup_password
- redis_password
- auth_token_secret
- oauth_state_secret
- cache_signing_secret
- data_encryption_key
- google_oauth_client_secret
- github_oauth_client_secret
- smtp_password
- microsoft_graph_client_secret
- bootstrap_superuser_password
# www and docs are not part of compose.yaml, which covers what the deploy hosts run:
# they deploy to Cloudflare Workers. Here they run the Astro dev server, with the same
# hardening compose.yaml gives the app.
x-dev-site-hardening: &dev-site-hardening
cap_drop:
- ALL
pids_limit: 512
security_opt:
- no-new-privileges:true
services:
api:
build:
dockerfile: Dockerfile
target: dev
restart: "no"
ports:
- "127.0.0.1:8010:8000"
environment:
ENVIRONMENT: ${ENVIRONMENT:-dev}
API_PUBLIC_URL: ${API_PUBLIC_URL:-http://127.0.0.1:8010}
APP_PUBLIC_URL: ${APP_PUBLIC_URL:-http://127.0.0.1:8011}
SITE_PUBLIC_URL: ${SITE_PUBLIC_URL:-http://127.0.0.1:8013}
DOCS_PUBLIC_URL: ${DOCS_PUBLIC_URL:-http://127.0.0.1:8012}
env_file:
- path: ./backend/.env.dev
required: false
secrets: *backend-runtime-secrets
develop:
watch:
- action: sync
path: ./backend
target: /opt/r9lab/backend
ignore:
- .venv/
- __pycache__/
- "*.pyc"
- logs/
- data/
- action: rebuild
path: ./backend/uv.lock
- action: rebuild
path: ./backend/pyproject.toml
redis:
ports:
- "127.0.0.1:6379:6379"
networks:
# Accessible to edge to allow for local development interactions
- edge
- data
secrets:
- redis_password
healthcheck:
test: [ "CMD-SHELL", "REDISCLI_AUTH=\"$$(cat /run/secrets/redis_password)\" redis-cli ping | grep -q PONG" ]
command:
- sh
- -c
- |
redis_password="$$(cat /run/secrets/redis_password)"
exec redis-server --appendonly yes --save 60 1 --requirepass "$$redis_password"
postgres:
ports:
- "127.0.0.1:5432:5432"
networks:
# Accessible to edge to allow for local development interactions
- edge
- data
environment:
POSTGRES_USER: postgres
POSTGRES_DB: r9lab_db
DATABASE_APP_USER: r9lab_app
DATABASE_MIGRATION_USER: r9lab_migrator
DATABASE_BACKUP_USER: r9lab_backup
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
DATABASE_APP_PASSWORD_FILE: /run/secrets/database_app_password
DATABASE_MIGRATION_PASSWORD_FILE: /run/secrets/database_migration_password
DATABASE_BACKUP_PASSWORD_FILE: /run/secrets/database_backup_password
secrets:
- postgres_password
- database_app_password
- database_migration_password
- database_backup_password
migrator:
environment:
ENVIRONMENT: ${ENVIRONMENT:-dev}
secrets: *backend-runtime-secrets
docs:
!!merge <<: *dev-site-hardening
build:
context: .
dockerfile: Dockerfile.sites
target: dev
args:
SITE: docs
PORT: "8000"
restart: "no"
ports:
- "127.0.0.1:8012:8000"
environment:
PUBLIC_BACKEND_API_URL: ${API_PUBLIC_URL:-http://127.0.0.1:8010}
PUBLIC_DOCS_URL: ${DOCS_PUBLIC_URL:-http://127.0.0.1:8012}
develop:
watch:
# Keep watch scope explicit for Node-based subrepos: sync only source and
# runtime config, and rebuild on dependency manifest changes.
- action: sync
path: ./docs/src
target: /opt/r9lab/docs/src
- action: sync
path: ./docs/public
target: /opt/r9lab/docs/public
- action: sync
path: ./docs/site
target: /opt/r9lab/docs/site
- action: sync
path: ./docs/scripts
target: /opt/r9lab/docs/scripts
- action: sync
path: ./docs/astro.config.mjs
target: /opt/r9lab/docs/astro.config.mjs
- action: sync
path: ./docs/tsconfig.json
target: /opt/r9lab/docs/tsconfig.json
- action: sync
path: ./docs/README.md
target: /opt/r9lab/docs/README.md
- action: sync
path: ./docs/biome.jsonc
target: /opt/r9lab/docs/biome.jsonc
- action: sync
path: ./docs/playwright.config.ts
target: /opt/r9lab/docs/playwright.config.ts
- action: rebuild
path: ./pnpm-lock.yaml
- action: rebuild
path: ./pnpm-workspace.yaml
- action: rebuild
path: ./docs/package.json
app:
build:
dockerfile: app/Dockerfile
target: dev
restart: "no"
ports:
- "127.0.0.1:8011:8081"
environment:
EXPO_PUBLIC_API_URL: ${API_PUBLIC_URL:-http://127.0.0.1:8010}
EXPO_PUBLIC_WEBSITE_URL: ${SITE_PUBLIC_URL:-http://127.0.0.1:8013}
EXPO_PUBLIC_DOCS_URL: ${DOCS_PUBLIC_URL:-http://127.0.0.1:8012}
develop:
watch:
# Avoid watching the whole app tree. Recursive watches can walk
# into large dependency/cache directories on the host and exhaust inotify.
- action: sync
path: ./app/src
target: /opt/r9lab/app/src
- action: sync
path: ./app/config
target: /opt/r9lab/app/config
- action: sync
path: ./app/scripts
target: /opt/r9lab/app/scripts
- action: sync
path: ./app/app.json
target: /opt/r9lab/app/app.json
- action: sync
path: ./app/babel.config.js
target: /opt/r9lab/app/babel.config.js
- action: sync
path: ./app/biome.jsonc
target: /opt/r9lab/app/biome.jsonc
- action: sync
path: ./app/eslint.config.mjs
target: /opt/r9lab/app/eslint.config.mjs
- action: sync
path: ./app/expo-env.d.ts
target: /opt/r9lab/app/expo-env.d.ts
- action: sync
path: ./app/jest.config.cjs
target: /opt/r9lab/app/jest.config.cjs
- action: sync
path: ./app/playwright.config.ts
target: /opt/r9lab/app/playwright.config.ts
- action: sync
path: ./app/README.md
target: /opt/r9lab/app/README.md
- action: sync
path: ./app/tsconfig.json
target: /opt/r9lab/app/tsconfig.json
- action: rebuild
path: ./pnpm-lock.yaml
- action: rebuild
path: ./pnpm-workspace.yaml
- action: rebuild
path: ./app/package.json
www:
!!merge <<: *dev-site-hardening
build:
context: .
dockerfile: Dockerfile.sites
target: dev
args:
SITE: www
PORT: "8081"
restart: "no"
ports:
- "127.0.0.1:8013:8081"
environment:
PUBLIC_DOCS_URL: ${DOCS_PUBLIC_URL:-http://127.0.0.1:8012}
PUBLIC_APP_URL: ${APP_PUBLIC_URL:-http://127.0.0.1:8011}
PUBLIC_SITE_URL: ${SITE_PUBLIC_URL:-http://127.0.0.1:8013}
PUBLIC_API_URL: ${API_PUBLIC_URL:-http://127.0.0.1:8010}
develop:
watch:
# Same rule here: explicit source/config syncs only, rebuild for deps.
- action: sync
path: ./www/src
target: /opt/r9lab/www/src
- action: sync
path: ./www/public
target: /opt/r9lab/www/public
- action: sync
path: ./www/astro.config.ts
target: /opt/r9lab/www/astro.config.ts
- action: sync
path: ./www/biome.jsonc
target: /opt/r9lab/www/biome.jsonc
- action: sync
path: ./www/playwright.config.ts
target: /opt/r9lab/www/playwright.config.ts
- action: sync
path: ./www/README.md
target: /opt/r9lab/www/README.md
- action: sync
path: ./www/tsconfig.json
target: /opt/r9lab/www/tsconfig.json
- action: rebuild
path: ./pnpm-lock.yaml
- action: rebuild
path: ./pnpm-workspace.yaml
- action: rebuild
path: ./www/package.json
networks:
data:
internal: true
secrets:
postgres_password:
file: ./secrets/dev/postgres_password
database_app_password:
file: ./secrets/dev/database_app_password
database_migration_password:
file: ./secrets/dev/database_migration_password
database_backup_password:
file: ./secrets/dev/database_backup_password
redis_password:
file: ./secrets/dev/redis_password
auth_token_secret:
file: ./secrets/dev/auth_token_secret
oauth_state_secret:
file: ./secrets/dev/oauth_state_secret
cache_signing_secret:
file: ./secrets/dev/cache_signing_secret
data_encryption_key:
file: ./secrets/dev/data_encryption_key
google_oauth_client_secret:
file: ./secrets/dev/google_oauth_client_secret
github_oauth_client_secret:
file: ./secrets/dev/github_oauth_client_secret
smtp_password:
file: ./secrets/dev/smtp_password
microsoft_graph_client_secret:
file: ./secrets/dev/microsoft_graph_client_secret
bootstrap_superuser_password:
file: ./secrets/dev/bootstrap_superuser_password