enacrestic


Nameenacrestic JSON
Version 0.7.2 PyPI version JSON
download
home_pagehttps://github.com/EPFL-ENAC/ENACrestic#readme
SummaryAutomate backups using restic
upload_time2023-09-26 12:31:24
maintainer
docs_urlNone
authorSamuel Bancal
requires_python>=3.6, <4
license
keywords backup restic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ENACrestic

[![License: MIT](https://img.shields.io/badge/license-GPLv3-blue&style=flat)](https://opensource.org/licenses/MIT)
[![release to PyPI](https://github.com/EPFL-ENAC/ENACrestic/actions/workflows/release-please-pypi.yml/badge.svg)](https://github.com/EPFL-ENAC/ENACrestic/actions/workflows/release-please-pypi.yml/badge.svg)
[![Python](https://img.shields.io/pypi/pyversions/enacrestic?style=flat&logo=Python)](https://pypi.org/project/enacrestic)
[![Version](https://img.shields.io/pypi/v/enacrestic?style=flat&logo=PyPI&color=%2334D058)](https://pypi.org/project/enacrestic)

[![Last commit](https://img.shields.io/github/last-commit/EPFL-ENAC/ENACrestic.svg?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/commits)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/commits)
[![Github Stars](https://img.shields.io/github/stars/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/stargazers)
[![Github Forks](https://img.shields.io/github/forks/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/network/members)
[![Github Watchers](https://img.shields.io/github/watchers/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic)
[![GitHub contributors](https://img.shields.io/github/contributors/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/graphs/contributors)

![ENACrestic](doc_pixmaps/enacrestic.png)

A simple Qt GUI to automate backups with [restic](https://restic.net/)

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:

- ![pre_backup_in_progress](doc_pixmaps/pre_backup_in_progress.png) `pre_backup` script is running
- ![backup_in_progress](doc_pixmaps/backup_in_progress.png) `restic backup` is running
- ![forget_in_progress](doc_pixmaps/forget_in_progress.png) `restic forget` is running
- ![unlock_in_progress](doc_pixmaps/unlock_in_progress.png) `restic unlock` is running
- ![backup_success](doc_pixmaps/backup_success.png) backup is completed
- ![error](doc_pixmaps/error.png) last operation failed
- ![no_network](doc_pixmaps/no_network.png) 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_
- _Ubuntu 22.04 LTS_

```bash
sudo apt install restic python3-pip qt5dxcb-plugin python3-pyqt5
pip3 install --user --upgrade pip
pip3 install --user enacrestic
```

# Upgrade

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

```bash
pip3 install --user --upgrade enacrestic
```

# Config ENACrestic

Note: For this documentation, we have chosen to use the `vi` text editor.
Adapt the commands below by replacing it with the editor of your choice. (`nano`, `gedit`, ...)

```bash
mkdir ~/.enacrestic
```

### Write environment setup file

Choose the right section according to your destination storage

```bash
vi ~/.enacrestic/env.sh
```

```snip
# 1. recommended destination: 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

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

Note, although Restic is able to manage several computers being backed up on a same respository, it's not recommended with ENACrestic. Keep a dedicated `RESTIC_REPOSITORY` per machine.

### Write password file (mandatory)

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

```bash
vi ~/.enacrestic/.pw
```

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

### Define what to backup (mandatory)

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

```bash
vi ~/.enacrestic/bkp_include
```

```snip
# 1. recommended scenario: backup all your home directory
/home/username/

# 2. alternative scenario: backup only choosen folders
/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/
```

note: Lines starting with a `#` are ignored.

### Define what to exclude from the backup (optional but recommended)

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:

```bash
vi ~/.enacrestic/bkp_exclude
```

```snip
*.iso
*.sav
*.bak
*.bak2
*.log
*.ost
*.part
*.temp
*.tmp
*.vhd
*.vhdx
*.vmdk
*.vdi
/home/username/Downloads/
/home/username/ENACdrives/
/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](https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files)

### Make it available to your shell (mandatory)

Add the following 2 lines to have:

- enacrestic in your `$PATH`
- enacrestic's env variables available.

```bash
vi ~/.bashrc # or ~/.zshrc or whatever is your shell rc file
```

```snip
export "PATH=$PATH:$HOME/.local/bin"
. $HOME/.enacrestic/env.sh
```

Now close + open a new terminal to get it all into your environment ... or simply reload your rc file:

```bash
. ~/.bashrc # or ~/.zshrc or whatever is your shell rc file
```

### All done !

🎉 Setup is now complete! You're now ready to send your 1st backup. 🎉

# Run **ENACrestic** on your computer

- 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](doc_pixmaps/just_launched.png)

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.

Note: **First backup can take a long 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** on a server

Add a dedicated _Systemd_ service file:

```bash
vi /etc/systemd/system/enacrestic.service
```

```
[Unit]
Description=ENACrestic

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root
ExecStart=/root/.local/bin/enacrestic --no-gui
KillSignal=SIGTERM
Restart=on-failure
RestartSec=30
```

Enable and start it:

```bash
systemctl daemon-reload
systemctl enable enacrestic.service
systemctl start enacrestic.service
```

That will ensure enacrestic service is started when the server boot.

You can know its status with the following commands:

```bash
systemctl status enacrestic.service
tail -n 50 -f /root/.enacrestic/last_backups.log
```

# Note on old backups retention policy

By default, every 10 backups, a `restic forget` will clean repository from backups that don't need to be kept, according the following retention policy:

- keep the last `3` backups
- keep the last `24` hourly backups
- keep the last `7` daily backups
- keep the last `4` weekly backups
- keep the last `12` monthly backups
- keep the last `5` yearly backups

# 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)

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

### Mount the backups ...

... and be able to

- browse the different snapshots
- restore any file / folder

```bash
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EPFL-ENAC/ENACrestic#readme",
    "name": "enacrestic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6, <4",
    "maintainer_email": "",
    "keywords": "backup,restic",
    "author": "Samuel Bancal",
    "author_email": "Samuel.Bancal@epfl.ch",
    "download_url": "https://files.pythonhosted.org/packages/72/21/13de99d7c9e37b0cc74391d8af93f382ad410b2d2fce336574eb09faec92/enacrestic-0.7.2.tar.gz",
    "platform": null,
    "description": "# ENACrestic\n\n[![License: MIT](https://img.shields.io/badge/license-GPLv3-blue&style=flat)](https://opensource.org/licenses/MIT)\n[![release to PyPI](https://github.com/EPFL-ENAC/ENACrestic/actions/workflows/release-please-pypi.yml/badge.svg)](https://github.com/EPFL-ENAC/ENACrestic/actions/workflows/release-please-pypi.yml/badge.svg)\n[![Python](https://img.shields.io/pypi/pyversions/enacrestic?style=flat&logo=Python)](https://pypi.org/project/enacrestic)\n[![Version](https://img.shields.io/pypi/v/enacrestic?style=flat&logo=PyPI&color=%2334D058)](https://pypi.org/project/enacrestic)\n\n[![Last commit](https://img.shields.io/github/last-commit/EPFL-ENAC/ENACrestic.svg?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/commits)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/commits)\n[![Github Stars](https://img.shields.io/github/stars/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/stargazers)\n[![Github Forks](https://img.shields.io/github/forks/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/network/members)\n[![Github Watchers](https://img.shields.io/github/watchers/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic)\n[![GitHub contributors](https://img.shields.io/github/contributors/EPFL-ENAC/ENACrestic?style=flat&logo=github)](https://github.com/EPFL-ENAC/ENACrestic/graphs/contributors)\n\n![ENACrestic](doc_pixmaps/enacrestic.png)\n\nA simple Qt GUI to automate backups with [restic](https://restic.net/)\n\n1. Automate your _restic_ backups at a choosen frequency\n2. Run _restic forget_ in a regular basis (and transparently) to keep your backup light and useful\n3. Let you see when:\n\n- ![pre_backup_in_progress](doc_pixmaps/pre_backup_in_progress.png) `pre_backup` script is running\n- ![backup_in_progress](doc_pixmaps/backup_in_progress.png) `restic backup` is running\n- ![forget_in_progress](doc_pixmaps/forget_in_progress.png) `restic forget` is running\n- ![unlock_in_progress](doc_pixmaps/unlock_in_progress.png) `restic unlock` is running\n- ![backup_success](doc_pixmaps/backup_success.png) backup is completed\n- ![error](doc_pixmaps/error.png) last operation failed\n- ![no_network](doc_pixmaps/no_network.png) last backup failed because of a network timeout (maybe the VPN is not running?)\n\n# Installation\n\nThis has been tested and validated on\n\n- _Ubuntu 18.04 LTS_\n- _Ubuntu 20.04 LTS_\n- _Ubuntu 22.04 LTS_\n\n```bash\nsudo apt install restic python3-pip qt5dxcb-plugin python3-pyqt5\npip3 install --user --upgrade pip\npip3 install --user enacrestic\n```\n\n# Upgrade\n\nTo upgrade ENACrestic to latest release, just run the following command:\n\n```bash\npip3 install --user --upgrade enacrestic\n```\n\n# Config ENACrestic\n\nNote: For this documentation, we have chosen to use the `vi` text editor.\nAdapt the commands below by replacing it with the editor of your choice. (`nano`, `gedit`, ...)\n\n```bash\nmkdir ~/.enacrestic\n```\n\n### Write environment setup file\n\nChoose the right section according to your destination storage\n\n```bash\nvi ~/.enacrestic/env.sh\n```\n\n```snip\n# 1. recommended destination: S3 Bucket\nexport RESTIC_REPOSITORY=s3:s3.epfl.ch/bucket_name/restic_MyComputerName\nexport AWS_ACCESS_KEY_ID=TheBucketRWAccessKey\nexport AWS_SECRET_ACCESS_KEY=TheBucketRWSecretKey\n\n# 2. alternative destination: SSH / SFTP\nexport RESTIC_REPOSITORY=sftp:my-server.epfl.ch:/home/username/path\n```\n\nNote, although Restic is able to manage several computers being backed up on a same respository, it's not recommended with ENACrestic. Keep a dedicated `RESTIC_REPOSITORY` per machine.\n\n### Write password file (mandatory)\n\nAdd a one line password in it. This is used to encrypt your backups.\n\n```bash\nvi ~/.enacrestic/.pw\n```\n\n**Be careful ! If you loose this password ... you loose your backups**.\n\n### Define what to backup (mandatory)\n\nAdd one line per folder / file that has to be backed up.\n\n```bash\nvi ~/.enacrestic/bkp_include\n```\n\n```snip\n# 1. recommended scenario: backup all your home directory\n/home/username/\n\n# 2. alternative scenario: backup only choosen folders\n/home/username/.enacrestic/\n/home/username/Documents/\n/home/username/Teaching/\n/home/username/Pictures/\n/home/username/Projects/\n/home/username/Learn/\n/home/username/.gitconfig\n/home/username/.mozilla/\n/home/username/.ssh/\n# heavy !\n/home/username/Videos/\n```\n\nnote: Lines starting with a `#` are ignored.\n\n### Define what to exclude from the backup (optional but recommended)\n\nAdd one line per folder / file / expression that has to be excluded.\n\nBefore 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.\n\nHere is an example of some typical things you might want to exclude from backup:\n\n```bash\nvi ~/.enacrestic/bkp_exclude\n```\n\n```snip\n*.iso\n*.sav\n*.bak\n*.bak2\n*.log\n*.ost\n*.part\n*.temp\n*.tmp\n*.vhd\n*.vhdx\n*.vmdk\n*.vdi\n/home/username/Downloads/\n/home/username/ENACdrives/\n/home/username/.local/share/Trash/\n/home/username/VirtualBox VMs/\n/home/username/snap/\n/home/username/.cache/\n/home/username/**/nobackup*\n/home/username/.local/share/virtualenvs/\n/home/username/.arduino15/\n/home/username/.atom/\n/home/username/.npm/\n/home/username/.nvm/\n```\n\nExact syntax is described [here](https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files)\n\n### Make it available to your shell (mandatory)\n\nAdd the following 2 lines to have:\n\n- enacrestic in your `$PATH`\n- enacrestic's env variables available.\n\n```bash\nvi ~/.bashrc # or ~/.zshrc or whatever is your shell rc file\n```\n\n```snip\nexport \"PATH=$PATH:$HOME/.local/bin\"\n. $HOME/.enacrestic/env.sh\n```\n\nNow close + open a new terminal to get it all into your environment ... or simply reload your rc file:\n\n```bash\n. ~/.bashrc # or ~/.zshrc or whatever is your shell rc file\n```\n\n### All done !\n\n\ud83c\udf89 Setup is now complete! You're now ready to send your 1st backup. \ud83c\udf89\n\n# Run **ENACrestic** on your computer\n\n- from Ubuntu's Application launcher\n- or from command line with the single command `enacrestic`\n\nYou'll see a new icon in the system tray (upper-right corner of your screen) with following icon.\n\n![just_launched](doc_pixmaps/just_launched.png)\n\nThis is the indicator that ENACrestic is running in the background and it'll change over time, reflecting current state.\n\nBy clicking on it, you can view detailed status and opt-in for the auto-start feature (start _ENACrestic_ when Ubuntu user session is started).\n\nFrom now on, ENACrestic is running in the background and doing the backups on a regular basis.\n\nYou can check it's activity by reading the `~/.enacrestic/last_backups.log` file.\n\nNote: **First backup can take a long 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.\n\n# Run **ENACrestic** on a server\n\nAdd a dedicated _Systemd_ service file:\n\n```bash\nvi /etc/systemd/system/enacrestic.service\n```\n\n```\n[Unit]\nDescription=ENACrestic\n\n[Install]\nWantedBy=multi-user.target\n\n[Service]\nType=simple\nUser=root\nGroup=root\nWorkingDirectory=/root\nExecStart=/root/.local/bin/enacrestic --no-gui\nKillSignal=SIGTERM\nRestart=on-failure\nRestartSec=30\n```\n\nEnable and start it:\n\n```bash\nsystemctl daemon-reload\nsystemctl enable enacrestic.service\nsystemctl start enacrestic.service\n```\n\nThat will ensure enacrestic service is started when the server boot.\n\nYou can know its status with the following commands:\n\n```bash\nsystemctl status enacrestic.service\ntail -n 50 -f /root/.enacrestic/last_backups.log\n```\n\n# Note on old backups retention policy\n\nBy default, every 10 backups, a `restic forget` will clean repository from backups that don't need to be kept, according the following retention policy:\n\n- keep the last `3` backups\n- keep the last `24` hourly backups\n- keep the last `7` daily backups\n- keep the last `4` weekly backups\n- keep the last `12` monthly backups\n- keep the last `5` yearly backups\n\n# What ENACrestic doesn't do\n\nENACrestic 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:\n\n### List the snapshots (backups)\n\n```bash\nrestic snapshots -c --password-file  ~/.enacrestic/.pw\n```\n\n### Mount the backups ...\n\n... and be able to\n\n- browse the different snapshots\n- restore any file / folder\n\n```bash\nmkdir -p ~/mnt/my_backups\nrestic mount ~/mnt/my_backups --password-file  ~/.enacrestic/.pw\n```\n\nNow 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.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Automate backups using restic",
    "version": "0.7.2",
    "project_urls": {
        "Bug Reports": "https://github.com/EPFL-ENAC/ENACrestic/issues",
        "Homepage": "https://github.com/EPFL-ENAC/ENACrestic#readme",
        "Source": "https://github.com/EPFL-ENAC/ENACrestic/"
    },
    "split_keywords": [
        "backup",
        "restic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37fde995198a10e195ea55bc8465ba16f825fa65ccc6304c596639cc65ed7ef2",
                "md5": "3e21c3881991c1dc185aad35f56f8664",
                "sha256": "22657b54224bdf4a089f5bd6b9a00fd3130a928b36ca64a87b448679630204d9"
            },
            "downloads": -1,
            "filename": "enacrestic-0.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e21c3881991c1dc185aad35f56f8664",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6, <4",
            "size": 9529323,
            "upload_time": "2023-09-26T12:31:22",
            "upload_time_iso_8601": "2023-09-26T12:31:22.193539Z",
            "url": "https://files.pythonhosted.org/packages/37/fd/e995198a10e195ea55bc8465ba16f825fa65ccc6304c596639cc65ed7ef2/enacrestic-0.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "722113de99d7c9e37b0cc74391d8af93f382ad410b2d2fce336574eb09faec92",
                "md5": "42b5391e9eec166f0b84a4654db49633",
                "sha256": "a99491d24d20dd06e068ae5f704e417239647b93e1349b25ccbe8aeee4f9e1fa"
            },
            "downloads": -1,
            "filename": "enacrestic-0.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "42b5391e9eec166f0b84a4654db49633",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6, <4",
            "size": 9533116,
            "upload_time": "2023-09-26T12:31:24",
            "upload_time_iso_8601": "2023-09-26T12:31:24.901879Z",
            "url": "https://files.pythonhosted.org/packages/72/21/13de99d7c9e37b0cc74391d8af93f382ad410b2d2fce336574eb09faec92/enacrestic-0.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-26 12:31:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EPFL-ENAC",
    "github_project": "ENACrestic#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "enacrestic"
}
        
Elapsed time: 0.12238s