Skip to main content

Automate backups using restic

Project description

ENACrestic

ENACrestic

A simple Qt GUI to automate backups with restic

  1. Automate your restic backups at a choosen frequency
  2. Run restic forget in a regular basis (and transparently) to keep your backup light and useful
  3. Let you see when :
  • backup_in_progress restic backup is running
  • forget_in_progress restic forget is running
  • backup_success backup is completed
  • backup_failed last backup failed
  • backup_no_network last backup failed because of a network timeout (maybe the VPN is not running?)

Installation

This has been tested and validated on

  • Ubuntu 18.04 LTS
  • Ubuntu 20.04 LTS
sudo apt install restic python3-pip qt5dxcb-plugin
pip3 install --user --upgrade pip
pip3 install --user ENACrestic

Upgrade

To upgrade ENACrestic to latest release, just run the following command :

pip3 install --user --upgrade ENACrestic

Config ENACrestic

mkdir ~/.enacrestic

Edit ~/.enacrestic/env.sh file

Choose the right section according to your destination storage

# Local (not recommended!)
export RESTIC_REPOSITORY=/path/to/my/restic-repo

# SSH / SFTP
export RESTIC_REPOSITORY=sftp:my-server.epfl.ch:/home/username/path

# S3 Bucket
export RESTIC_REPOSITORY=s3:s3.epfl.ch/bucket_name/restic_MyComputerName
export AWS_ACCESS_KEY_ID=TheBucketRWAccessKey
export AWS_SECRET_ACCESS_KEY=TheBucketRWSecretKey

Edit ~/.enacrestic/.pw file

Add a one line password in it. This is used to encrypt your backups.

Be careful ! If you loose this password ... you loose your backups.

Edit ~/.enacrestic/bkp_include file

Add one line per folder / file that has to be backed up.

Example 1 - list every important folder :

/home/username/.enacrestic/
/home/username/Documents/
/home/username/Teaching/
/home/username/Pictures/
/home/username/Projects/
/home/username/Learn/
/home/username/.gitconfig
/home/username/.mozilla/
/home/username/.ssh/
# heavy !
/home/username/Videos/

Example 2 - backup all my home directory (and probably exclude some things just after) :

/home/username/

note : Lines starting with a # are ignored.

Edit ~/.enacrestic/bkp_exclude file (optional)

Add one line per folder / file / expression that has to be excluded.

Before running your first backup, you might want to exclude heavy and unnecessary folders (Like the Downloads or the Trash). You can use the baobab utility to find those.

Here is an example of some typical things you might want to exclude from backup :

*.iso
/home/username/Downloads/
/home/username/.local/share/Trash/
/home/username/VirtualBox VMs/
/home/username/snap/
/home/username/.cache/
/home/username/**/nobackup*
/home/username/.local/share/virtualenvs/
/home/username/.arduino15/
/home/username/.atom/
/home/username/.npm/
/home/username/.nvm/

Exact syntax is described here

Edit ~/.bashrc or ~/.zshrc (depending on your shell)

Add the following 2 lines to have :

  • enacrestic in your $PATH
  • enacrestic's env variables available.
export PATH=$PATH:/home/username/.local/bin
. ~/.enacrestic/env.sh

Init restic repo by hand

restic init --password-file  ~/.enacrestic/.pw

You're now ready to send your 1st backup.

This may take much time! Please consider having enough time for the 1st backup to complete. It'll be the longest backup ever, since everything has to be copied. All future backups will then be only incremental.

Run ENACrestic

  • from Ubuntu's Application launcher
  • or from command line with the single command enacrestic

You'll see a new icon in the system tray (upper-right corner of your screen) with following icon.

just_launched

This is the indicator that ENACrestic is running in the background and it'll change over time, reflecting current state.

By clicking on it, you can view detailed status and opt-in for the auto-start feature (start ENACrestic when Ubuntu user session is started).

From now on, ENACrestic is running in the background and doing the backups on a regular basis.

You can check it's activity by reading the ~/.enacrestic/last_backups.log file.

What ENACrestic doesn't do

ENACrestic is here to help you, running backups on a regular basis. If you want to browse backups, restore files/folders, you'll have to use restic itself. Here are basic commands :

List the snapshots (backups)

restic snapshots -c --password-file  ~/.enacrestic/.pw

Mount the backups ...

... and be able to

  • browse the different snapshots
  • restore any file / folder
mkdir -p ~/mnt/my_backups
restic mount ~/mnt/my_backups --password-file  ~/.enacrestic/.pw

Now you can browse ~/mnt/my_backups folder and copy from it anything you want to restore. When done, you can simply Ctrl-c in the terminal where you had issued the restic mount ... command.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ENACrestic-0.1.8.tar.gz (8.7 MB view hashes)

Uploaded Source

Built Distribution

ENACrestic-0.1.8-py3-none-any.whl (8.7 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page