Repository navigation
Expand file tree
/
Copy pathdocker-compose.public.yml
More file actions
262 lines (252 loc) · 8.53 KB
/
Copy pathdocker-compose.public.yml
File metadata and controls
262 lines (252 loc) · 8.53 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# ProjectCompass — End-User Full Stack (pre-built images)
#
# Usage: docker compose -f docker-compose.public.yml up -d
# Docs: https://github.com/GiacomoSaccaggi/ProjectCompass
#
# Default: core features only (analysis catalog, executions, schedules, k0s).
# Enable optional features via environment variables:
#
# AI Chat: PC_FEATURES__AI_CHAT=true (needs Mithril running)
# RAG: PC_FEATURES__RAG=true (needs Mithril for reranking)
# Pipeline: PC_FEATURES__PIPELINE_BUILDER=true
# RAWGraphs: PC_FEATURES__RAWGRAPHS=true
# Query Runner: PC_FEATURES__QUERY_RUNNER=true
# DB Connections: PC_FEATURES__DB_CONNECTIONS=true
# Todo: PC_FEATURES__TODO=true
# Demo mode: PC_DEMO__ENABLED=true PC_BRANDING__DEMO_NOTICE__ENABLED=true
services:
projectcompass:
image: ghcr.io/giacomosaccaggi/projectcompass:latest
ports:
- "${PC_PORT:-8080}:8080"
environment:
- SECRET_KEY=${SECRET_KEY:-change-me-to-a-random-string}
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
- ADMIN_PASSWORD_HASH=${ADMIN_PASSWORD_HASH:-}
- PORT=8080
- MITHRIL_HOST=http://mithril:16180
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-*}
- DB_CONNECTIONS_KEY=${DB_CONNECTIONS_KEY:-}
- DB_CONNECTIONS_MAX_ROWS=${DB_CONNECTIONS_MAX_ROWS:-100000}
# k0s cluster
- K8S_API_URL=https://k0s:6443
- K8S_VERIFY_SSL=false
- K8S_NAMESPACE=${K8S_NAMESPACE:-default}
- PC_WORKERS__AUTO_PROVISION=${PC_WORKERS__AUTO_PROVISION:-false}
- PC_WORKERS__AUTO_CLEANUP=${PC_WORKERS__AUTO_CLEANUP:-false}
# MinIO / S3 artifact store
- PC_S3_ENDPOINT=http://minio:9000
- PC_S3_ACCESS_KEY=${MINIO_ROOT_USER:-minioadmin}
- PC_S3_SECRET_KEY=${MINIO_ROOT_PASSWORD:-minioadmin}
- PC_S3_BUCKET=${PC_S3_BUCKET:-pc-artifacts}
# Docker registry
- PC_REGISTRY_HOST=${PC_REGISTRY_HOST:-localhost:5050}
- PC_REGISTRY_K8S_HOST=${PC_REGISTRY_K8S_HOST:-registry:5000}
# Optional: enable features (all default to false)
# - PC_FEATURES__AI_CHAT=true
# - PC_FEATURES__RAG=true
# - PC_FEATURES__PIPELINE_BUILDER=true
# - PC_FEATURES__RAWGRAPHS=true
# - PC_FEATURES__QUERY_RUNNER=true
# - PC_FEATURES__DB_CONNECTIONS=true
# - PC_FEATURES__TODO=true
# Optional: settings file
# - PC_CONFIG_FILE=/app/data/projectcompass.yaml
# - GUNICORN_WORKERS=${GUNICORN_WORKERS:-4}
# - GUNICORN_TIMEOUT=${GUNICORN_TIMEOUT:-120}
env_file:
- path: .env.k0s
required: false
volumes:
- ./data/Analyses:/app/Analyses
- ./data/Saved_data:/app/Saved_data
- ./data/Saved_queries:/app/Saved_queries
- ./data/tmp:/app/tmp
- /var/run/docker.sock:/var/run/docker.sock
# - ./projectcompass.yaml:/app/data/projectcompass.yaml:ro
restart: unless-stopped
depends_on:
mithril:
condition: service_healthy
k0s:
condition: service_healthy
registry:
condition: service_started
minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 5s
retries: 3
mithril:
image: ghcr.io/giacomosaccaggi/mithril:latest
ports:
- "${MITHRIL_PORT:-16180}:16180"
environment:
- MITHRIL_KEY_GEMINI=${MITHRIL_KEY_GEMINI:-}
- MITHRIL_KEY_OPENAI=${MITHRIL_KEY_OPENAI:-}
- MITHRIL_KEY_ANTHROPIC=${MITHRIL_KEY_ANTHROPIC:-}
- MITHRIL_KEY_GROQ=${MITHRIL_KEY_GROQ:-}
volumes:
- ./.mithril:/root/.mithril
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:16180/health"]
interval: 30s
timeout: 5s
retries: 3
mithril-init:
image: curlimages/curl
depends_on:
mithril:
condition: service_healthy
entrypoint: ["sh", "-c"]
command:
- |
echo "Pulling default local model..."
curl -sf http://mithril:16180/api/pull -d '{"name":"qwen2:1.5b"}' || echo "Model pull skipped"
restart: "no"
minio:
image: pgsty/silo:latest
hostname: minio
command: server /data --console-address ":9001"
ports:
- "${MINIO_API_PORT:-9002}:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
start_period: 10s
retries: 5
restart: unless-stopped
minio-init:
image: python:3.12-slim
depends_on:
minio:
condition: service_healthy
entrypoint: ["python", "-c"]
command:
- |
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "boto3"], stdout=subprocess.DEVNULL)
import boto3, os
from botocore.config import Config
s3 = boto3.client("s3", endpoint_url="http://minio:9000",
aws_access_key_id=os.environ.get("MINIO_ROOT_USER", "minioadmin"),
aws_secret_access_key=os.environ.get("MINIO_ROOT_PASSWORD", "minioadmin"),
config=Config(signature_version="s3v4"), region_name="us-east-1")
bucket = os.environ.get("PC_S3_BUCKET", "pc-artifacts")
try:
s3.create_bucket(Bucket=bucket)
print(f"Bucket {bucket} created.")
except Exception as e:
if "BucketAlreadyOwnedByYou" in str(e) or "BucketAlreadyExists" in str(e):
print(f"Bucket {bucket} already exists.")
else:
raise
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
PC_S3_BUCKET: ${PC_S3_BUCKET:-pc-artifacts}
restart: "no"
registry:
image: registry:2
hostname: registry
ports:
- "${REGISTRY_PORT:-5050}:5000"
volumes:
- registry-data:/var/lib/registry
restart: unless-stopped
k0s:
image: ${K0S_IMAGE:-docker.io/k0sproject/k0s:v1.31.3-k0s.0}
container_name: k0s
hostname: k0s
privileged: true
cgroup: host
command: ["k0s", "controller", "--enable-worker", "--no-taints"]
ports:
- "6443:6443"
volumes:
- k0s-data:/var/lib/k0s
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- ./k0s-registry.toml:/var/lib/k0s/containerd/config.d/registry.toml:ro
- ./k0s-hosts.d:/var/lib/k0s/containerd/hosts.d:ro
tmpfs:
- /run
healthcheck:
test: ["CMD", "k0s", "status"]
interval: 10s
timeout: 5s
start_period: 40s
retries: 12
restart: unless-stopped
k0s-worker-1:
image: ${K0S_IMAGE:-docker.io/k0sproject/k0s:v1.31.3-k0s.0}
container_name: k0s-worker-1
hostname: k0s-worker-1
privileged: true
cgroup: host
entrypoint: ["/bin/sh", "-c"]
command:
- |
mkdir -p /etc/containerd
cat > /etc/containerd/config.toml <<'EOF'
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."registry:5000"]
endpoint = ["http://registry:5000"]
EOF
echo "Waiting for join token..."
while [ ! -f /run/k0s-tokens/worker ]; do sleep 3; done
echo "Token found, joining cluster..."
exec k0s worker --token-file /run/k0s-tokens/worker
volumes:
- k0s-tokens:/run/k0s-tokens:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
tmpfs:
- /run
depends_on:
k0s:
condition: service_healthy
registry:
condition: service_started
restart: unless-stopped
k0s-worker-2:
image: ${K0S_IMAGE:-docker.io/k0sproject/k0s:v1.31.3-k0s.0}
container_name: k0s-worker-2
hostname: k0s-worker-2
privileged: true
cgroup: host
entrypoint: ["/bin/sh", "-c"]
command:
- |
mkdir -p /etc/containerd
cat > /etc/containerd/config.toml <<'EOF'
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."registry:5000"]
endpoint = ["http://registry:5000"]
EOF
echo "Waiting for join token..."
while [ ! -f /run/k0s-tokens/worker ]; do sleep 3; done
echo "Token found, joining cluster..."
exec k0s worker --token-file /run/k0s-tokens/worker
volumes:
- k0s-tokens:/run/k0s-tokens:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
tmpfs:
- /run
depends_on:
k0s:
condition: service_healthy
registry:
condition: service_started
restart: unless-stopped
volumes:
k0s-data:
k0s-tokens:
registry-data:
minio-data: