-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
177 lines (170 loc) · 6.58 KB
/
Copy pathdocker-compose.yml
File metadata and controls
177 lines (170 loc) · 6.58 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
services:
# ── Postgres 16 + pgvector ──────────────────────────────────────────────────
postgres:
image: pgvector/pgvector:pg16
container_name: auditpilot-postgres-1
ports:
- "127.0.0.1:5432:5432" # bind to localhost only — never expose to 0.0.0.0
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: auditpilot_dev
volumes:
- pgdata:/var/lib/postgresql/data
- ./apps/api/db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d auditpilot_dev"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
# ── Redis 7 ─────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: auditpilot-redis-1
ports:
- "127.0.0.1:6379:6379" # bind to localhost only
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
# ── DB migration runner (one-shot) ──────────────────────────────────────────
# Runs every SQL file in apps/api/db/migrations/ in order, then exits. The
# api service depends_on this completing successfully. Each migration is
# idempotent (CREATE TABLE IF NOT EXISTS / DO $$ BEGIN ... END $$ guards),
# so re-running on every `docker compose up` is safe.
migrate:
image: postgres:16-alpine
container_name: auditpilot-migrate-1
environment:
DATABASE_URL: "postgres://postgres:postgres@postgres:5432/auditpilot_dev"
volumes:
- ./apps/api/db/migrations:/migrations:ro
- ./apps/api/db/run_migrations.sh:/usr/local/bin/run_migrations.sh:ro
entrypoint: ["/bin/sh", "-c"]
command: ["MIGRATIONS_DIR=/migrations /usr/local/bin/run_migrations.sh"]
depends_on:
postgres:
condition: service_healthy
restart: "no"
# ── FastAPI orchestration backend ───────────────────────────────────────────
api:
build:
context: .
dockerfile: apps/api/Dockerfile
target: dev
container_name: auditpilot-api-1
ports:
- "8000:8000"
volumes:
- ./apps/api:/app/apps/api
- ./apps/auditor:/app/apps/auditor
- ./packages:/app/packages
env_file:
- path: .env
required: false # .env is optional; copy from .env.example first
environment:
# Container overrides — these always win over .env when running in compose.
DATABASE_URL: "postgres://postgres:postgres@postgres:5432/auditpilot_dev"
DIRECT_URL: "postgres://postgres:postgres@postgres:5432/auditpilot_dev"
REDIS_URL: "redis://redis:6379/0"
AUDITOR_URL: "http://auditor:8001"
ENVIRONMENT: "development"
PYTHONUNBUFFERED: "1"
# Sane fallbacks so the api boots without a .env file. Replace with
# real keys in .env for any feature that calls Clerk / Gemini / Langfuse.
CLERK_PUBLISHABLE_KEY: "${CLERK_PUBLISHABLE_KEY:-pk_test_dev_placeholder}"
CLERK_SECRET_KEY: "${CLERK_SECRET_KEY:-sk_test_dev_placeholder}"
GEMINI_API_KEY: "${GEMINI_API_KEY:-dev-placeholder}"
LANGFUSE_PUBLIC_KEY: "${LANGFUSE_PUBLIC_KEY:-pk-lf-dev-placeholder}"
LANGFUSE_SECRET_KEY: "${LANGFUSE_SECRET_KEY:-sk-lf-dev-placeholder}"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 10
start_period: 30s
# ── AdversarialAuditor service ───────────────────────────────────────────────
auditor:
build:
context: .
dockerfile: apps/auditor/Dockerfile
target: dev
container_name: auditpilot-auditor-1
ports:
- "8001:8001"
volumes:
- ./apps/auditor:/app/apps/auditor
- ./apps/api/agents/prompts:/app/apps/api/agents/prompts:ro
env_file:
- path: .env
required: false
environment:
ENVIRONMENT: "development"
AUDITOR_PUBLIC_URL: "http://auditor:8001"
ADVERSARIAL_MODEL: "${ADVERSARIAL_MODEL:-google-gla:gemini-2.5-flash-lite}"
LLM_BUDGET_CAP_USD: "${LLM_BUDGET_CAP_USD:-0.50}"
GEMINI_API_KEY: "${GEMINI_API_KEY:-dev-placeholder}"
PYTHONUNBUFFERED: "1"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 5s
timeout: 3s
retries: 10
start_period: 15s
# ── Next.js 15 frontend ──────────────────────────────────────────────────────
web:
build:
context: .
dockerfile: apps/web/Dockerfile
target: dev
container_name: auditpilot-web-1
ports:
- "3000:3000"
volumes:
- ./apps/web:/app/apps/web
- ./packages:/app/packages
- /app/node_modules
- /app/apps/web/node_modules
- /app/apps/web/.next
env_file:
- path: .env
required: false
environment:
NEXT_PUBLIC_API_URL: "http://localhost:8000"
API_URL: "http://api:8000"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: "${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:-${CLERK_PUBLISHABLE_KEY:-pk_test_dev_placeholder}}"
CLERK_SECRET_KEY: "${CLERK_SECRET_KEY:-sk_test_dev_placeholder}"
depends_on:
api:
condition: service_healthy
# ── Self-hosted Langfuse (opt-in) ────────────────────────────────────────────
langfuse:
image: langfuse/langfuse:3
ports:
- "3001:3000"
environment:
DATABASE_URL: "postgres://postgres:postgres@postgres:5432/langfuse"
NEXTAUTH_SECRET: devsecret
NEXTAUTH_URL: "http://localhost:3001"
depends_on:
postgres:
condition: service_healthy
profiles:
- langfuse # opt-in: docker compose --profile langfuse up
volumes:
pgdata:
redisdata: