95 lines
2.1 KiB
Markdown
95 lines
2.1 KiB
Markdown
---
|
|
title: Backup Wiki
|
|
type: runbook
|
|
status: active
|
|
created: 2026-07-22
|
|
updated: 2026-07-22
|
|
verified_on: 2026-07-22
|
|
last_tested: 2026-07-22
|
|
confidence: high
|
|
tags: [runbook, wiki, backup]
|
|
sources: []
|
|
---
|
|
|
|
# Backup Wiki
|
|
|
|
## Purpose
|
|
Create a durable backup of the wiki so recoverable copies exist before mutating changes.
|
|
|
|
## Symptoms that match this runbook
|
|
- Before a big restructuring, page rewrite, or history migration
|
|
- Weekly or scheduled backup reminder
|
|
- Suspected accidental deletion or corruption
|
|
|
|
## Prerequisites
|
|
- Wiki path: `/home/hermes/wiki`
|
|
- Git is available
|
|
- Backup destination is writable
|
|
|
|
## Procedure
|
|
|
|
### 1. Sanity-check repo state
|
|
```bash
|
|
cd /home/hermes/wiki && git status --short && git log --oneline -3
|
|
```
|
|
|
|
### 2. Commit any open changes first
|
|
```bash
|
|
cd /home/hermes/wiki
|
|
git add -A
|
|
git commit -m "backup-baseline: $(date +%Y-%m-%d)"
|
|
```
|
|
|
|
### 3. Export a timestamped copy outside the repo
|
|
```bash
|
|
BACKUP_DIR=/home/hermes/wiki-backups
|
|
mkdir -p "$BACKUP_DIR"
|
|
BACKUP="$BACKUP_DIR/wiki-$(date +%Y%m%d-%H%M%S).tar.gz"
|
|
tar -czf "$BACKUP" -C /home/hermes wiki
|
|
echo "Wrote $BACKUP"
|
|
```
|
|
|
|
### 4. Optional: push to a Git remote if configured
|
|
```bash
|
|
cd /home/hermes/wiki
|
|
git remote -v
|
|
git push --all
|
|
git push --tags
|
|
```
|
|
If no remote is configured, skip this step and rely on the tarball.
|
|
|
|
### 5. Rotate old backups if needed
|
|
Keep N most recent backups:
|
|
```bash
|
|
ls -1t "$BACKUP_DIR"/wiki-*.tar.gz | tail -n +6 | xargs -r rm
|
|
```
|
|
|
|
## Verification
|
|
- `git status --short` shows a clean tree
|
|
- Tarball exists and is non-empty:
|
|
```bash
|
|
stat "$BACKUP"
|
|
tar -tzf "$BACKUP" | head -20
|
|
```
|
|
|
|
## Rollback
|
|
- Restore from tarball:
|
|
```bash
|
|
BACKUP=$(ls -1t /home/hermes/wiki-backups/wiki-*.tar.gz | head -1)
|
|
rm -rf /home/hermes/wiki-restore
|
|
mkdir -p /home/hermes/wiki-restore
|
|
tar -xzf "$BACKUP" -C /home/hermes wiki-restore --strip-components=1
|
|
```
|
|
- Verify restored content before replacing live wiki
|
|
|
|
## Notes
|
|
- This runbook intentionally does not write secrets or token dumps into backups
|
|
- If you need a full Hermes config+data backup, use `hermes backup` in addition to this wiki-only backup
|
|
|
|
## Last tested
|
|
2026-07-22
|
|
|
|
## Related
|
|
- [[runbooks/update-hermes-safely]]
|
|
- [[current-state]]
|