Commit Graph

18 Commits

Author SHA1 Message Date
Fabian Wagner aacd486a40 feat: db backup/restore/prune commands with APP_KEY encryption
Three new artisan commands modelled on blax-intranet's database
backup/restore pattern, generalised so any project pulling in
laravel-workkit gets them for free:

- workkit:db:backup
  mysqldump → xz -9 → Crypt::encryptString → storage/backups/db_<conn>_<ts>.sql.xz.enc
  Password is passed via MYSQL_PWD so it doesn't appear in `ps`.
- workkit:db:restore
  Picks newest backup (or --file=…), inverts the pipeline, and pipes
  the .sql into the mysql CLI. Detects .enc / .xz suffixes so plain
  dumps and partially-encoded files work too. Confirms before
  overwriting unless --force is set; emits a clear "APP_KEY
  mismatch" message when Crypt::decryptString fails.
- workkit:db:prune-backups
  Drops backups older than --days (defaults to 30 / config).
  --dry-run shows what would go.

Encryption uses Laravel's Crypt facade, so the AES-256 key is
derived from APP_KEY — same key the rest of the app uses for cookies
and encrypted columns. A backup is restorable only by a deployment
that knows the host's APP_KEY.

Shipped config/workkit.php (mergeConfigFrom + publishes) for
overriding the backup directory and retention window without
hard-coding env-specific values in the package.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:01:32 +02:00
Fabian Wagner aa51e0aa27 I api responses misc methods 2026-04-28 08:06:04 +02:00
Fabian Wagner e2c663522c feat(misc): add reusable response and options helpers 2026-04-17 09:50:33 +02:00
Fabian Wagner 7bf997d798 chore: use 'websocket' as default PUSHER app key 2026-04-16 08:25:28 +02:00
Fabian Wagner 9b3ea29d9a fix: missing newlines in generated docker-compose websocket config 2026-04-15 10:46:57 +02:00
Fabian Wagner 012eec7ee9 A plug-n-pray command 2026-04-15 10:10:41 +02:00
Fabian Wagner 73fdcbb74f A oss-initiative-banner asset 2026-04-14 10:14:01 +02:00
Fabian Wagner b83eaefa2e A expiration scopes 2025-12-04 11:34:19 +01:00
Fabian Wagner fe7206743c U sanctum requirement 2025-12-03 14:32:21 +01:00
Fabian Wagner 67a51602c4 A sanctum & AuthenticateByBearerTokenMiddleware 2025-12-01 16:59:45 +01:00
Fabian Wagner ab6d2f29d2 I expirations 2025-11-25 10:48:09 +01:00
Fabian Wagner 8ef0640737 BF app config 2025-11-21 16:19:24 +01:00
Fabian Wagner cc13986135 BF wrong namespace 2025-11-21 10:49:43 +01:00
Fabian Wagner c5ee4d3080 BF wrong naming 2025-11-20 16:10:01 +01:00
Fabian Wagner d04c7186be R service provider 2025-11-20 16:08:16 +01:00
Fabian Wagner 84cc1d15d4 AI extended workkit 2025-11-20 15:53:34 +01:00
Fabian Wagner 4b61653d2d U composer description 2025-11-20 15:16:57 +01:00
a6a2f5842 0f260ab95f init 2025-11-20 15:04:18 +01:00