Ubarec
The utility is designed for backup and restore databases to S3 storage. So far, PostgreSQL and MS SQL databases are supported.
Install
Ubuntu
The basic dependencies and package are easy to install:
sudo apt install -y p7zip-full unixodbc-dev python3.8 python3-pip && python3.8 -m pip install ubarec
When working with MS SQL, you must install the appropriate ODBC driver.
Windows
The program uses the console archiver 7-Zip, which should be pre-installed in any convenient way, for example, with the chocolatey:
choco install 7zip
The module is installed from the environment with administrator privileges:
py -m pip install ubarec
Working principle
In backup mode Ubarec performs the following actions for each of the databases specified in the command line parameters
- forms database dump (either by executing SQL script or using standard utilities)
- archives the dump using 7zip; if the
UBAREC_ZIP_PASSWORDenvironment variable is set, the archive is password-protected - the created archive is copied to the S3-storage
- files created during the previous stages are deleted
The formed database archive has a file name by mask:
The current hostname>__<DB name>__<Time Label>.zip
In recovery mode Ubarec performs the following algorithm:
- searches for the last archive of the specified database in the S3 storage
- copies the found archive to a temporary folder
- unpacks the archive using the
UBAREC_ZIP_PASSWORDpassword - if the
do_restorekey is specified, restores the database in the DBMS either by executing an SQL script or using the standard utilities (depending on the DBMS type) - deletes the files created during the previous steps; if the
do_restorekey is specified, the database dump remains
Configure
According to the principles of the 12-factor application, Ubarec takes settings from environment variables.
| Name | Required? | Default value | Description |
|---|---|---|---|
UBAREC_ENDPOINT_URL |
No | https://storage.yandexcloud.net |
S3 object storage entry point |
UBAREC_REGION_NAME |
No | ru-central1 |
Region name |
UBAREC_ACCESS_KEY |
Yes | Bucket access key ID | |
UBAREC_SECRET_KEY |
Yes | Bucket secret key | |
UBAREC_BUCKET_NAME |
Yes | Bucket name | |
UBAREC_ZIP_PASSWORD |
No | ZIP password | |
UBAREC_DB_TYPE |
No | mssql |
Database type ('mssql' or 'postgres') |
UBAREC_DB_HOST |
No | localhost |
Database server |
UBAREC_DB_PORT |
No | Database connection port | |
UBAREC_DB_USERNAME |
Yes | User name to connect to the database | |
UBAREC_DB_PASSWORD |
Yes | Password to connect to the database | |
UBAREC_DB_DRIVER |
No | ODBC driver to connect to the database (used for MSSQL) | |
UBAREC_TEMP_PATH |
No | User temporary files storage | Path for storing temporary files |
UBAREC_LOG_PATH |
No | Log storage path | |
UBAREC_DEBUG |
No | False |
Debug mode |
UBAREC_FILENAME_PREFIX |
Нет | {hostname}__{backup_name}__ |
Prefix of file name uploaded to S3 storage |
Backup
ubarec backup --help
TODO: Describe the backup algorithm, startup keys
Restore from backup
ubarec restore --help
TODO: Describe the restore algorithm, startup keys
Metadata
Release files for ubarec 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ubarec-0.2.2.tar.gz | 26.4 kB | Without provenance | Details for ubarec-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ubarec-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for ubarec-0.2.2-py3-none-any.whl |
Total release size: 37.6 kB
Release files / ubarec-0.2.2.tar.gz
| Download URL | ubarec-0.2.2.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c72ac3553e78781c96f521708b2f8b130c247ce30c7ab0bd6db6458a7bc2033
|
|
BLAKE2b-256 checksum How to use checksums |
0db15e68f0753ffd126773784d5b2aa1d9b57b618ba5637c55f526fe6980a2f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11
|
Release files / ubarec-0.2.2-py3-none-any.whl
| Download URL | ubarec-0.2.2-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6268b59979902af404e7c6056e46c005fa46b1af0d9683582101a38ae85de7c2
|
|
BLAKE2b-256 checksum How to use checksums |
6aeb833f46f1f6ae497ba09ff9d658696bb5f6bfb5e9df796188af674434b902
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11
|
Security for ubarec 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.