f69cb99b3f8d8235f132d1afd41a08d0a24d9143
- up/down/status interface, history in /var/lib/sysmig/applied - 001 swap 2GB + swappiness=10, 002-004 trim unneeded daemons (~56MB) - google-osconfig-agent intentionally kept - all messages/comments in ASCII English (console font safety)
sysmig
Lightweight tool that manages host state in DB-migration (Flyway) style.
Started for a 1GB VM (ocrt-postgres), but deployable to any machine
via cloud-init.
Usage
sudo bash /opt/sysmig/sysmig up # apply all pending migrations (idempotent)
sudo bash /opt/sysmig/sysmig down # roll back the last migration
sudo bash /opt/sysmig/sysmig down all # roll back everything (reverse order)
bash /opt/sysmig/sysmig status # show status (no root required)
- Migrations:
migrations/NNN-name.sh, receivingup/downas$1 - Applied history:
/var/lib/sysmig/applied- applied entries never re-run - On failure the run aborts at that step; earlier steps stay applied
Adding a new migration
- Create
migrations/NNN-name.sh(number higher than existing; leave gaps) - Implement both
upanddowncases - both must actually work - Commit & push, then on the server:
git pull && sudo bash sysmig/sysmig up
cloud-init integration
#cloud-config
runcmd:
- [ git, clone, <REPO_URL>, /opt/sysmig ]
- [ bash, /opt/sysmig/sysmig, up ]
For a private repo you need an auth strategy:
- deploy key (existing machines): register a read-only key on the repo
- fleet rollout: make the repo public, or embed a read-only token in the https URL
Current migrations
| # | name | effect |
|---|---|---|
| 001 | create-swap | 2GB swap + fstab + vm.swappiness=10 |
| 002 | disable-networkd-dispatcher | reclaim ~27MB RAM |
| 003 | purge-exim4 | reclaim ~21MB RAM (package removed) |
| 004 | purge-haveged | reclaim ~8MB RAM (package removed) |
Roadmap
005-install-postgres- install PostgreSQL + create cluster010-tune-postgres- 1GB tuning (shared_buffers=128MB, work_mem=4MB, max_connections=30, ...)
Languages
Shell
100%