Commit 04f25194 authored by David's avatar David

Add readme, and test dependencies

parent 589f9f07
# Backup Coordinator
I wanted a way to coordinate backups across all my hosts. BackupPC would probably do it, but I'm using borgbackup.
I'm sure there are other distributed tools that will do this for me, but I wanted to build one that was neat.
## Design Notes
Akka actor system
TimerActor -> tells when to start -> BackupCoordinatorActor
BackupCoordinatorActor loads the configuration, which details what hosts to backup, what commands are run on each host.
Creates a per host actor, that is responsible for that host, and sending the commands.
* Per host actor will have a list of commands to be run on each host
* commands are assumed to be in dependency order
HostActor creates an actor for each SSH command.
* HostActor is responsible for the state of command execution, and should keep timer metrics and stuff
SSHCommandActor Only responsible for running the command on the remote host.
* Returns the output of the command to the HostActor (probably buffering it right now)
BackupCoordinatorActor needs to run a command when it's all done. Say an rclone up into the cloud.
Need to specify a host for that to run on, or it runs locally. That is also it's own actor
PostRunActor Only responsible for the post run command, after all hosts have backed up, do this work
### Example Configuration
#### Variables
* `repo_name` Name of the borg repository to put the backups in
* `backup_name` Name of the backup (usually the directory or something)
* `dir` The directory to actually backup (full path `/srv/thing/backup`)
* `keep_daily` number of daily backups to keep
* `keep_monthly` number of monthly backups to keep
* `repo_path` -- Should be calculated based on mount directory and repo name
#### Configuration yaml
backupTemplate: |
borg create \
--info \
--stats \
--one-file-system \
--compression zlib,7 \
${repo_path}::${backup_name}-{now:%Y-%m-%d_%H:%M:%S} \
pruneTemplate: |
borg prune \
--info \
--list \
--keep-daily ${keep_daily} \
--keep_monthly ${keep_monthly} \
--prefix ${backup_name} \
hostPath: /mnt/OldTank/backupTesting
local: /mnt/backupTesting
options: ""
keepDaily: 30
keepMonthly: 3
borgPassphrase: "TODO"
autoInit: true
- host:
repoName: homedirs
- path: /home/rkowis
name: rkowis
- path: /home/dkowis
name: dkowis
- path: /home/git
name: git
- path: /home/znc
name: znc
- host:
repoName: kainrepo
- path: /srv/budget
name: budget
- path: /srv/pictures
name: pictures
- path: /srv/software
name: software
- path: /srv/music
name: music
\ No newline at end of file
ThisBuild / scalaVersion := "2.12.6"
ThisBuild / organization := "is.kow"
val akkaV = "2.5.14"
val scalaTestV = "3.0.5"
val akka = "com.typesafe.akka" %% "akka-actor" % akkaV
val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaV % Test
val scalaTest = "org.scalactic" %% "scalactic" % scalaTestV
val scalacticScalaTest = "org.scalatest" %% "scalatest" % scalaTestV
lazy val backupCoordinator = (project in file("."))
name := "Backup Coordinator"
name := "Backup Coordinator",
libraryDependencies ++= Seq(akka, akkaTestkit, scalaTest, scalacticScalaTest)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment