-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
147 lines (141 loc) · 4.7 KB
/
Copy pathdocker-compose.yml
File metadata and controls
147 lines (141 loc) · 4.7 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
# PennyCore — local dev orchestration.
#
# Boots Postgres (with pgvector) + Redis + both FastAPI services.
# `docker compose up` is the canonical "is the system runnable?" check
# at the end of every day per the daily discipline rule.
#
# - context-engine -> http://localhost:8001
# - orchestrator -> http://localhost:8002
# - postgres -> localhost:5432
# - redis -> localhost:6379
#
# Postgres runs the schema DDL on first boot via the
# /docker-entrypoint-initdb.d mount — every .sql file in
# `migrations/versions/` is executed in alphabetical order on an empty
# data volume. To re-run from scratch: `docker compose down -v`.
#
# `.env` at the project root supplies LLM_PROVIDER + API keys; mock mode
# is the default if no provider is configured.
services:
postgres:
image: pgvector/pgvector:pg16
container_name: pennycore-postgres
environment:
POSTGRES_DB: ${POSTGRES_DB:-pennycore}
POSTGRES_USER: ${POSTGRES_USER:-pennycore}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pennycore_local_dev}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./migrations/versions:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-pennycore} -d ${POSTGRES_DB:-pennycore}"]
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
container_name: pennycore-redis
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
context_engine:
build:
context: .
target: runtime
image: pennycore:dev
container_name: pennycore-context-engine
command:
- uvicorn
- context_engine.api:app
- --host
- 0.0.0.0
- --port
- "8000"
- --reload
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB:-pennycore}
POSTGRES_USER: ${POSTGRES_USER:-pennycore}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pennycore_local_dev}
REDIS_HOST: redis
REDIS_PORT: 6379
# Day 6: DATABASE_URL flips context-engine repos from in-memory to
# Postgres. Day 8: REDIS_URL flips the bus from InMemoryEventBus to
# RedisEventBus so the orchestrator's listener actually receives
# what we publish.
DATABASE_URL: ${DATABASE_URL:-postgresql://pennycore:pennycore_local_dev@postgres:5432/pennycore}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
LLM_PROVIDER: ${LLM_PROVIDER:-mock}
MOCK_LLM: ${MOCK_LLM:-true}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
AZURE_API_KEY: ${AZURE_API_KEY:-}
AZURE_ENDPOINT: ${AZURE_ENDPOINT:-}
AZURE_API_VERSION: ${AZURE_API_VERSION:-}
LLM_MODEL: ${LLM_MODEL:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
ports:
- "8001:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# Bind-mount source so --reload picks up local edits during dev. The
# production compose file (Day 29) drops these mounts.
volumes:
- ./contracts:/app/contracts
- ./context_engine:/app/context_engine
orchestrator:
build:
context: .
target: runtime
image: pennycore:dev
container_name: pennycore-orchestrator
command:
- uvicorn
- orchestrator.api:app
- --host
- 0.0.0.0
- --port
- "8000"
- --reload
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB:-pennycore}
POSTGRES_USER: ${POSTGRES_USER:-pennycore}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pennycore_local_dev}
REDIS_HOST: redis
REDIS_PORT: 6379
# Day 8: REDIS_URL flips the orchestrator from `unattached` mode to
# `redis` mode at lifespan startup. The context-engine reads the same
# var to flip its bus from `InMemoryEventBus` to `RedisEventBus`.
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
DATABASE_URL: ${DATABASE_URL:-postgresql://pennycore:pennycore_local_dev@postgres:5432/pennycore}
LLM_PROVIDER: ${LLM_PROVIDER:-mock}
MOCK_LLM: ${MOCK_LLM:-true}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
AZURE_API_KEY: ${AZURE_API_KEY:-}
AZURE_ENDPOINT: ${AZURE_ENDPOINT:-}
AZURE_API_VERSION: ${AZURE_API_VERSION:-}
LLM_MODEL: ${LLM_MODEL:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
ports:
- "8002:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./contracts:/app/contracts
- ./orchestrator:/app/orchestrator
volumes:
postgres_data: