| title | Upgrade Second Brain |
|---|---|
| type | how-to |
Safely upgrade a running instance to the latest version: pull code, apply migrations, update dependencies, and restart services.
Note
Before you begin, ensure you have:
- A working Second Brain installation (see Getting started)
- PostgreSQL 17 running (
pg_isready -h 127.0.0.1 -p 5432 -U memory_bank) - The
.venvactivated (source .venv/bin/activate)
Skim the commit log or changelog for breaking changes before upgrading:
git log --oneline HEAD..origin/main | head -20Look for migration files, dependency changes, or notes about config format updates.
Tip
Nightly backups run at 2:00 AM (Google Drive + local, encrypted). A manual pre-upgrade backup is optional — your data is already protected. If you want one anyway: bash scripts/jobs/backup.sh
git pull origin mainExpected output:
Updating a1b2c3d..e4f5g6h
Fast-forward
src/mcp_server.py | 12 ++++++------
migrations/011_new_index.sql | 8 ++++++++
...
The migration runner is idempotent — it skips already-applied versions and is safe to re-run:
./migrations/migrate.shExpected output:
skip: 001_initial_schema.sql (already applied)
skip: 002_v2_columns.sql (already applied)
...
apply: 011_new_index.sql
done
If all migrations were already applied, you see only skip: lines followed by done.
Check whether requirements.txt changed in the pull:
git diff HEAD~1 -- requirements.txtIf it shows changes, reinstall:
pip install -r requirements.txtExpected output (last line):
Successfully installed <new-or-updated-packages>
Restart PostgreSQL only if the upgrade notes mention a schema change that requires it, or if you experience connection issues:
brew services restart postgresql@17Expected output:
Stopping `postgresql@17`... (was running)
==> Successfully started `postgresql@17`
If any launchd agents were updated (new or modified plists in scheduling/), reload them:
launchctl unload ~/Library/LaunchAgents/com.second-brain.<name>.plist
launchctl load ~/Library/LaunchAgents/com.second-brain.<name>.plistVerify all jobs are loaded:
launchctl list | grep second-brainExpected output:
- 0 com.second-brain.backup
- 0 com.second-brain.dream-cycle
...
pg_isready -h 127.0.0.1 -p 5432 -U memory_bankExpected output:
127.0.0.1:5432 - accepting connections
.venv/bin/python -m pytest tests/test_db.py tests/test_search.py tests/test_mcp_server.py -qExpected output:
... passed
Tests run against an isolated memory_bank_test database and mock Ollama calls — the local model
does not need to run during tests.
- Operations — scheduled jobs, backups, monitoring
- Troubleshooting — fixes for common post-upgrade issues
- Getting started — full installation procedure
- Disaster Recovery — backup and restore details