-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
129 lines (120 loc) · 3.3 KB
/
Copy pathdocker-compose.yml
File metadata and controls
129 lines (120 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
121
122
123
124
125
126
127
128
129
version: "3.9"
# 默认 profile: backend + frontend + redis
# 启动带 Postgres: docker compose --profile pg up -d
# 启动带 LangFuse: docker compose --profile observability up -d
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: unikb-backend
image: unikb-backend:latest
ports:
- "8000:8000"
env_file: ./backend/.env
environment:
- DATABASE_URL=${DATABASE_URL:-sqlite:///./data/unikb.db}
- REDIS_URL=redis://redis:6379/0
volumes:
- ./data:/app/data
- ./backend/mcp_servers.json:/app/mcp_servers.json:ro
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_started
required: false
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/api/v1/health').status==200 else 1)"]
interval: 15s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
networks: [unikb-net]
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: unikb-frontend
image: unikb-frontend:latest
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_API_BASE=http://backend:8000
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
networks: [unikb-net]
redis:
image: redis:7-alpine
container_name: unikb-redis
ports:
- "6379:6379"
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
networks: [unikb-net]
# 可选: Postgres (启用: docker compose --profile pg up -d)
postgres:
profiles: ["pg"]
image: postgres:16-alpine
container_name: unikb-postgres
environment:
- POSTGRES_USER=unikb
- POSTGRES_PASSWORD=unikb
- POSTGRES_DB=unikb
ports:
- "5432:5432"
volumes:
- pg-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U unikb -d unikb"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
networks: [unikb-net]
# 可选: LangFuse 自托管 (启用: docker compose --profile observability up -d)
langfuse-web:
profiles: ["observability"]
image: langfuse/langfuse:2
container_name: unikb-langfuse
ports:
- "3001:3000"
environment:
- DATABASE_URL=postgresql://postgres:postgres@langfuse-db:5432/langfuse
- NEXTAUTH_URL=http://localhost:3001
- NEXTAUTH_SECRET=unikb-langfuse-secret
- ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
- TELEMETRY_ENABLED=false
depends_on:
- langfuse-db
restart: unless-stopped
networks: [unikb-net]
langfuse-db:
profiles: ["observability"]
image: postgres:16-alpine
container_name: unikb-langfuse-db
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=langfuse
volumes:
- langfuse-pg:/var/lib/postgresql/data
restart: unless-stopped
networks: [unikb-net]
volumes:
redis-data:
pg-data:
langfuse-pg:
networks:
unikb-net:
driver: bridge