Mainframe is a monolith containing some personal automations and convenience code that I run 24/7 and pipe data into and out of. It's a replacement for a series of brittle shell scripts and cron jobs.
If you can find some use out of it, great!
First copy .envrc.example to .envrc and fill it out. Source it or use
direnv to source it automatically.
Then to develop, run:
just runThis will contnually rebuild and then reboot mainframe when a source file
changes.
To run mainframe how it's meant to be run in production, i.e. on an old machine or Raspberry Pi in a closet, first install dependencies:
sudo apt-get install moreutilsThen set up a user cron like so:
0 0 * * * chronic bash /path/to/mainframe/supervisor.shThe supervisor script will handle the rest, including auto-updating.
Prerequisites: Install
golang-migrate with the
sqlite driver.
go install -tags 'sqlite' github.com/golang-migrate/migrate/v4/cmd/migrate@latestsqlite3 would probably work too, but is
less friendly to cross-compiling.
Warning: Do not install golang-migrate from Homebrew, as that version does
not include any SQLite drivers.
migrate -path db/migrations -database sqlite://mainframe.db upjust create-migration NAME
$EDITOR db/migrations/*name_of_migration.{up,down}.sqlIf a migration errors, you may have to force the migration engine back to the previous version, possibly undoing any partial steps manually. Forcing a migration version does not run any migration files.
just force-migration VERSION