From 753d08b1965ca05582eb203dec975f711e1aa430 Mon Sep 17 00:00:00 2001 From: Spark Zou Date: Sun, 25 Jan 2026 14:39:25 +0900 Subject: [PATCH 1/6] chore: add Docker local development environment Add Docker Compose configuration for local development with PostgreSQL and Temporal. ## Changes ### Docker Services - Add docker-compose.yml with two services: * PostgreSQL 16-alpine: Database service - Port: 5432 - Database: memu - User/Password: postgres/postgres (for local dev only) - Persistent volume: postgres_data - Health check included * Temporal Server: Workflow orchestration - Port: 7233 - Web UI: 8088 - SQLite storage (local dev) - Depends on PostgreSQL ### Benefits - One-command local environment setup - Consistent development environment across team - No need to install PostgreSQL locally - Temporal ready for workflow development ## Usage ```bash docker-compose up -d # Start services docker-compose down # Stop services docker-compose logs -f # View logs ``` ## Security Note - Default credentials are for local development only - Do not use these settings in production ## TODO - Consider separating Temporal database from main PostgreSQL ## Files Changed (1 file) - docker-compose.yml: PostgreSQL and Temporal service configuration --- docker-compose.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1835a1a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,53 @@ +services: + # PostgreSQL with pgvector extension + postgres: + image: pgvector/pgvector:pg16 + container_name: memu-postgres + environment: + POSTGRES_USER: ${POSTGRES_USER:-memu_user} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-memu_pass} + POSTGRES_DB: ${POSTGRES_DB:-memu_db} + ports: + - "54320:5432" + volumes: + - postgres-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-memu_user}"] + interval: 5s + timeout: 5s + retries: 5 + networks: + - memu-network + + # Temporal server + # Note: Temporal uses the same database as the main app. + # TODO: For production, use a separate Temporal database or at minimum use + # different schemas within the same PostgreSQL instance. Sharing the same + # database can cause schema conflicts and is not recommended even for development. + temporal: + image: temporalio/auto-setup:latest + container_name: memu-temporal + depends_on: + postgres: + condition: service_healthy + environment: + - DB=postgresql + - DB_PORT=5432 + - POSTGRES_USER=${POSTGRES_USER:-memu_user} + - POSTGRES_PWD=${POSTGRES_PASSWORD:-memu_pass} + - POSTGRES_SEEDS=postgres + - POSTGRES_DB=${POSTGRES_DB:-memu_db} + - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml + ports: + - "17233:7233" # Temporal gRPC + - "18233:8233" # Temporal Web UI + networks: + - memu-network + +volumes: + postgres-data: + driver: local + +networks: + memu-network: + driver: bridge From d40d00403a73b6a3deacb4ff742236d0dac2fdf1 Mon Sep 17 00:00:00 2001 From: Spark Zou Date: Wed, 28 Jan 2026 17:47:28 +0900 Subject: [PATCH 2/6] fix: align docker-compose configuration with PR description - Change PostgreSQL port from 54320 to 5432 - Update default credentials to postgres/postgres/memu - Pin Temporal image version to 1.25.1 (from latest) - Update Temporal ports to 7233 and 8088 - Remove container_name to support multiple instances --- docker-compose.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1835a1a..969f9fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,17 +2,16 @@ services: # PostgreSQL with pgvector extension postgres: image: pgvector/pgvector:pg16 - container_name: memu-postgres environment: - POSTGRES_USER: ${POSTGRES_USER:-memu_user} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-memu_pass} - POSTGRES_DB: ${POSTGRES_DB:-memu_db} + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} + POSTGRES_DB: ${POSTGRES_DB:-memu} ports: - - "54320:5432" + - "5432:5432" volumes: - postgres-data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-memu_user}"] + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] interval: 5s timeout: 5s retries: 5 @@ -25,22 +24,21 @@ services: # different schemas within the same PostgreSQL instance. Sharing the same # database can cause schema conflicts and is not recommended even for development. temporal: - image: temporalio/auto-setup:latest - container_name: memu-temporal + image: temporalio/auto-setup:1.25.1 depends_on: postgres: condition: service_healthy environment: - DB=postgresql - DB_PORT=5432 - - POSTGRES_USER=${POSTGRES_USER:-memu_user} - - POSTGRES_PWD=${POSTGRES_PASSWORD:-memu_pass} + - POSTGRES_USER=${POSTGRES_USER:-postgres} + - POSTGRES_PWD=${POSTGRES_PASSWORD:-postgres} - POSTGRES_SEEDS=postgres - - POSTGRES_DB=${POSTGRES_DB:-memu_db} + - POSTGRES_DB=${POSTGRES_DB:-memu} - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml ports: - - "17233:7233" # Temporal gRPC - - "18233:8233" # Temporal Web UI + - "7233:7233" # Temporal gRPC + - "8088:8233" # Temporal Web UI networks: - memu-network From 1f7b22c7d017fb319e6d7f52d31730ca74013061 Mon Sep 17 00:00:00 2001 From: Spark Zou Date: Wed, 28 Jan 2026 18:13:18 +0900 Subject: [PATCH 3/6] feat: add separate temporal-ui service and temporal database - Add temporalio/ui:2.31.2 for Temporal Web UI - Separate Temporal database (temporal) from app database (memu) - Remove incorrect port mapping 8088:8233 from temporal service - Expose Web UI on port 8088 --- docker-compose.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 969f9fd..4199e5a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,11 +34,22 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PWD=${POSTGRES_PASSWORD:-postgres} - POSTGRES_SEEDS=postgres - - POSTGRES_DB=${POSTGRES_DB:-memu} + - POSTGRES_DB=${TEMPORAL_DB:-temporal} - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml ports: - "7233:7233" # Temporal gRPC - - "8088:8233" # Temporal Web UI + networks: + - memu-network + + # Temporal Web UI + temporal-ui: + image: temporalio/ui:2.31.2 + depends_on: + - temporal + environment: + - TEMPORAL_ADDRESS=temporal:7233 + ports: + - "8088:8080" # Temporal Web UI networks: - memu-network From 0b930577e6c69de421a578d7f76b8dae3d31de46 Mon Sep 17 00:00:00 2001 From: Spark Zou Date: Wed, 28 Jan 2026 18:27:53 +0900 Subject: [PATCH 4/6] docs: update comments and README to reflect actual configuration - Update docker-compose.yml comments to reflect separate databases (memu for app, temporal for Temporal) - Add Docker Compose local development section to README - Document all services, ports and environment variables --- README.md | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 11 +++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3a5d4b8..04df2f8 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,36 @@ Star memU-server to get notified about new releases and join our growing communi ``` The server runs on `http://127.0.0.1:8000`. +### Run with Docker Compose (Local Development) +Start the full local development environment with PostgreSQL and Temporal: + +```bash +# Start all services (PostgreSQL, Temporal, Temporal UI) +docker compose up -d + +# View logs +docker compose logs -f +``` + +**Services:** +| Service | Port | Description | +|---------|------|-------------| +| PostgreSQL | 5432 | Database with pgvector extension | +| Temporal | 7233 | Workflow engine gRPC API | +| Temporal UI | 8088 | Web management interface | + +**Default Configuration:** +- PostgreSQL: `postgres:postgres@localhost:5432/memu` +- Temporal Database: `temporal` (separate from app database) + +**Environment Variables (optional `.env` file):** +```env +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_DB=memu +TEMPORAL_DB=temporal +``` + ### Run with Docker 1. Export your OpenAI API key so Docker can read it: ```bash diff --git a/docker-compose.yml b/docker-compose.yml index 4199e5a..d8293d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,10 +19,13 @@ services: - memu-network # Temporal server - # Note: Temporal uses the same database as the main app. - # TODO: For production, use a separate Temporal database or at minimum use - # different schemas within the same PostgreSQL instance. Sharing the same - # database can cause schema conflicts and is not recommended even for development. + # Note: Temporal shares the same PostgreSQL instance as the main app but uses + # a separate database (`TEMPORAL_DB`, default: `temporal`) from the app's + # database (`POSTGRES_DB`, default: `memu`). + # TODO: For production, consider using a separate PostgreSQL instance for Temporal + # or at minimum keep Temporal and the app in separate databases as configured here. + # Pointing both services at the same database can cause schema conflicts and is + # not recommended. temporal: image: temporalio/auto-setup:1.25.1 depends_on: From 1dbfe5c3f24bdb54049ab5048619437755d944ac Mon Sep 17 00:00:00 2001 From: Spark Zou Date: Wed, 28 Jan 2026 18:53:46 +0900 Subject: [PATCH 5/6] docs: fix PostgreSQL connection string format in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04df2f8..e0429a3 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ docker compose logs -f | Temporal UI | 8088 | Web management interface | **Default Configuration:** -- PostgreSQL: `postgres:postgres@localhost:5432/memu` +- PostgreSQL DSN: `postgresql://postgres:postgres@localhost:5432/memu` - Temporal Database: `temporal` (separate from app database) **Environment Variables (optional `.env` file):** From 7ec3bbcadd29945876342789a68b7b147b623777 Mon Sep 17 00:00:00 2001 From: Spark Zou Date: Thu, 29 Jan 2026 06:27:43 +0900 Subject: [PATCH 6/6] docs: clarify docker compose starts infrastructure only, not API server --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e0429a3..c704767 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,11 @@ Star memU-server to get notified about new releases and join our growing communi ``` The server runs on `http://127.0.0.1:8000`. -### Run with Docker Compose (Local Development) -Start the full local development environment with PostgreSQL and Temporal: +### Run local infrastructure with Docker Compose +Start local infrastructure dependencies (PostgreSQL and Temporal). Start the FastAPI API server separately (see "Run from source" above): ```bash -# Start all services (PostgreSQL, Temporal, Temporal UI) +# Start infrastructure services (PostgreSQL, Temporal, Temporal UI) docker compose up -d # View logs