Skip to content

Commit 0e5d621

Browse files
committed
chore: added db deployment config
1 parent b5a8f2a commit 0e5d621

3 files changed

Lines changed: 67 additions & 61 deletions

File tree

src/server/db/.env.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REDIS_PASSWORD=your_redis_password_here
2+
POSTGRES_USER=your_postgres_user_here
3+
POSTGRES_PASSWORD=your_postgres_password_here
4+
POSTGRES_DB=your_postgres_db_here

src/server/db/docker-compose.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# src/docker-compose.databases.yaml
2+
# This file should be deployed on your dedicated Database VM.
3+
# You will need a .env file in the same directory with:
4+
# REDIS_PASSWORD, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB
5+
6+
services:
7+
redis:
8+
image: redis:7-alpine
9+
container_name: redis-db
10+
restart: unless-stopped
11+
command: redis-server --requirepass "${REDIS_PASSWORD}"
12+
volumes:
13+
- redis-data:/data
14+
ports:
15+
# Expose Redis to the host machine so the Server VM can connect
16+
- "6379:6379"
17+
networks:
18+
- db_network
19+
env_file:
20+
- ./.env
21+
22+
postgres:
23+
image: pgvector/pgvector:pg16
24+
container_name: sentient-postgres-prod
25+
restart: unless-stopped
26+
environment:
27+
POSTGRES_USER: ${POSTGRES_USER}
28+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
29+
POSTGRES_DB: ${POSTGRES_DB}
30+
volumes:
31+
- postgres-data:/var/lib/postgresql/data
32+
ports:
33+
# Expose PostgreSQL to the host machine
34+
- "5432:5432"
35+
networks:
36+
- db_network
37+
38+
chroma:
39+
image: chromadb/chroma
40+
container_name: sentient-chroma-prod
41+
restart: unless-stopped
42+
ports:
43+
# Expose Chroma to the host machine on port 8002
44+
- "8002:8000"
45+
volumes:
46+
- chroma-data:/chroma/.chroma/index
47+
networks:
48+
- db_network
49+
50+
networks:
51+
db_network:
52+
driver: bridge
53+
54+
volumes:
55+
redis-data:
56+
postgres-data:
57+
chroma-data:

src/server/docker-compose.yaml

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# src/server/docker-compose.yaml
2-
# This docker-compose file is intended for a production-like deployment on a single VM.
3-
# It orchestrates the main application server along with all its required backend services
4-
# (Redis, WAHA for WhatsApp, PostgreSQL for Memory, and ChromaDB for vector storage).
2+
# This docker-compose file is for deploying the application server on a dedicated Server VM.
3+
# It should connect to databases running on a separate Database VM.
54

65
services:
76
# 1. The Main Sentient Application (FastAPI, Nginx, Celery, MCPs)
@@ -22,30 +21,12 @@ services:
2221
# This is the primary public-facing port for your entire application.
2322
- "5000:80"
2423
depends_on:
25-
- postgres
26-
- chroma
27-
- redis
2824
- waha
25+
- litellm
2926
networks:
3027
- sentient_network
3128

32-
# 2. Redis for Celery Broker & Backend
33-
redis:
34-
image: redis:7-alpine
35-
container_name: redis-db
36-
restart: unless-stopped
37-
# Use the password from the .env file, ensuring it's quoted
38-
command: redis-server --requirepass "${REDIS_PASSWORD}"
39-
volumes:
40-
# Use a named volume for persistent Redis data
41-
- redis-data:/data
42-
networks:
43-
- sentient_network
44-
env_file:
45-
- ./.env
46-
# No ports are exposed to the host. Communication is internal and secure.
47-
48-
# 3. WAHA (WhatsApp HTTP API) Service
29+
# 2. WAHA (WhatsApp HTTP API) Service
4930
waha:
5031
image: devlikeapro/waha:noweb
5132
container_name: waha-notifier
@@ -59,38 +40,8 @@ services:
5940
- ./.env
6041
ports:
6142
- "8000:3000"
62-
# No ports are exposed to the host. The sentient-app communicates with it internally.
63-
64-
# 4. PostgreSQL for Memory MCP
65-
postgres:
66-
image: pgvector/pgvector:pg16
67-
container_name: sentient-postgres-prod
68-
restart: unless-stopped
69-
environment:
70-
# These variables should be defined in your .env file
71-
POSTGRES_USER: ${POSTGRES_USER}
72-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
73-
POSTGRES_DB: ${POSTGRES_DB}
74-
volumes:
75-
- postgres-data:/var/lib/postgresql/data
76-
ports:
77-
- "5432:5432" # Maps your local port 5432 to the container's port 5432
78-
networks:
79-
- sentient_network
80-
81-
# 5. ChromaDB for Vector Storage
82-
chroma:
83-
image: chromadb/chroma
84-
container_name: sentient-chroma-prod
85-
restart: unless-stopped
86-
ports:
87-
- "8002:8000" # Expose Chroma's port for debugging if needed
88-
volumes:
89-
- chroma-data:/chroma/.chroma/index
90-
networks:
91-
- sentient_network
9243

93-
# 6. LiteLLM Proxy for Gemini Models
44+
# 3. LiteLLM Proxy for Gemini Models
9445
litellm:
9546
image: ghcr.io/berriai/litellm:main-latest # Use the latest stable image
9647
container_name: litellm-proxy
@@ -102,9 +53,6 @@ services:
10253
command: ["--config", "/app/config.yaml", "--port", "4000"] # Run with config; optional: add "--detailed_debug"
10354
env_file:
10455
- ./.env # Loads GEMINI_API_KEY and others
105-
# depends_on: [] # No dependencies needed, but add if required (e.g., for a DB)
106-
# ports: # Optional: Expose if you need external access (e.g., for testing)
107-
# - "4000:4000"
10856

10957
# Defines the shared network for all services
11058
networks:
@@ -113,7 +61,4 @@ networks:
11361

11462
# Defines the named volumes for data persistence
11563
volumes:
116-
redis-data:
117-
waha-sessions:
118-
postgres-data:
119-
chroma-data:
64+
waha-sessions:

0 commit comments

Comments
 (0)