Work produced by the /kb driver on 2026-07-30. Each change is recorded on its Kanboard task; all remain Done-unverified or parked pending alvis's decisions. #183 agap-mcp/src/gitea.js askpassScript() and giteaWikiWrite()'s wiki checkout both used /tmp/agap-mcp-wiki, so writing the askpass helper made the dir non-empty and git clone always failed. gitea_wiki_write had likely never succeeded in production. Askpass moved to its own dir. #181 agap-mcp/src/server.js Initialise registeredToolCount at module load so /health reports the real count immediately instead of 0 until the first MCP request. #189 kanboard/backup.sh, seafile/backup.sh, vaultwarden/backup.sh, users-backup.sh, openai/backup-{hindsight-adolf,llm-dbs}.sh Remove the dead *.ts Zabbix trapper pushes (never landed). users-backup.sh also pointed at localhost:81 instead of 192.168.1.4:81 and pushed a date string into a numeric item. Freshness monitoring now rides the .age items. #192 RESTORE-RUNBOOK.md, {kanboard,seafile,vaultwarden}/restore.sh Restore path for the three services, verified in throwaway containers. Note: this work found Seafile backups have carried an empty ccnet_db.sql since 2026-07-07 -- filed as kb#222, not fixed here. #164 openai/litellm-config.yaml Metered `judge` (anthropic/claude-haiku-4-5) entry removed per alvis's 2026-07-30 decision. ANTHROPIC_API_KEY was never wired, so it could not spend. #128 openai/agent_registry.py litellm_key_spec() now also grants the routing-mode aliases, gated by the same _reachable_tiers() check as raw grants, so a small-tier agent cannot acquire automatic routing that resolves to tier-large. #219 openai/migrate-adolf-state.sh Migration script only; inert until run. Copies (never moves) the openai_adolf-state volume to /mnt/ssd/dbs/adolf, verifying a full sha256 manifest before declaring success. Tested against a throwaway volume. Deliberately NOT included, both awaiting alvis: agap-mcp/docker-compose.yml -- kb#174's contested BW_EMAIL revert (parked). openai/docker-compose.yml -- kb#219's bind-mount switch; the target dirs under /mnt/ssd/dbs/adolf do not exist yet, so committing it would let a later `compose up` recreate Adolf against empty paths. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Y5QPagv4iun1ghpwM96Ff
65 lines
2.9 KiB
Bash
Executable File
65 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Backup script for hindsight (Adolf's long-term memory bank) and the
|
|
# openai_adolf-state Docker volume (Matrix E2EE identity/sessions + config).
|
|
# Mirrors the seafile/vaultwarden/openai-llm-dbs backup.sh pattern (same repo):
|
|
# dump/tar via `docker exec`, gzip, retention of last 5. Backup-freshness
|
|
# monitored via .age items.
|
|
#
|
|
# hindsight is an embedded Postgres (pg0) instance living at
|
|
# /mnt/ssd/dbs/hindsight on the host, bind-mounted into the `hindsight`
|
|
# container at /home/hindsight/.pg0. We use pg_dump against the live,
|
|
# running instance (safe, no downtime/quiescing needed — same rationale as
|
|
# openai-llm-dbs).
|
|
#
|
|
# adolf-state is a named Docker volume (openai_adolf-state) owned by the
|
|
# container's `node` user, not readable directly from the host as this
|
|
# script's operator. We tar it from inside the `adolf` container instead
|
|
# (docker exec has access via the mount; no host-side permission needed).
|
|
#
|
|
# Run every 3 days via root crontab (same schedule as sibling backups), e.g.:
|
|
# 0 4 */3 * * /home/alvis/agap_git/openai/backup-hindsight-adolf.sh >> /mnt/backups/hindsight-adolf/backup.log 2>&1
|
|
#
|
|
# Restore:
|
|
# # hindsight (drop+recreate the DB first if restoring into a fresh instance,
|
|
# # since the dump is a plain SQL dump, not --clean):
|
|
# gunzip -c /mnt/backups/hindsight-adolf/<DATE>/hindsight.sql.gz | \
|
|
# docker exec -i -e PGPASSWORD=hindsight hindsight \
|
|
# /home/hindsight/.pg0/installation/18.1.0/bin/psql -U hindsight -h 127.0.0.1 -p 5432 hindsight
|
|
#
|
|
# # adolf-state (container must be stopped first so files aren't overwritten
|
|
# # while in use; extract into the volume's mountpoint):
|
|
# docker stop adolf
|
|
# docker run --rm -v openai_adolf-state:/target -v /mnt/backups/hindsight-adolf/<DATE>:/backup:ro \
|
|
# alpine sh -c "rm -rf /target/* && tar xzf /backup/adolf-state.tar.gz -C /target"
|
|
# docker start adolf
|
|
|
|
set -euo pipefail
|
|
|
|
BACKUP_DIR="/mnt/backups/hindsight-adolf"
|
|
|
|
DATE=$(date '+%Y%m%d-%H%M')
|
|
DEST="$BACKUP_DIR/$DATE"
|
|
|
|
mkdir -p "$DEST"
|
|
# Backup-freshness monitoring is now done via .age items (calculated fields showing
|
|
# age of the backup). The .ts (timestamp) trappers were unreliable (history.push not
|
|
# landing); removed in kb#189 in favor of .age overdue triggers.
|
|
|
|
# --- hindsight (Postgres logical dump, live/read-only) ---
|
|
echo "Dumping hindsight..."
|
|
docker exec -e PGPASSWORD=hindsight hindsight \
|
|
/home/hindsight/.pg0/installation/18.1.0/bin/pg_dump -U hindsight -h 127.0.0.1 -p 5432 hindsight \
|
|
| gzip > "$DEST/hindsight.sql.gz"
|
|
echo "Dumped: hindsight -> $DEST/hindsight.sql.gz"
|
|
|
|
# --- adolf-state (tar the volume from inside the adolf container) ---
|
|
echo "Archiving adolf-state..."
|
|
docker exec adolf tar czf - -C /home/node/.openclaw . > "$DEST/adolf-state.tar.gz"
|
|
echo "Archived: adolf-state -> $DEST/adolf-state.tar.gz"
|
|
|
|
echo "$(date): Backup complete: $DEST"
|
|
ls -la "$DEST/"
|
|
|
|
# Rotate: keep last 5 backups
|
|
ls -1dt "$BACKUP_DIR"/[0-9]*-[0-9]* 2>/dev/null | tail -n +6 | xargs -r rm -rf
|