Coder Social home page Coder Social logo

backupper's Introduction

Backupper App

Welcome to Backupper! The app for making backup easy and fast!

Features

  • Create backup of files in the "hot" directory
  • Select watcher of changes based on your expectations
  • Copy is made by chunks, so large files are supported
  • All non-regular files are ignored (e.g. dirs, device files)
  • Files in backup dir supposed to be maintained only by app (DO NOT CHANGE BACKUP DIR FILES POLICY =))
  • Create file with name delete_<filename> and <filename> will be removed in hot and backup dirs
  • Create file with name delete_<RFC3339>_<filename> and <filename> will be removed in hot and backup dirs at <RFC3339>

example of delete_<RFC3339>_<filename>: delete_2023-09-23T18:54:30+02:00_file_2

Basic usage

# for build
> make

# for run
> ./main

# for usage help
> ./main -h

Backup mode

> ./main -backup-path ./backup -hot-path ./hot -log log.txt -log-level 0 -watcher syscall
  • -backup-path <path_to_backup_dir>
  • -hot-path <path_to_origins_dir>
  • -log <path_to_log_file> - already existing log file will be appended
  • -log-level <number> - 0 for Debug, 3 for Error
  • -watcher <type_of_watcher>

You could use default args if you want just to test it

View logs mode

> ./main -view -view-date-filter "2023/09/25" -view-regex ".*CopyWorker.*"
  • -view - switch to log viewing mode
  • -view-date-filter <date_to_search_for> - format of the date should be same as in logs (2009/01/23)
  • --view-regex <some_regex>

Testing

# create example files to trigger them backup
> make create_files

# compare files in ./hot and ./backup dirs
> make compare_files

# create scheduled deletion of file_1
> make create_scheduled

# run Go UT and run simple end-to-end test
> make test

Bash scripts from ./scripts used:

  • createFiles.sh - creates given amount of files in given dir with names file_<number>
  • compareFiles.sh - compares files in given dirs
  • scheduleDelete.sh - creates file delete_ISODATETIME_ for given file and sets date in filename for now + 5 sec
  • test.sh - run all binary and already mentioned scripts

Docker

If you don't have Linux, but you want to try this awesome app, try our simple Dockerfile!

# to build image
> make docker
# to run container and share current dir with container
> make docker-run

Do not forget that Docker could create ./hot and ./backup dirs under root!

Watchers

Watcher Description
syscal Watcher that uses syscall with non-blocking IO. Fast, with small "loss window" (100ms), but could consume resources by triggering a lot of events
event Watcher that uses github.com/fsnotify/fsnotify. Same syscall under the hood, produces more events than syscall, but more reliable
timer Watcher that runs by ticker, uses much less resources, but has "loss window" (triggered once per sec)

backupper's People

Contributors

nikonok avatar

Watchers

 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.