Skip to content

mpolinowski/nomadic-borg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Nomadic BORG

Run periodic backups using Hashicorp Nomad's Periodic Stanza with the BORG Docker container by @pschiffe:

type = "batch"

periodic {
    cron = "@daily"
}

reschedule {
    attempts  = 0
    unlimited = false
}

See backup-service.tf for an example to backup the MariaDB Database data directory of an PHP CMS (OSTicket).

Restore a Backup

A restore can be run manually and then copied to the data directory restoring the old database. To find the correct backup we have to find the short allocation ID for the backup job run:

Hashicorp Nomad to run periodic backups

In the case above it is c0c8ec8d. We have to use the ARCHIVE=c0c8ec8d environment variable accordingly to retrieve your data:

docker run \
  --rm \
  -e BORG_REPO=/opt/borg \
  -e ARCHIVE=c0c8ec8d \
  -e BORG_PASSPHRASE=mypassword \
  -e EXTRACT_TO=/borg/output \
  -v /opt/borg/config:/root \
  -v /opt/borg/repo:/opt/borg \
  -v /opt/borg/output:/borg/output/data \
  --security-opt label:disable \
  --name borg-backup \
  pschiffe/borg

...

terminating with success status, rc 0