Repository navigation
Expand file tree
/
Copy pathdocker.html
More file actions
260 lines (243 loc) · 12.2 KB
/
Copy pathdocker.html
File metadata and controls
260 lines (243 loc) · 12.2 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
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Docker & Production Deployment — ProjectCompass Docs</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
<link rel="stylesheet" href="assets/docs.css">
</head>
<body>
<header class="top-nav">
<div class="top-nav-inner">
<a href="../index.html" class="brand-link">
<svg class="compass-mini" viewBox="0 0 36 36" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="18" cy="18" r="15.5" stroke="currentColor" stroke-width="1.6" stroke-dasharray="3 2" opacity="0.6"/>
<circle cx="18" cy="18" r="13" stroke="currentColor" stroke-width="1.5"/>
<path d="M18 7 L18 24" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
<path d="M18 8 L26 22 L18 22 Z" fill="currentColor" fill-opacity="0.32" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/>
<path d="M16.5 10.5 L11 22 L16.5 22 Z" fill="#fbbf24" fill-opacity="0.45" stroke="#fbbf24" stroke-width="1.2" stroke-linejoin="round"/>
<path d="M10 24.5 L26 24.5 L23.5 27.5 L12.5 27.5 Z" fill="currentColor" fill-opacity="0.5" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>
</svg>
<span>ProjectCompass</span>
<span class="brand-tag">⛵ Regatta Docs</span>
</a>
<div class="nav-actions">
<button type="button" id="theme-toggle" class="theme-toggle-btn">
<span aria-hidden="true">⛵</span> <span>Day Sail</span>
</button>
<button type="button" class="nav-toggle" id="nav-toggle" aria-label="Toggle navigation">
<svg class="icon-menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
<svg class="icon-close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="6" x2="18" y2="18"/><line x1="6" y1="18" x2="18" y2="6"/></svg>
<span class="nav-toggle-label-open">Menu</span>
<span class="nav-toggle-label-close">Close</span>
</button>
</div>
</div>
</header>
<nav class="nav-links" id="nav-links" aria-label="Primary Documentation Navigation">
<span class="nav-group-label">Getting Started</span>
<a href="../index.html">Hub</a>
<a href="overview.html">Overview</a>
<a href="user_guide.html">User Guide</a>
<span class="nav-separator"></span>
<span class="nav-group-label">Architecture</span>
<a href="architecture.html">Architecture</a>
<a href="core_classes.html">Core Classes</a>
<a href="templates.html">Templates</a>
<a href="routes.html">API & CLI</a>
<span class="nav-separator"></span>
<span class="nav-group-label">Infrastructure</span>
<a href="k0s_setup.html">k0s Setup</a>
<a href="kubernetes_console.html">K8s Console</a>
<a href="worker_library.html">Worker Library</a>
<span class="nav-separator"></span>
<span class="nav-group-label">Operations</span>
<a href="configuration.html">Config</a>
<a href="docker.html" class="active">Docker</a>
<a href="demo/index.html" class="nav-demo">🚀 Demo</a>
</nav>
<div class="nav-overlay" id="nav-overlay"></div><section class="page-header">
<div class="page-header-inner">
<div class="breadcrumb">
<a href="../index.html">⛵ Command Deck</a>
<span>/</span>
<span>Pillar IV: Sextant, Logbook & Harbor Ops</span>
<span>/</span>
<span>Docker & Production Deployment</span>
</div>
<h1>Docker Compose, Mithril Sidecar & Production Deployment</h1>
<p class="lead">
How to berth ProjectCompass and the Mithril multi-model LLM engine with Docker Compose, configure persistent volumes (`DATA_DIR=/app/data`), run health checks, and harden production deployments.
</p>
<div class="page-meta-badges">
<span class="badge badge-cyan">11 • Drydock & Berth</span>
<span class="badge badge-emerald">Docker Compose + Mithril</span>
<span class="badge badge-gold">Production Checklist</span>
</div>
</div>
</section>
<div class="docs-layout">
<main class="docs-content">
<h2 id="services-overview">1. Container Services Architecture</h2>
<p>
ProjectCompass ships with multi-profile Docker Compose configurations pairing the Gunicorn-served Flask application with <a href="https://giacomosaccaggi.github.io/Mithril/" target="_blank" rel="noopener"><strong>Mithril</strong></a>:
</p>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Service Name</th>
<th>Container Image</th>
<th>Host Port</th>
<th>Internal Port</th>
<th>Role</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>projectcompass_app</code></td>
<td><code>ghcr.io/giacomosaccaggi/projectcompass:latest</code> (or local <code>Dockerfile</code>)</td>
<td><code>8080</code></td>
<td><code>5000</code></td>
<td>ProjectCompass Master web UI, REST API, DuckDB/ConnectorX engine, and APScheduler leader.</td>
</tr>
<tr>
<td><code>mithril</code></td>
<td><code>ghcr.io/giacomosaccaggi/mithril:latest</code></td>
<td><code>16180</code></td>
<td><code>16180</code></td>
<td>Multi-model LLM orchestration & cross-encoder reranking engine (Gemini, OpenAI, Anthropic, Groq, local GGUF).</td>
</tr>
</tbody>
</table>
</div>
<h2 id="compose-variants">2. Docker Compose Variants & Quick Start</h2>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Compose File</th>
<th>Target Environment</th>
<th>Launch Command</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>docker-compose.public.yml</code></td>
<td>Zero-clone evaluation using pre-built GHCR images</td>
<td><code>docker compose -f docker-compose.public.yml up -d</code></td>
</tr>
<tr>
<td><code>docker-compose.yml</code> + <code>docker-compose.override.yml</code></td>
<td>Local development with live host bind mounts</td>
<td><code>docker compose up -d</code></td>
</tr>
<tr>
<td><code>docker-compose.yml</code> + <code>docker-compose.prod.yml</code></td>
<td>Production deployment with restart policies & resource caps</td>
<td><code>docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d</code></td>
</tr>
</tbody>
</table>
</div>
<pre><code class="language-bash"># 1. Start both ProjectCompass (:8080) and Mithril (:16180)
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# 2. Stream container logs
docker compose logs -f projectcompass_app
# 3. Verify health check endpoints
curl -fsSL http://localhost:8080/health
curl -fsSL http://localhost:8080/check</code></pre>
<h2 id="volumes-and-persistence">3. Persistent Volumes & State Layout</h2>
<p>
To ensure SQLite databases (`projectcompass.db`, `scheduler_jobs.db`), ChromaDB RAG embeddings (`rag_data/`), encrypted DB connection keys (`tmp/.db_connections.key`), and catalog analyses survive container upgrades, mount `/app/data` (or individual directories) persistently:
</p>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Host Path / Volume</th>
<th>Container Path</th>
<th>Persisted Artifacts</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>./data</code> (or named volume)</td>
<td><code>/app/data</code> (<code>DATA_DIR</code>)</td>
<td><code>projectcompass.db</code>, <code>scheduler_jobs.db</code>, <code>rag_data/</code>, <code>tmp/.db_connections.key</code>, <code>projectcompass.yaml</code></td>
</tr>
<tr>
<td><code>./Analyses</code></td>
<td><code>/app/Analyses</code></td>
<td>Catalog analysis folders, Structured Analyses, Pipeline configs, and k0s Flow scripts (`flow.py`)</td>
</tr>
<tr>
<td><code>./Saved_data</code> & <code>./Saved_queries</code></td>
<td><code>/app/Saved_data</code> & <code>/app/Saved_queries</code></td>
<td>Uploaded CSV/SQLite datasets and saved `.sql` files</td>
</tr>
<tr>
<td><code>./logs</code></td>
<td><code>/app/log</code></td>
<td>Structured application and Gunicorn access/error logs</td>
</tr>
<tr>
<td><code>./.mithril</code></td>
<td><code>/root/.mithril</code></td>
<td>Mithril provider configuration and cached local model weights</td>
</tr>
</tbody>
</table>
</div>
<h2 id="production-hardening">4. Production Hardening Checklist</h2>
<div class="callout callout-helm">
<div class="callout-title">🛡️ Helm Control — Mandatory Pre-Flight Checklist</div>
<ul>
<li><strong>Set Fixed Cryptographic Keys</strong>: Always provide persistent <code>SECRET_KEY</code> and <code>DB_CONNECTIONS_KEY</code> in `.env` so sessions and encrypted ConnectorX database credentials remain valid across container recreations.</li>
<li><strong>Configure Admin & Bearer Credentials</strong>: Set <code>ADMIN_PASSWORD_HASH</code> (generated via <code>werkzeug.security.generate_password_hash</code>) or complete the <code>/setup</code> wizard immediately on first boot.</li>
<li><strong>Single Scheduler Leader</strong>: When scaling Gunicorn workers inside a single container, `acquire_scheduler_lock()` (`fcntl.flock` on `/app/data/tmp/scheduler.lock`) guarantees only one worker executes cron jobs. Do not run multiple independent container replicas against the same SQLite file.</li>
<li><strong>Mount Kubeconfig for External k0s Master</strong>: If ProjectCompass runs in Docker and orchestrates a host or remote k0s cluster, mount the readable kubeconfig file into the container and set <code>KUBECONFIG_PATH=/app/data/k0s-compass.conf</code>.</li>
</ul>
</div>
<div class="page-pager">
<a href="configuration.html" class="pager-link">
<span class="pager-label">← Previous</span>
<span class="pager-title">Configuration & RBAC Reference</span>
</a>
<a href="../index.html" class="pager-link" style="text-align: right;">
<span class="pager-label">Return to Hub →</span>
<span class="pager-title">Nautical Command Deck (index.html)</span>
</a>
</div>
</main>
<aside class="docs-toc" aria-label="On this page">
<div class="docs-toc-title">🧭 On This Page</div>
<ul id="toc-list"></ul>
</aside>
</div>
<footer class="site-footer">
<div class="site-footer-inner">
<div>
<strong>ProjectCompass</strong> — <em>Organization Is Everything®</em> • By
<a href="https://giacomosaccaggi.github.io/" target="_blank" rel="noopener">Giacomo Saccaggi</a>
</div>
<div class="footer-links">
<a href="../index.html">Hub</a>
<a href="overview.html">Overview</a>
<a href="k0s_setup.html">k0s Setup</a>
<a href="worker_library.html">Worker Library</a>
<a href="routes.html">API & CLI</a>
<a href="configuration.html">Config</a>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<script src="assets/docs.js"></script>
</body>
</html>