Skip to content

Commit 2800dec

Browse files
authored
chore: add Docker local development environment (#16)
1 parent 511d27c commit 2800dec

2 files changed

Lines changed: 95 additions & 0 deletions

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,36 @@ Star memU-server to get notified about new releases and join our growing communi
3535
```
3636
The server runs on `http://127.0.0.1:8000`.
3737

38+
### Run local infrastructure with Docker Compose
39+
Start local infrastructure dependencies (PostgreSQL and Temporal). Start the FastAPI API server separately (see "Run from source" above):
40+
41+
```bash
42+
# Start infrastructure services (PostgreSQL, Temporal, Temporal UI)
43+
docker compose up -d
44+
45+
# View logs
46+
docker compose logs -f
47+
```
48+
49+
**Services:**
50+
| Service | Port | Description |
51+
|---------|------|-------------|
52+
| PostgreSQL | 5432 | Database with pgvector extension |
53+
| Temporal | 7233 | Workflow engine gRPC API |
54+
| Temporal UI | 8088 | Web management interface |
55+
56+
**Default Configuration:**
57+
- PostgreSQL DSN: `postgresql://postgres:postgres@localhost:5432/memu`
58+
- Temporal Database: `temporal` (separate from app database)
59+
60+
**Environment Variables (optional `.env` file):**
61+
```env
62+
POSTGRES_USER=postgres
63+
POSTGRES_PASSWORD=postgres
64+
POSTGRES_DB=memu
65+
TEMPORAL_DB=temporal
66+
```
67+
3868
### Run with Docker
3969
1. Export your OpenAI API key so Docker can read it:
4070
```bash

docker-compose.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
services:
2+
# PostgreSQL with pgvector extension
3+
postgres:
4+
image: pgvector/pgvector:pg16
5+
environment:
6+
POSTGRES_USER: ${POSTGRES_USER:-postgres}
7+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
8+
POSTGRES_DB: ${POSTGRES_DB:-memu}
9+
ports:
10+
- "5432:5432"
11+
volumes:
12+
- postgres-data:/var/lib/postgresql/data
13+
healthcheck:
14+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
15+
interval: 5s
16+
timeout: 5s
17+
retries: 5
18+
networks:
19+
- memu-network
20+
21+
# Temporal server
22+
# Note: Temporal shares the same PostgreSQL instance as the main app but uses
23+
# a separate database (`TEMPORAL_DB`, default: `temporal`) from the app's
24+
# database (`POSTGRES_DB`, default: `memu`).
25+
# TODO: For production, consider using a separate PostgreSQL instance for Temporal
26+
# or at minimum keep Temporal and the app in separate databases as configured here.
27+
# Pointing both services at the same database can cause schema conflicts and is
28+
# not recommended.
29+
temporal:
30+
image: temporalio/auto-setup:1.25.1
31+
depends_on:
32+
postgres:
33+
condition: service_healthy
34+
environment:
35+
- DB=postgresql
36+
- DB_PORT=5432
37+
- POSTGRES_USER=${POSTGRES_USER:-postgres}
38+
- POSTGRES_PWD=${POSTGRES_PASSWORD:-postgres}
39+
- POSTGRES_SEEDS=postgres
40+
- POSTGRES_DB=${TEMPORAL_DB:-temporal}
41+
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
42+
ports:
43+
- "7233:7233" # Temporal gRPC
44+
networks:
45+
- memu-network
46+
47+
# Temporal Web UI
48+
temporal-ui:
49+
image: temporalio/ui:2.31.2
50+
depends_on:
51+
- temporal
52+
environment:
53+
- TEMPORAL_ADDRESS=temporal:7233
54+
ports:
55+
- "8088:8080" # Temporal Web UI
56+
networks:
57+
- memu-network
58+
59+
volumes:
60+
postgres-data:
61+
driver: local
62+
63+
networks:
64+
memu-network:
65+
driver: bridge

0 commit comments

Comments
 (0)