Files
Memoh/assets/installation_docker.md.BA7jSLuf.js
T
2026-03-01 10:01:41 +00:00

17 lines
21 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as i,o as a,c as e,ag as t}from"./chunks/framework.ePeAWSvT.js";const k=JSON.parse('{"title":"Docker Installation","description":"","frontmatter":{},"headers":[],"relativePath":"installation/docker.md","filePath":"installation/docker.md","lastUpdated":1772359263000}'),n={name:"installation/docker.md"};function o(l,s,d,r,h,p){return a(),e("div",null,[...s[0]||(s[0]=[t(`<h1 id="docker-installation" tabindex="-1">Docker Installation <a class="header-anchor" href="#docker-installation" aria-label="Permalink to &quot;Docker Installation&quot;"></a></h1><p>Docker is the recommended way to run Memoh. The stack includes PostgreSQL, Qdrant, the main server (with embedded Containerd), agent gateway, and web UI — all orchestrated via Docker Compose. You do not need to install containerd, nerdctl, or buildkit on your host; everything runs inside containers.</p><h2 id="prerequisites" tabindex="-1">Prerequisites <a class="header-anchor" href="#prerequisites" aria-label="Permalink to &quot;Prerequisites&quot;"></a></h2><ul><li><a href="https://docs.docker.com/get-docker/" target="_blank" rel="noreferrer">Docker</a></li><li><a href="https://docs.docker.com/compose/install/" target="_blank" rel="noreferrer">Docker Compose v2</a></li><li>Git</li></ul><h2 id="one-click-install-recommended" tabindex="-1">One-Click Install (Recommended) <a class="header-anchor" href="#one-click-install-recommended" aria-label="Permalink to &quot;One-Click Install (Recommended)&quot;"></a></h2><p>Run the official install script (requires Docker and Docker Compose):</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -fsSL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://memoh.sh</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> sh</span></span></code></pre></div><p>The script will:</p><ol><li>Check for Docker and Docker Compose</li><li>Prompt for configuration (workspace, data directory, admin credentials, JWT secret, Postgres password, China mirror)</li><li>Clone the repository</li><li>Generate <code>config.toml</code> from the Docker template with your settings</li><li>Write a <code>.env</code> file with <code>POSTGRES_PASSWORD</code> and <code>MEMOH_CONFIG</code></li><li>Pull images and start all services</li></ol><p><strong>Silent install</strong> (use all defaults, no prompts):</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -fsSL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://memoh.sh</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> sh</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -y</span></span></code></pre></div><p>Defaults when running silently:</p><ul><li>Workspace: <code>~/memoh</code></li><li>Data directory: <code>~/memoh/data</code></li><li>Admin: <code>admin</code> / <code>admin123</code></li><li>JWT secret: auto-generated</li><li>Postgres password: <code>memoh123</code></li></ul><h2 id="manual-install" tabindex="-1">Manual Install <a class="header-anchor" href="#manual-install" aria-label="Permalink to &quot;Manual Install&quot;"></a></h2><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> clone</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --depth</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 1</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/memohai/Memoh.git</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Memoh</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> conf/app.docker.toml</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> config.toml</span></span></code></pre></div><p>Edit <code>config.toml</code> — at minimum change:</p><ul><li><code>admin.password</code> — Admin password</li><li><code>auth.jwt_secret</code> — Generate with <code>openssl rand -base64 32</code></li><li><code>postgres.password</code> — Database password (must match the <code>POSTGRES_PASSWORD</code> env var)</li></ul><p>Then start:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POSTGRES_PASSWORD=your-db-password</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span></span></code></pre></div><p>Alternatively, create a <code>.env</code> file in the project root:</p><div class="language-env vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">env</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>POSTGRES_PASSWORD=your-db-password</span></span>
<span class="line"><span>MEMOH_CONFIG=./config.toml</span></span></code></pre></div><p>Then simply run:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span></span></code></pre></div><blockquote><p>On macOS or if your user is in the <code>docker</code> group, <code>sudo</code> is not required.</p></blockquote><blockquote><p><strong>Important</strong>: <code>docker-compose.yml</code> mounts <code>\${MEMOH_CONFIG:-./config.toml}</code> into the containers. You must create this file before starting — running without it will fail.</p></blockquote><h3 id="china-mainland-mirror" tabindex="-1">China Mainland Mirror <a class="header-anchor" href="#china-mainland-mirror" aria-label="Permalink to &quot;China Mainland Mirror&quot;"></a></h3><p>For users in mainland China who cannot access Docker Hub directly, uncomment the <code>registry</code> line in <code>config.toml</code>:</p><div class="language-toml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">toml</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">mcp</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">registry = </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;memoh.cn&quot;</span></span></code></pre></div><p>And use the China mirror compose overlay:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> docker-compose.yml</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> docker/docker-compose.cn.yml</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span></span></code></pre></div><p>The install script handles this automatically when you answer &quot;yes&quot; to the China mirror prompt.</p><h2 id="service-architecture" tabindex="-1">Service Architecture <a class="header-anchor" href="#service-architecture" aria-label="Permalink to &quot;Service Architecture&quot;"></a></h2><p>Docker Compose starts the following services:</p><table tabindex="0"><thead><tr><th>Service</th><th>Image</th><th>Description</th></tr></thead><tbody><tr><td><code>postgres</code></td><td><code>postgres:18-alpine</code></td><td>PostgreSQL database</td></tr><tr><td><code>qdrant</code></td><td><code>qdrant/qdrant:latest</code></td><td>Qdrant vector database for memory semantic search</td></tr><tr><td><code>migrate</code></td><td><code>memohai/server:latest</code></td><td>One-shot service — runs database migrations, then exits</td></tr><tr><td><code>server</code></td><td><code>memohai/server:latest</code></td><td>Main backend with embedded Containerd (privileged)</td></tr><tr><td><code>agent</code></td><td><code>memohai/agent:latest</code></td><td>Agent Gateway (Bun/Elysia) for AI chat, tool execution, and SSE streaming</td></tr><tr><td><code>web</code></td><td><code>memohai/web:latest</code></td><td>Web UI (Vue 3 + Nginx)</td></tr></tbody></table><p>Startup order: <code>postgres</code> and <code>qdrant</code> start first; once healthy, <code>migrate</code> runs database migrations; after migration completes, <code>server</code> starts; finally <code>agent</code> and <code>web</code> come up.</p><h2 id="access-points" tabindex="-1">Access Points <a class="header-anchor" href="#access-points" aria-label="Permalink to &quot;Access Points&quot;"></a></h2><p>After startup:</p><table tabindex="0"><thead><tr><th>Service</th><th>URL</th></tr></thead><tbody><tr><td>Web UI</td><td><a href="http://localhost:8082" target="_blank" rel="noreferrer">http://localhost:8082</a></td></tr><tr><td>API</td><td><a href="http://localhost:8080" target="_blank" rel="noreferrer">http://localhost:8080</a></td></tr><tr><td>Agent Gateway</td><td><a href="http://localhost:8081" target="_blank" rel="noreferrer">http://localhost:8081</a></td></tr></tbody></table><p>Default login: <code>admin</code> / <code>admin123</code> (change this in <code>config.toml</code>).</p><p>First startup may take 12 minutes while images are pulled and services initialize.</p><h2 id="data-persistence" tabindex="-1">Data Persistence <a class="header-anchor" href="#data-persistence" aria-label="Permalink to &quot;Data Persistence&quot;"></a></h2><p>All persistent data is stored in Docker named volumes:</p><table tabindex="0"><thead><tr><th>Volume</th><th>Description</th></tr></thead><tbody><tr><td><code>postgres_data</code></td><td>PostgreSQL database files</td></tr><tr><td><code>qdrant_data</code></td><td>Qdrant vector storage</td></tr><tr><td><code>containerd_data</code></td><td>Containerd image store and snapshots</td></tr><tr><td><code>memoh_data</code></td><td>Bot container data (mounted at <code>/opt/memoh/data</code> inside the server)</td></tr><tr><td><code>server_cni_state</code></td><td>CNI network state for container networking</td></tr></tbody></table><p>These volumes survive <code>docker compose down</code>. To fully reset all data, run:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> down</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -v</span></span></code></pre></div><h2 id="common-commands" tabindex="-1">Common Commands <a class="header-anchor" href="#common-commands" aria-label="Permalink to &quot;Common Commands&quot;"></a></h2><blockquote><p>Prefix with <code>sudo</code> on Linux if your user is not in the <code>docker</code> group.</p></blockquote><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Start</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> down</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Stop</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> logs</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -f</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # View logs</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> logs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> server</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # View a specific service&#39;s logs</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ps</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Status</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pull</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &amp;&amp; </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Update to latest images</span></span></code></pre></div><h2 id="upgrading" tabindex="-1">Upgrading <a class="header-anchor" href="#upgrading" aria-label="Permalink to &quot;Upgrading&quot;"></a></h2><p>To upgrade to the latest version:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/Memoh</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pull</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pull</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span></span></code></pre></div><p>The <code>migrate</code> service runs automatically on every startup, applying any new database migrations.</p><h2 id="environment-variables" tabindex="-1">Environment Variables <a class="header-anchor" href="#environment-variables" aria-label="Permalink to &quot;Environment Variables&quot;"></a></h2><table tabindex="0"><thead><tr><th>Variable</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>POSTGRES_PASSWORD</code></td><td><code>memoh123</code></td><td>PostgreSQL password (must match <code>postgres.password</code> in <code>config.toml</code>)</td></tr><tr><td><code>MEMOH_CONFIG</code></td><td><code>./config.toml</code></td><td>Path to the configuration file</td></tr></tbody></table><h2 id="production-checklist" tabindex="-1">Production Checklist <a class="header-anchor" href="#production-checklist" aria-label="Permalink to &quot;Production Checklist&quot;"></a></h2><ol><li><strong>Passwords</strong> — Change all default passwords and secrets in <code>config.toml</code></li><li><strong>HTTPS</strong> — Configure SSL (e.g. via <code>docker-compose.override.yml</code> with certs or a reverse proxy)</li><li><strong>Firewall</strong> — Restrict access to necessary ports</li><li><strong>Resource limits</strong> — Set memory/CPU limits for containers</li><li><strong>Backups</strong> — Regular backups of Postgres and Qdrant data volumes</li></ol><h2 id="troubleshooting" tabindex="-1">Troubleshooting <a class="header-anchor" href="#troubleshooting" aria-label="Permalink to &quot;Troubleshooting&quot;"></a></h2><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> logs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> server</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # View main service logs</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> logs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> migrate</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Check if migrations succeeded</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> config</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Validate compose configuration</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> down</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &amp;&amp; </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Full restart</span></span></code></pre></div><h2 id="security-warnings" tabindex="-1">Security Warnings <a class="header-anchor" href="#security-warnings" aria-label="Permalink to &quot;Security Warnings&quot;"></a></h2><ul><li>The main service runs with privileged container access (required for embedded Containerd) — only run in trusted environments</li><li>You must change all default passwords and secrets before production use</li><li>Use HTTPS in production</li></ul>`,60)])])}const g=i(n,[["render",o]]);export{k as __pageData,g as default};