Skip to main content

Comprehensive Backing up and Restoration Archiver. Docker volumes, bind mounts and plain directory backup automation tool.

Project description

CoBRA - Comprehensive Backing up and Restoration Archiver

Cobra is a tool for creating, managing and restoring backups. It is designed to cover docker powered applications as well as it allows backing up of regular file system folders.

Cobra cli

Run tests

git clone https://github.com/yell0w4x/cobra.git
cd cobra
./run-tests --unit

The above will run unit tests. To run end-to-end tests run as follows. Note that docker must reside in the system. To install it on Ubuntu wget -qO- https://get.docker.com | sudo bash. On Manjaro (Arch) sudo pacman -S docker.

./run-tests --e2e --folder-id goolge-drive-folder-id --key path/to/google-service-account-key.json

or

GOOGLE_DRIVE_FOLDER_ID=goolge-drive-folder-id GOOGLE_SERVICE_ACC_KEY=path/to/key.json ./run-tests --e2e

The tests are based on pytest. All the extra arguments are passed to pytest. So to have verbose output use -v or -vv. To show stdout -s. To run certain tests use -k test_name and etc. For details see the pytest docs.

./run-tests --help
Run cobra unit and e2e tests.

Usage:
    ./run-tests [OPTIONS] [EXTRA_ARGS]

All the EXTRA_ARGS are passed to pytest

Options:
    --help                Show help message
    --unit                Run unit tests
    --e2e                 Run e2e tests
    --skip-build          Skip building dist files
    --folder-id FOLDER_ID Google drive folder id to use as remote storage for e2e tests. 
                          If not given read from GOOGLE_DRIVE_FOLDER_ID environment variable.
    --key KEY_FN          Path to google service account key file in json format
                          If not given read from GOOGLE_SERVICE_ACC_KEY environment variable.

How to use

pip install cobra

CLI

After that cobra command will be available from the command line.

To get the cli description please issue cobra --help or e.g. cobra backup --help to get help on certain command.

This will backup all the docker volumes ss well as /want/this/dir/backed/up directory, but skip-this-volume and-this-one.

cobra backup build --push --dir /want/this/dir/backed/up \
    --creds /path/to/google-service-acc-key.json --folder-id google-drive-folder-id \
    --exclude skip-this-volume and-this-one

This restores latest backup from the given remote folder.

cobra backup pull --latest --restore \
    --creds /path/to/google-service-acc-key.json --folder-id google-drive-folder-id

Remote storage

For now Google Drive only supported. If you find this project useful you can contribute to enhance it. Or at least you can post a feature request.

  1. To have this work the Google Service Account is necessary. The service account id (email) looks like <the-name-you-choose>@hip-heading-376120.iam.gserviceaccount.com.
  2. Under the service account you've created add the key pair and download it in .json format.
  3. Now create the folder within your Google Drive you wish to push the backups in.
  4. Share this folder with the service account (email) from step 1.

Python

Minimum python version is 3.7.

from cobra.api import Api
from cobra.hooks import Hooks
from docker import DockerClient

api = Api(gateway=DockerClient(), hooks=Hooks())
api.backup_build()

Method parameters are described in cli help cobra backup --help e.g.

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

cobra-archiver-0.0.1.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

cobra_archiver-0.0.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file cobra-archiver-0.0.1.tar.gz.

File metadata

  • Download URL: cobra-archiver-0.0.1.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.10.8

File hashes

Hashes for cobra-archiver-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a5c699d6f1c6cfd30f848dd93bba94f4c8f9d14ca91b3987874481d7d90e4b0b
MD5 19c97b931346a9ed0e64d76cac7e1cba
BLAKE2b-256 a2cf7e4dd729c36d6813f99455169b9861a0908e6f6fe35d68dfc1cef151d426

See more details on using hashes here.

File details

Details for the file cobra_archiver-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cobra_archiver-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.10.8

File hashes

Hashes for cobra_archiver-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a887e7755e9f04d61e5c5a0bf52856213fa9033fd94ca8b74ed51d98c68be3ec
MD5 2621342f5168194d7f48e3d24adaa22e
BLAKE2b-256 8743a8c807f1312cc3a3fc203ed9295090d403222513deb1f83978f32e3f0cff

See more details on using hashes here.

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