This program creates a secure backup of your files from a specified directory or an object storage location.
Project description
Safe Backup
If you need to copy your files from a location on your local drives or download them from an object storage to your local drive safety, without any concerns about losing files, you can achieve this with safe_backup.
This program creates a secure backup of your files from a specified directory or an object storage location.
First, it generates a list of files in Redis and then begins the process of copying or downloading them to the destination while maintaining the same structure.
Install:
$ pip install safe-backup
Environment variables:
$ export SBACKUP_DB_URL #default "127.0.0.1:6379"
$ export SBACKUP_DB_DECODE_RESPONSE #default True
$ export SBACKUP_AWS_DEFAULT_REGION = <AWS_DEFAULT_REGION> #default None for MinIO
$ export SBACKUP_AWS_ACCESS_KEY_ID = <AWS_ACCESS_KEY_ID> #MinIO/S3 access key
$ export SBACKUP_AWS_SECRET_ACCESS_KEY = <AWS_SECRET_ACCESS_KEY> #MinIO/S3 secret key
$ export SBACKUP_AWS_ENDPOINT_URL = <AWS_ENDPOINT_URL> #for MinIO lab set to 'http://localhost:9000'
$ export SBACKUP_DEST_AWS_DEFAULT_REGION = <DEST_AWS_DEFAULT_REGION> #default None for MinIO
$ export SBACKUP_DEST_AWS_ACCESS_KEY_ID = <DEST_AWS_ACCESS_KEY_ID> #MinIO/S3 access key
$ export SBACKUP_DEST_AWS_SECRET_ACCESS_KEY = <DEST_AWS_SECRET_ACCESS_KEY> #MinIO/S3 secret key
$ export SBACKUP_DEST_AWS_ENDPOINT_URL = <DEST_AWS_ENDPOINT_URL> #for MinIO set to 'http://localhost:9000'
Usage:
$ sbackup [-h] [-L <LOG_LEVEL>] [--version] (-l <SOURCE_TYPE> <SOURCE_ADDRESS> |
-c <SOURCE_TYPE> <SOURCE_ADDRESS> <DEST> |
-d <DB_KEY> <DEST>
)
Backup your local or s3 files safety.
options:
-h, --help show this help message and exit
-L <LOG_LEVEL> get <LOG_LEVEL> (NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL) and Activate logging level
--version Print version and exit
-l <SOURCE_TYPE> <SOURCE_ADDRESS>
get <SOURCE_TYPE> as ['local' | 's3'] and [ <SOURCE_DIRECTORY> | <BUCKET_NAME> ] to create list of source files in db
-c <SOURCE_TYPE> <SOURCE_ADDRESS> <DEST>
get <SOURCE_TYPE> as ['local' | 's3'] then <SOURCE_ADDRESS> as [ <SOURCE_DIRECTORY> | <BUCKET_NAME> ] and
get <DEST> as [ <LOCAL_DIRECTORY> | s3:<BUCKET_NAME> ] to copy source files to destination
-d <DB_KEY> <DEST>
read db and download source files safety to <DEST> which can be a <LOCAL_DIRECTORY> or s3:<BUCKET_NAME>
Make your lab
1) Install safe_backup locally and connect to Redis and MinIO docker containers:
1-1) Redis:
$ docker run -d --name redis -p 6379:6379 redis/redis-stack-server:latest
1-2) MinIO:
Run MinIo container if you want make your own object storage lab and test the program.
Full Guide: MinIO Object Storage for Container
$ mkdir -p ~/minio/data
$ docker run \
-d \
-p 9000:9000 \
-p 9001:9001 \
--user $(id -u):$(id -g) \
--name minio \
-e "MINIO_ROOT_USER=ROOTUSER" \
-e "MINIO_ROOT_PASSWORD=CHANGEME123" \
-v ~/minio/data:/data \
quay.io/minio/minio server /data --console-address ":9001"
and then open 'http://localhost:9000' in your browser, login and make your access key.
guide: MinIO Object Storage Security and Access
2) Install safe_backup docker container and connect to Redis and MinIO docker containers:
2-1) Do all part of No 1.
2-2) Make new docker network:
$ docker network create <YOUR-NEW-NETWORK-NAME>
2-3) Connect containers to new docker network:
$ docker network connect <YOUR-NEW-NETWORK-NAME> redis
$ docker network connect <YOUR-NEW-NETWORK-NAME> minio
2-4) Run safe-backup docker container and link it to Redis and MinIO:
$ docker run \
-it \
--name sbackup \
--network <YOUR-NEW-NETWORK-NAME> \
--link redis:redis \
--link minio safe_backup:latest
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
Built Distribution
File details
Details for the file safe_backup-0.1.5.tar.gz
.
File metadata
- Download URL: safe_backup-0.1.5.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe60114150530856f64ef83b240bad1e77f7942bda34dd2ea99b8c16eefa4de8 |
|
MD5 | 1c7daf336981e6d00ee173ec5b62b011 |
|
BLAKE2b-256 | ba4a499c7d8cf6a1b766477de0741c3b86868616bca6eece8553388642ff0478 |
File details
Details for the file safe_backup-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: safe_backup-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8419c2b452bc95f79b81fdc22e1afcea9fb79b9c0098dbe7023937aa041f96a0 |
|
MD5 | cc49d87d192d60af64f56c3cd8671f11 |
|
BLAKE2b-256 | d9f47296d2717521b736cd60bd701be1c0cee589ed397c44ceef5d657ce2755c |