Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
127 lines (116 loc) · 3.84 KB
/
Copy pathdocker-compose.yml
File metadata and controls
127 lines (116 loc) · 3.84 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
# Enterprise RAG & Knowledge Intelligence Platform — single-server deployment.
# cp .env.example .env # set secrets!
# docker compose up -d --build
# Services: postgres(+pgvector) · redis · minio(S3) · migrate (one-shot) · api · worker · web · caddy (TLS)
name: knowledge-intelligence
x-backend: &backend
build: { context: ./backend }
image: knowledge-intelligence/backend:3.0.0
env_file: .env
environment:
DATABASE_URL: postgresql+psycopg://${APP_DB_USER:-rag_app}:${APP_DB_PASSWORD}@postgres:5432/${APP_DB_NAME:-rag}
REDIS_URL: redis://redis:6379/0
EVENT_BACKEND: redis
JOB_BACKEND: external
STORAGE_BACKEND: s3
S3_ENDPOINT_URL: http://minio:9000
S3_ACCESS_KEY: ${MINIO_ROOT_USER}
S3_SECRET_KEY: ${MINIO_ROOT_PASSWORD}
S3_BUCKET: ${S3_BUCKET:-rag-documents}
ENVIRONMENT: ${ENVIRONMENT:-prod}
restart: unless-stopped
services:
postgres:
image: pgvector/pgvector:pg16
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_SUPERUSER_PASSWORD}
APP_DB_USER: ${APP_DB_USER:-rag_app}
APP_DB_PASSWORD: ${APP_DB_PASSWORD}
APP_DB_NAME: ${APP_DB_NAME:-rag}
volumes:
- pgdata:/var/lib/postgresql/data
- ./deploy/postgres/10-init.sh:/docker-entrypoint-initdb.d/10-init.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
redis:
image: redis:7.4-alpine
command: ["redis-server", "--appendonly", "yes", "--save", "60", "100"]
volumes: [redisdata:/data]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
retries: 20
restart: unless-stopped
minio:
image: minio/minio:RELEASE.2025-04-22T22-12-26Z
command: ["server", "/data", "--console-address", ":9001"]
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
volumes: [miniodata:/data]
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
retries: 20
restart: unless-stopped
minio-init:
image: minio/mc:RELEASE.2025-04-16T18-13-26Z
depends_on: { minio: { condition: service_healthy } }
entrypoint: >
/bin/sh -c "mc alias set local http://minio:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD} &&
mc mb --ignore-existing local/$${S3_BUCKET:-rag-documents} &&
mc anonymous set none local/$${S3_BUCKET:-rag-documents}"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
S3_BUCKET: ${S3_BUCKET:-rag-documents}
migrate:
<<: *backend
command: ["sh", "-c", "alembic upgrade head && python scripts/bootstrap_admin.py"]
restart: "no"
depends_on:
postgres: { condition: service_healthy }
api:
<<: *backend
depends_on:
migrate: { condition: service_completed_successfully }
redis: { condition: service_healthy }
minio-init: { condition: service_completed_successfully }
worker:
<<: *backend
command: ["python", "-m", "app.jobs.worker"]
healthcheck:
disable: true
depends_on:
migrate: { condition: service_completed_successfully }
redis: { condition: service_healthy }
minio-init: { condition: service_completed_successfully }
web:
build:
context: ./frontend
args: { BACKEND_URL: "http://api:8000" }
image: knowledge-intelligence/frontend:3.0.0
depends_on: [api]
restart: unless-stopped
caddy:
image: caddy:2.9-alpine
ports: ["80:80", "443:443"]
environment:
DOMAIN: ${DOMAIN:-localhost}
volumes:
- ./deploy/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
depends_on: [web, api]
restart: unless-stopped
volumes:
pgdata:
redisdata:
miniodata:
caddy_data:
caddy_config: