dzen.nstarikov.ru/docs/superpowers/specs/2026-08-15-nstarikov-storage-migration-design.md

50 lines
2.3 KiB
Markdown

# Nstarikov storage migration
## Goal
Free space on the root disk without relocating active database, Redis, Docker
runtime, or Meilisearch data. The persistent 100 GB volume mounted at
`/var/www/dzen.nstarikov.ru/storage` is the destination. It has about 91 GB
available at the time of this design.
## Scope and ordering
1. Directus PostgreSQL dumps: move `api.nstarikov.ru/backup` to
`storage/directus-backup`; retain 14 most-recent calendar-day dumps and one
dump from each of the three most-recent older ISO weeks. The compatibility
path remains `/var/www/api.nstarikov.ru/backup` through a symlink, so the
existing `backup-pg` bind mount continues to work.
2. Move bot working media with compatibility symlinks:
`geopolitics_tg_story/temp_videos` to `storage/geopolitics-story-temp` and
`vk2ok/storage` to `storage/vk2ok-storage`.
3. Move Dzen media to `storage/dzen-media` using explicit Compose bind mounts;
do not use a symlink below the parent `data` bind mount.
4. Move the inactive n8n `archive` directory to `storage/n8n-archive` with a
compatibility symlink.
5. Move Caddy logs last to `storage/caddy-logs`, preserving Caddy's own
rotation configuration. This requires a brief proxy restart.
## Safety and verification
Each migration uses an online `rsync`, a short service stop where relevant, a
final `rsync --delete`, then source rename and symlink or Compose rebind. The
original source is retained as a timestamped rollback directory until file
counts, checksums/integrity checks, service health, and the mount target have
been verified. Directus backups are additionally gzip-tested. The original
directory is removed only after those checks pass and explicit cleanup is in
scope.
## Exclusions
Do not move `/var/lib/docker`, Docker volumes, PostgreSQL, Redis, or
Meilisearch in this operation. These are latency-sensitive runtime data and
require a separate migration and rollback plan. Root, apt, and container
image caches are cleaned only through their own safe retention mechanisms;
they are not archived to the storage volume.
## Expected result
The initial relocation moves roughly 11 GB from root storage: about 5.9 GB of
Directus dumps, 4.1 GB of bot media, 0.8 GB of inactive n8n archive, and
0.45 GB of Dzen media. Caddy logs add about 1.5 GB when moved. Sizes are
time-dependent and the final `df` result is authoritative.