Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
backupCoordinator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kowis-projects
backupCoordinator
Commits
04f25194
Commit
04f25194
authored
Jul 29, 2018
by
David
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add readme, and test dependencies
parent
589f9f07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
2 deletions
+109
-2
README.md
README.md
+98
-0
build.sbt
build.sbt
+11
-2
No files found.
README.md
0 → 100644
View file @
04f25194
# 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
```
yaml
backupTemplate
:
|
borg create \
--info \
--stats \
--one-file-system \
--compression zlib,7 \
${repo_path}::${backup_name}-{now:%Y-%m-%d_%H:%M:%S} \
${dir}
pruneTemplate
:
|
borg prune \
--info \
--list \
--keep-daily ${keep_daily} \
--keep_monthly ${keep_monthly} \
--prefix ${backup_name} \
${repo_path}
globalSettings
:
mount
:
host
:
10.10.220.92
hostPath
:
/mnt/OldTank/backupTesting
local
:
/mnt/backupTesting
options
:
"
"
keepDaily
:
30
keepMonthly
:
3
borgPassphrase
:
"
TODO"
autoInit
:
true
backups
:
-
host
:
malek.dark.kow.is
repoName
:
homedirs
directories
:
-
path
:
/home/rkowis
name
:
rkowis
-
path
:
/home/dkowis
name
:
dkowis
-
path
:
/home/git
name
:
git
-
path
:
/home/znc
name
:
znc
-
host
:
kain.dark.kow.is
repoName
:
kainrepo
directories
:
-
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
build.sbt
View file @
04f25194
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
(
"."
))
.
settings
(
name
:=
"Backup Coordinator"
)
name
:=
"Backup Coordinator"
,
libraryDependencies
++=
Seq
(
akka
,
akkaTestkit
,
scalaTest
,
scalacticScalaTest
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment