Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors Azure Blob Storage destination #458

Merged
merged 10 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ target/
/vagrant/README.html
/.pytest_cache/
/.venv/

# asdf
.envrc
.tool-versions

# vscode
.vscode/

# environment
.env
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ lint: ## check style with pylint
test: ## Run tests quickly with the default Python and generate code coverage report
pytest -xv --cov-report term-missing --cov-report xml --cov=./twindb_backup tests/unit

test-including-azure-blob: ## Like 'make test' but includes tests for azure blob destination
coverage run --source=twindb_backup -m pytest -xv tests/unit
coverage run -a --source=twindb_backup -m unittest -cvf --locals tests/unittests/azblob_testing/environment_access_tests/test_remote_data_generation.py
coverage run -a --source=twindb_backup -m unittest -cvf --locals tests/unittests/azblob_testing/destination_tests/test_AzureBlob_functions.py
coverage report

test-integration: ## Run integration tests. Must be run in vagrant
py.test -xsv tests/integration/

Expand Down Expand Up @@ -174,6 +168,9 @@ endif
ifeq ($(OS_VERSION),7)
PLATFORM = centos
endif
ifeq ($(OS_VERSION),8)
PLATFORM = centos
endif

package: ## Build package - OS_VERSION must be one of: jammy, focal.
@docker run \
Expand Down
8 changes: 6 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ TwinDB Backup
:alt: Updates

TwinDB Backup is a multipurpose tool for backing up MySQL database and regular files/directories on the file system.
It can store backup copies on a remote SSH server, Amazon S3 or
Google Cloud Storage.
It can store backup copies on a remote SSH server, Amazon S3, Azure Blob Storage,
or Google Cloud Storage.

TwinDB Backup accepts a backup copy stream from any of supported sources
(MySQL Server, Percona Server, Percona XtraDB Cluster, or file system)
Expand All @@ -53,6 +53,7 @@ After the stream passed all modifiers it is sent to one of the configured
backup destination. It can be:

- Amazon S3 bucket
- Azure Blob Storage account
- Google Cloud Storage bucket
- Any server with SSH demon

Expand Down Expand Up @@ -92,6 +93,7 @@ Features
**TwinDB Backup** storage options:

- Amazon S3
- Azure Blob Storage
- Google Cloud Storage
- Remote SSH server
- Optional local copy
Expand Down Expand Up @@ -147,6 +149,7 @@ Possible ``OS_VERSION`` values:
* jammy
* focal
* 7 (for CentOS 7)
* 8 (for CentOS 8)

.. code-block:: console

Expand Down Expand Up @@ -182,6 +185,7 @@ Credits
* `Arda Beyazoğlu <https://github.com/ardabeyazoglu>`_
* `Egor Lyutov <https://github.com/el4v>`_
* `fonthead <https://github.com/fonthead>`_
* `James Salzman <https://github.com/Jsalz2000>`_
* `Maksym Kryva <https://github.com/mkryva>`_
* `Manjot Singh <https://github.com/ManjotS>`_
* `Michael Rikmas <https://github.com/catyellow>`_
Expand Down
55 changes: 25 additions & 30 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import sys

# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
Expand All @@ -40,23 +40,23 @@

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'TwinDB Backup'
copyright = u"2016-2019, TwinDB Development Team"
project = "TwinDB Backup"
copyright = "2016-2019, TwinDB Development Team"

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
Expand All @@ -79,7 +79,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -97,7 +97,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -111,7 +111,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
Expand All @@ -131,18 +131,18 @@

# The name of an image file (relative to this directory) to place at the
# top of the sidebar.
html_logo = '_static/logo.png'
html_logo = "_static/logo.png"

# The name of an image file (within the static path) to use as favicon
# of the docs. This file should be a Windows icon file (.ico) being
# 16x16 or 32x32 pixels large.
html_favicon = '_static/favicon.png'
html_favicon = "_static/favicon.png"

# Add any paths that contain custom static files (such as style sheets)
# here, relative to this directory. They are copied after the builtin
# static files, so a file named "default.css" will overwrite the builtin
# "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
Expand Down Expand Up @@ -188,18 +188,16 @@
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'twindb_backupdoc'
htmlhelp_basename = "twindb_backupdoc"


# -- Options for LaTeX output ------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
Expand All @@ -208,9 +206,7 @@
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'twindb_backup.tex',
u'TwinDB Backup Documentation',
u'TwinDB Development Team', 'manual'),
("index", "twindb_backup.tex", "TwinDB Backup Documentation", "TwinDB Development Team", "manual"),
]

# The name of an image file (relative to this directory) to place at
Expand Down Expand Up @@ -238,11 +234,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'twindb_backup',
u'TwinDB Backup Documentation',
[u'TwinDB Development Team'], 1)
]
man_pages = [("index", "twindb_backup", "TwinDB Backup Documentation", ["TwinDB Development Team"], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -254,12 +246,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'twindb_backup',
u'TwinDB Backup Documentation',
u'TwinDB Development Team',
'twindb_backup',
'One line description of project.',
'Miscellaneous'),
(
"index",
"twindb_backup",
"TwinDB Backup Documentation",
"TwinDB Development Team",
"twindb_backup",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down
8 changes: 8 additions & 0 deletions docs/twindb_backup.configuration.destinations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ twindb\_backup.configuration.destinations package
Submodules
----------

twindb\_backup.configuration.destinations.az module
----------------------------------------------------

.. automodule:: twindb_backup.configuration.destinations.az
:members:
:undoc-members:
:show-inheritance:

twindb\_backup.configuration.destinations.gcs module
----------------------------------------------------

Expand Down
16 changes: 8 additions & 8 deletions docs/twindb_backup.destination.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ twindb\_backup.destination package
Submodules
----------

twindb\_backup.destination.azblob module
----------------------------------------

.. automodule:: twindb_backup.destination.azblob
:members:
:undoc-members:
:show-inheritance:

twindb\_backup.destination.base\_destination module
---------------------------------------------------

Expand All @@ -28,6 +20,14 @@ twindb\_backup.destination.exceptions module
:undoc-members:
:show-inheritance:

twindb\_backup.destination.az module
-------------------------------------

.. automodule:: twindb_backup.destination.az
:members:
:undoc-members:
:show-inheritance:

twindb\_backup.destination.gcs module
-------------------------------------

Expand Down
16 changes: 15 additions & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Backup Destination
The ``[destination]`` section specifies where to store backup copies.

``backup_destination`` can be either ``ssh`` (if you want to store backups on a remote SSH server),
or ``s3`` (if you want to store backups in Amazon S3), or ``gsc`` (if the backup should be stored in Google Cloud).
``s3`` (if you want to store backups in Amazon S3), ``az`` (if the backup should be stored in Azure Blob Storage), or ``gcs`` (if the backup should be stored in Google Cloud).

In the optional ``keep_local_path`` you can specify a local path where the tool will store a local copy of the backup.
It's useful if you want to stream a MySQL backup to S3 and would like to keep a local copy as well.
Expand Down Expand Up @@ -89,6 +89,20 @@ In the ``[s3]`` section you specify Amazon credentials as well as an S3 bucket w
AWS_DEFAULT_REGION = us-east-1
BUCKET = twindb-backups

Azure Blob Storage
~~~~~~~~~~~~~~~~~~~~

In the ``[az]`` section you specify Azure credentials as well as Azure Blob Storage container where to store backups.

.. code-block:: ini

[az]

connection_string = "DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=ACCOUNT_KEY;EndpointSuffix=core.windows.net"
container_name = twindb-backups
remote_path = /backups/mysql # optional


Google Cloud Storage
~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#@IgnoreInspection BashAddShebang
azure-core ~= 1.24
azure-storage-blob ~= 12.12
azure-storage-blob ~= 12.19
Click ~= 8.1
PyMySQL ~= 1.0
boto3 ~= 1.7
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ azure-core==1.29.4
# via
# -r requirements.in
# azure-storage-blob
azure-storage-blob==12.18.3
azure-storage-blob==12.22.0
# via -r requirements.in
bcrypt==4.0.1
# via paramiko
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#@IgnoreInspection BashAddShebang
azure-storage-blob ~= 12.19
black ~= 22.3
Sphinx ~= 4.5
bumpversion ~= 0.6
Expand Down
2 changes: 2 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ alabaster==0.7.13
# via sphinx
astroid==2.15.8
# via pylint
azure-storage-blob==12.22.0
# via -r requirements.in
babel==2.13.0
# via sphinx
black==22.12.0
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages

from setuptools import find_packages, setup

del os.link

Expand Down
Loading
Loading