-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
120 lines (114 loc) · 3.3 KB
/
docker-compose.yml
File metadata and controls
120 lines (114 loc) · 3.3 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
version: "3.9"
services:
postgres:
image: pgvector/pgvector:pg16
environment:
POSTGRES_DB: ${POSTGRES_DB:-sankhya}
POSTGRES_USER: ${POSTGRES_USER:-sankhya}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-sankhya}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-sankhya} -d ${POSTGRES_DB:-sankhya}"]
interval: 10s
timeout: 5s
retries: 10
redis:
image: redis:7.2-alpine
ports:
- "${REDIS_PORT:-6379}:6379"
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 10
backend:
build:
context: ./backend
env_file:
- .env
environment:
APP_DATABASE_URL: postgresql+psycopg://sankhya:sankhya@postgres:5432/sankhya
APP_REDIS_URL: redis://redis:6379/0
APP_CORS_ORIGINS: '["http://localhost:3000","http://frontend:3000"]'
APP_GEMINI_API_KEY: ${GEMINI_API_KEY}
APP_GEMINI_MODEL: ${GEMINI_MODEL:-gemini-1.5-flash}
APP_GEMINI_FALLBACK_MODEL: gemini-1.5-pro
APP_GEMINI_EMBEDDING_MODEL: ${GEMINI_EMBEDDING_MODEL:-text-embedding-004}
command: >
sh -c "alembic upgrade head &&
python scripts/seed.py &&
uvicorn app.main:app --host 0.0.0.0 --port 8000"
ports:
- "${BACKEND_PORT:-8000}:8000"
volumes:
- ./backend:/app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/health/live', timeout=3)"]
interval: 20s
timeout: 5s
retries: 10
worker:
build:
context: ./backend
env_file:
- .env
environment:
APP_DATABASE_URL: postgresql+psycopg://sankhya:sankhya@postgres:5432/sankhya
APP_REDIS_URL: redis://redis:6379/0
APP_GEMINI_API_KEY: ${GEMINI_API_KEY}
APP_GEMINI_MODEL: ${GEMINI_MODEL:-gemini-1.5-flash}
APP_GEMINI_FALLBACK_MODEL: gemini-1.5-pro
APP_GEMINI_EMBEDDING_MODEL: ${GEMINI_EMBEDDING_MODEL:-text-embedding-004}
command: ["python", "-m", "app.workers.runner"]
volumes:
- ./backend:/app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "print('worker-ok')"]
interval: 30s
timeout: 5s
retries: 3
frontend:
build:
context: ./frontend
env_file:
- .env
environment:
NEXT_PUBLIC_API_BASE_URL: http://localhost:8000/api/v1
PORT: 3000
command: >
sh -c "npm install &&
npm run dev -- --hostname 0.0.0.0 --port 3000"
ports:
- "${FRONTEND_PORT:-3000}:3000"
volumes:
- ./frontend:/app
- /app/node_modules
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000').then(()=>process.exit(0)).catch(()=>process.exit(1))"]
interval: 20s
timeout: 5s
retries: 10
volumes:
postgres_data:
redis_data: