forked from ACMClassOJ/TesutoHime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
89 lines (86 loc) · 3.43 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
89 lines (86 loc) · 3.43 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
# Development overrides — explicitly opt-in.
#
# Usage (foreground watch):
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up
#
# Or set the default file list in your shell:
# export COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml
#
# What this file does on top of the base compose:
# - Mounts ./web ./commons ./scripts ./alembic into the web container
# so the Flask dev server auto-reloads on edit.
# - Switches the web entrypoint to the dev server (templates auto-reload).
# - Keeps all service ports published to localhost for direct hit
# (matches the base file; the prod compose hides them behind nginx).
services:
web:
# ``requirements.txt`` ships in the image but is regenerated as the
# codebase evolves; running pip install here on every dev boot keeps
# the container in sync without forcing a full image rebuild. (In
# prod the image is built fresh from requirements.txt so this step
# is unnecessary.)
entrypoint:
- sh
- -c
- 'pip install -q -r /app/web/requirements.txt && exec python -m web.main'
environment:
ENV: development
# Browser-facing URLs are rewritten to flow through the unified
# ``gateway-dev`` (port 8088) so dev exercises the same network
# path as prod — single host, single TLS terminator, websocket
# upgrade through nginx. The base file still publishes the
# individual service ports (5080 / 7880 / 5300 / 9000) for
# direct hits when you're debugging.
LIVEKIT_URL: "ws://localhost:8088/livekit"
PROCTOR_PUBLIC_URL: "http://localhost:8088/proctor2"
S3_PUBLIC_URL: "http://localhost:8088/s3/"
S3_PUBLIC_ENDPOINT: "http://localhost:8088/s3/"
volumes:
- ./web:/app/web
- ./commons:/app/commons
- ./scripts:/app/scripts
- ./alembic:/app/alembic
- ./alembic.ini:/app/alembic.ini
# Second judger replica for dev so you can watch the scheduler
# distribute work across a pool. Uses the same image as the base
# ``judger`` service but overrides ``/app/runner.yml`` with a
# runner config that has ``id: 2``. Both judgers share the same
# group and Redis queue → scheduler treats them as interchangeable.
judger-2:
build:
context: .
dockerfile: docker/Dockerfile.judger
privileged: true
environment:
AWS_DEFAULT_REGION: us-east-1
# Same DB env as the base judger so the entrypoint's auto-
# register step writes (id=2, name='judger-2') into judge_runner_v2.
DB: postgresql+psycopg2://oj:oj_password@postgres:5432/oj
RUNNER_NAME: judger-2
volumes:
- ./docker/runner.2.yml:/app/runner.yml:ro
depends_on:
redis:
condition: service_healthy
minio-init:
condition: service_completed_successfully
restart: unless-stopped
# Single-port reverse proxy for dev. Mirrors the prod gateway layout
# so frontend code that uses relative paths (``/livekit/``, ``/s3/``,
# ``/proctor2/``) works the same here as in prod. Direct ports
# (5080 / 7880 / 5300 / 9000) are still published by the base file
# for ad-hoc debugging.
gateway-dev:
image: nginx:1.27-alpine
restart: unless-stopped
ports:
# 8080 is commonly grabbed by other local services — 8088 is
# almost always free.
- "8088:80"
volumes:
- ./docker/nginx/nginx.dev.conf:/etc/nginx/nginx.conf:ro
depends_on:
- web
- livekit
- proctor2
- minio