mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
For #23750 # Overview This PR adds a basic tool for creating and restoring Fleet dev snapshots. In this first iteration a snapshot is just a folder containing a MySQL db dump made using the existing backup/restore scripts, and the tool allows you to easily save and restore snapshots interactively. ## Usage * `make snapshot` to create a new snapshot * `make restore` to select and restore a snapshot ## Future plans Future iterations can add metadata to snapshots to integrate things like: * node keys from osquery-perf, so you can easily reconnect to hosts created in a previous session * env vars from when the snapshot was made * the branch from when the snapshot was made, to allow switching to that branch and restarting the server as part of the restore process *  ## Demo https://github.com/user-attachments/assets/1590c37a-3df9-4201-a42b-ccd1a36cb6cf
4 lines
224 B
Bash
Executable file
4 lines
224 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
BACKUP_NAME="${1:-backup.sql.gz}"
|
|
docker run --rm -i --network fleet_default ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} bash -c 'gzip -dc - | mysql -hmysql -uroot -ptoor fleet' < ${BACKUP_NAME}
|