Skip to content

An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.

docs(vps-setup): services via upgrade.sh, dbrain-* user units

smixs505fb8d5acbe
diff --git a/docs/vps-setup.md b/docs/vps-setup.md
index b40a0c7..ced793d 100644
--- a/docs/vps-setup.md
+++ b/docs/vps-setup.md
@@ -264,113 +264,26 @@ Stop with `Ctrl+C`.
---
-## Step 16: Setup Autostart (systemd)
+## Step 16: Install Services (one command)
-### Bot Service
+All services — the bot, the persistent brain session, the watchdog, the
+daily processing timer and the health-check timer — are installed by one
+idempotent script:
```bash
-sudo nano /etc/systemd/system/d-brain-bot.service
-```
-
-Paste (replace `myuser`):
-
-```ini
-[Unit]
-Description=d-brain Telegram Bot
-After=network.target
-
-[Service]
-Type=simple
-User=myuser
-WorkingDirectory=/home/myuser/projects/agent-second-brain
-ExecStart=/home/myuser/.local/bin/uv run python -m d_brain
-Restart=always
-RestartSec=10
-Environment=PYTHONUNBUFFERED=1
-
-[Install]
-WantedBy=multi-user.target
-```
-
-Enable and start:
-
-```bash
-sudo systemctl daemon-reload
-sudo systemctl start d-brain-bot
-sudo systemctl enable d-brain-bot
-
-# Check status
-sudo systemctl status d-brain-bot
-```
-
----
-
-## Step 17: Daily Processing Timer (optional)
-
-Automatically process entries at 21:00 daily.
-
-### Edit process script
-
-```bash
-nano ~/projects/agent-second-brain/scripts/process.sh
-```
-
-Update paths at the top:
-```bash
-export HOME="/home/myuser"
-PROJECT_DIR="/home/myuser/projects/agent-second-brain"
-```
-
-Make executable:
-```bash
-chmod +x ~/projects/agent-second-brain/scripts/process.sh
-```
-
-### Create timer
-
-```bash
-sudo nano /etc/systemd/system/d-brain-process.timer
-```
-
-```ini
-[Unit]
-Description=Run d-brain processing daily at 21:00
-
-[Timer]
-OnCalendar=*-*-* 21:00:00
-Persistent=true
-
-[Install]
-WantedBy=timers.target
-```
-
-### Create service
-
-```bash
-sudo nano /etc/systemd/system/d-brain-process.service
+cd ~/projects/agent-second-brain
+bash upgrade.sh
```
-```ini
-[Unit]
-Description=d-brain Daily Processing
-
-[Service]
-Type=oneshot
-User=myuser
-WorkingDirectory=/home/myuser/projects/agent-second-brain
-ExecStart=/home/myuser/projects/agent-second-brain/scripts/process.sh
-Environment=PYTHONUNBUFFERED=1
-```
+It installs tmux, syncs Python dependencies, installs the `dbrain` CLI,
+sets up `dbrain-*` systemd **--user** units (no root services), enables
+linger so everything survives reboots, and runs a first health check.
-### Enable
+Check:
```bash
-sudo systemctl daemon-reload
-sudo systemctl enable d-brain-process.timer
-sudo systemctl start d-brain-process.timer
-
-# Check timer
-sudo systemctl list-timers | grep d-brain
+dbrain status
+systemctl --user is-active dbrain-bot dbrain-watchdog dbrain-process.timer dbrain-doctor.timer
```
---
@@ -408,25 +321,25 @@ If prompted for password, use Personal Access Token:
```bash
# Bot status
-sudo systemctl status d-brain-bot
+dbrain status
-# Restart bot
-sudo systemctl restart d-brain-bot
+# Restart bot (the brain session survives — KillMode=process)
+systemctl --user restart dbrain-bot
# Stop bot
-sudo systemctl stop d-brain-bot
+systemctl --user stop dbrain-bot
# Real-time logs
-sudo journalctl -u d-brain-bot -f
+journalctl --user -u dbrain-bot -f
# Last 100 log lines
-sudo journalctl -u d-brain-bot -n 100
+journalctl --user -u dbrain-bot -n 100
-# All d-brain services
-sudo systemctl status 'd-brain-*'
+# All dbrain services
+systemctl --user status 'dbrain-*'
# List timers
-sudo systemctl list-timers
+systemctl --user list-timers
# Manual processing
cd ~/projects/agent-second-brain
@@ -434,9 +347,7 @@ cd ~/projects/agent-second-brain
# Update code
cd ~/projects/agent-second-brain
-git pull
-uv sync
-sudo systemctl restart d-brain-bot
+bash upgrade.sh
```
---
@@ -446,17 +357,17 @@ sudo systemctl restart d-brain-bot
### Bot doesn't respond
```bash
-sudo systemctl status d-brain-bot
-sudo journalctl -u d-brain-bot -n 100
+dbrain status
+journalctl --user -u dbrain-bot -n 100
cat ~/projects/agent-second-brain/.env | grep TELEGRAM_BOT_TOKEN
-sudo systemctl restart d-brain-bot
+systemctl --user restart dbrain-bot
```
### Voice not transcribing
```bash
cat ~/projects/agent-second-brain/.env | grep DEEPGRAM
-sudo journalctl -u d-brain-bot | grep -i error
+journalctl --user -u dbrain-bot | grep -i error
```
### Processing errors