Giter VIP home page Giter VIP logo

juju-backup-all's Introduction

Juju Backup-All-the-Things

Introduction

This Juju plugin allows operators to backup juju controllers as well as the following charms:

The plugin enumerates through all controllers, backing up the controller and scanning through each model for any applications that can be backed up. It then saves these backups.

Find it on the Snap Store!

Get it from the Snap Store

Install

Install juju-backup-all from Snap Store with:

snap install juju-backup-all

Then, make sure the appropriate interfaces are plugged:

snap connect juju-backup-all:juju-client-observe
snap connect juju-backup-all:ssh-keys

Usage

This tool primarily auto-discovers controllers/charms that need backing up. To backup the current controller, simply run:

juju-backup-all

This will backup all apps of all models (in the current controller) of supported charms and output them into juju-backups/ directory. It will also backup the local juju client config.

For a more complex command, here's an example that specifies an output directory, excludes certain charms, excludes the juju client config backup, and runs backups on all controllers.

juju-backup-all -o my/backups/ \
  -e postgresql \
  -e etcd \
  --all-controllers

The following command will give all the possible arguments that can be passed to the tool:

juju-backup-all -h

The backup directory structure will look like the following:

juju-backups/
├── local_configs/
│   └── juju.tar.gz
├── controller1/
│   ├── model1/
│   │   ├── mysql-innodb-cluster/
│          └── mysqldump.tar.gz
└── controller2/
    └── model1/
        └── etcd-app/
            └── backups.tar.gz

Development and Testing

To set up development environment:

make install-dev
. venv/bin/activate

# if pre-commit hooks desired:
pre-commit install

Functional tests

To run functional tests:

make functional

or

tox -e functional

Several environment variables are available for setting to help expedite testing. These include:

  • PYTEST_KEEP_MODELS: keeps the models after running functional tests. This helps in debugging and reuse of models for quicker testing
  • PYTEST_MYSQL_MODEL, PYTEST_ETCD_MODEL: setting these to a current model will have the functional tests use that model instead of deploying another one.
  • JUJU_DATA: Specify where your juju client config directory is located. If not set, it will default to ~/.local/share/juju. This is needed in functional testing as the tool runs some subprocess juju commands (like juju create-backup) and without this set, the environment for functional tests has no info on controllers.
  • PYTEST_SELECT_TESTS: use to select tests based on their name (via pytest -k expression docs)

Unit tests

The unit tests run for two different versions of python - 3.6 (Ubuntu Bionic) and 3.8 (Ubuntu Focal), they will have to be available to run the unit tests.

To run unit tests:

make unit

To run unit tests and also generate html coverage reports:

make unit-coverage

Building and Installing Snap Locally

To build the snap locally, simply run:

make snap

You can then install the locally built snap with:

sudo snap install --dangerous ./juju-backup-all_${VERSION}.snap

To clean up the snapcraft build environment, run the following:

make snap-clean

juju-backup-all's People

Contributors

dashmage avatar jguedez avatar sudeephb avatar canonical-xavd avatar facundofc avatar agileshaw avatar xiywang avatar zxhdaze avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.