Coder Social home page Coder Social logo

default-work / backup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nathants/backup

0.0 0.0 0.0 74 KB

immutable backups so simple that unborkable

Home Page: https://nathants.com/projects/backup

License: MIT License

Shell 19.92% Python 80.08%

backup's Introduction

backup

why

backups should be simple and easy.

how

easily create immutable, trustless backups with revision history, compression, and file deduplication.

what

  • the index, tracked in git, contains filesystem metadata.

  • the index is a sorted tsv file of: path, tarball, hash, size

  • for every line of metadata in the index, there is one and only one tarball containing a file with that hash.

  • duplicate files, by blake2b hash, are never stored.

  • the index is encrypted with git-remote-gcrypt.

  • the tarballs are split into chunks, compressed with lz4, then encrypted with gpg.

  • all remote storage is handled via rclone on any backend it supports.

  • the ignore file, tracked in git, contains one regex per line of file paths to ignore.

  • a clean restore will clone the git repo, checkout a revision, select file paths by regex, gather needed tarball names, fetch tarballs from storage, and extract the selected files.

usage

  • backup-add - scan the filesystem for changes.
  • backup-diff - inspect the uncommitted backup diff.
  • backup-ignore - if needed, edit the ignore regexes, then goto backup-add.
  • backup-commit - commit the backup diff to remote storage.
  • backup-find - search for files in the index by regex at revision.
  • backup-restore - restore files from remote storage by regex at revision.

dependencies

  • awk
  • bash
  • cat
  • git
  • git-remote-gcrypt
  • gpg
  • grep
  • lz4
  • python3
  • rclone

installation

  • put bin/ on $PATH

or

  • sudo mv bin/* /usr/local/bin

setup

  • add some environment variables to your bashrc:

    export BACKUP_ROOT=~ - root directory to backup

    export BACKUP_RCLONE_REMOTE=$REMOTE - a remote setup with rclone config

    export BACKUP_DESTINATION=$BUCKET/backups/$(hostname) - where to rclone data to

    export BACKUP_CHUNK_MEGABYTES=100 - approximate size of each tarball before compression

  • have a gpg key and a gpg.conf that looks like the following:

    >> cat ~/.gnupg/gpg.conf
    
    default-key [email protected]
    default-recipient [email protected]
    
    personal-cipher-preferences AES256
    personal-digest-preferences SHA512
    personal-compress-preferences Uncompressed
    default-preference-list SHA512 AES256 Uncompressed
    cert-digest-algo SHA512
    s2k-cipher-algo AES256
    s2k-digest-algo SHA512
    s2k-mode 3
    s2k-count 65011712
    disable-cipher-algo 3DES
    weak-digest SHA1
    force-mdc
    

api

modify backup state:

  • backup-add - scan the filesystem for changes
  • backup-commit - commit the backup diff to remote storage
  • backup-ignore - edit the ignore file in $EDITOR
  • backup-reset - clear uncommited backup state

view backup state:

  • backup-additions-sizes - show large files in the uncommited backup diff
  • backup-additions - inspect the uncommited backup diff, additions only
  • backup-diff - inspect the uncommited backup diff
  • backup-find - find files by regex at revision
  • backup-index - view the backup index
  • backup-log - view the git log

restore backup content:

  • backup-restore - restore files from remote storage by regex at revision

test

export BACKUP_TEST_RCLONE_REMOTE=$REMOTE
export BACKUP_TEST_DESTINATION=$BUCKET/test
tox

backup's People

Contributors

nathants avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.