Repository navigation
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
90 lines (83 loc) · 2.86 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
90 lines (83 loc) · 2.86 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
name: codex-proxy
# Main application services only. This file is composed with the supporting stacks:
#
# - docker-compose.postgres.yml -- a bundled PostgreSQL (omit it to use your own database)
# - docker-compose.traefik.yml -- a bundled Traefik reverse proxy that fronts the app on one origin
#
# Local / all-in-one (see README):
# docker compose -f docker-compose.yaml -f docker-compose.postgres.yml -f docker-compose.traefik.yml up -d --build
#
# These services are reached only through the reverse proxy, so none of them publish host ports directly.
services:
backend-init-db:
build: ./backend
image: codex-proxy/backend:latest
command: uv run python -m app.scripts.migrate
env_file: ./.env
# The dependency on Postgres is added by docker-compose.postgres.yml; with an external
# database this one-shot just runs the migration against POSTGRES_HOST.
backend:
build: ./backend
image: codex-proxy/backend:latest
command: uv run gunicorn app.main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:80 --log-level info
restart: unless-stopped
env_file: ./.env
environment:
DEPLOYMENT_SLOT: ${BG_SLOT:-stable}
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
backend-init-db:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
quota-refresher:
build: ./backend
image: codex-proxy/backend:latest
command: uv run python -m app.scripts.quota_refresher
restart: unless-stopped
env_file: ./.env
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
backend-init-db:
condition: service_completed_successfully
notification-dispatcher:
build: ./backend
image: codex-proxy/backend:latest
command: uv run python -m app.scripts.notification_dispatcher
restart: unless-stopped
env_file: ./.env
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
backend-init-db:
condition: service_completed_successfully
archive-retention:
build: ./backend
image: codex-proxy/backend:latest
command: uv run python -m app.scripts.archive_retention
restart: unless-stopped
env_file: ./.env
environment:
BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK: "yes"
BORG_RELOCATED_REPO_ACCESS_IS_OK: "yes"
volumes:
- type: bind
source: ${ARCHIVE_BORG_HOST_DIR:-/srv/codex-proxy/borg}
target: /borg
depends_on:
backend-init-db:
condition: service_completed_successfully
frontend:
build: ./frontend
image: codex-proxy/frontend:latest
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/"]
interval: 10s
timeout: 3s
retries: 5