1 Deployment
atlas edited this page 2026-07-01 19:28:14 +00:00
This file contains ambiguous Unicode characters

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.

Deployment

SecondBrain is one file + one SQLite db. It runs anywhere Python and Ollama reach.

1. Local (any OS)

ollama pull nomic-embed-text          # embedding backend
bash deploy/install.sh                # venv + deps + schema
. .venv/bin/activate
python3 brain.py ingest-files <dir>
python3 brain.py embed
python3 brain.py recall "q" --hybrid

2. Continuous refresh (systemd timer, Linux)

Set your sources in .env:

SB_FILE_DIRS=/home/me/notes:/home/me/code
SB_TRANSCRIPTS=/home/me/.claude/projects
SB_EVENTS_DB=/home/me/events.db
SB_EMBED_LIMIT=6000

Then:

sudo cp deploy/secondbrain-refresh.* /etc/systemd/system/
# edit WorkingDirectory/EnvironmentFile in the .service to match your install
sudo systemctl enable --now secondbrain-refresh.timer

refresh.sh is locked (flock), niced, and idempotent — safe to run every 15 min.

3. Docker

docker build -t secondbrain -f deploy/Dockerfile .
docker run --rm -v sbdata:/data \
  -e OLLAMA_URL=http://host.docker.internal:11434 \
  secondbrain recall "q" --hybrid

The db lives on the /data volume and survives rebuilds.

4. GPU offload (keep a laptop's brain current from a desktop GPU)

Embeddings are the only heavy step. Point OLLAMA_URL at any reachable Ollama — a desktop/GPU box on your LAN or tailnet:

OLLAMA_URL=http://100.x.y.z:11434

SecondBrain embeds there and stores the vectors locally. No extra infrastructure, no tunnels — if you can curl the Ollama endpoint, it works. When the GPU box is asleep, embedding simply pauses; lexical (FTS5) recall keeps working meanwhile.

Moving / backing up a brain

It's one file. cp brain.db elsewhere. That's the whole backup and migration story.

Sizing

  • ~768 floats × 4 bytes ≈ 3 KB of vector per chunk, plus the text.
  • Embedding rate depends on your Ollama backend (CPU ~520/s, small GPU ~2060/s).
  • embed --limit N bounds a run; the rest continues next run.