In order to develop backy2, follow these steps. This is all tested in ubuntu 16.10 and 16.04 as user. If anything in backy2 requires root, it will be explicitly mentioned (hint: it’s not much!).
Checkout the repository:
$ git clone https://github.com/wamdam/backy2 $ cd backy2
Create a virtualenv:
$ make env
This will install all dependent python packages as well as all requirements for tests and documentation building.
To see what this does, just look at the Makefile. It’s not magic.
Getting version information¶
In order to get version information, run:
To rebuild anything, at any time simply run
As this will also remove your virtualenv, re-run
There are very few pytest test cases. We hope to have more in the future. Anyway, you can run them via
pytest tests are currently in a disasterous state. Don’t run them, they’ll fail.
The much more challenging test cases are in a scripted smoketest. This test runs 100 backups (including hint files, even with different image sizes), scrubs and restores and compares all these. This is and will be the realistic implementation test for backup, scrub and restore. This must not fail:
In order to run backy2, source the virtualenv:
$ . env/bin/activate $ backy2 --help
After that, you may follow the backup section in the quickstart tutorial.
Creating a debian package¶
Follow these steps to create a new .deb release:
- Update the changelog in
debian/changelog. Just follow the existing formatting. Please ignore false weekday names - they’re from me as I’m very lazy with this.
- Change the version in
The new .deb file will be stored in
Creating a .pex package¶
A .pex file is a zip file containing an entry point and all python libraries including all compiled shared libraries required to run the software.
Python directly supports zip files, so it’s able to directly run a .pex file. You need to have a very similar build environment for your .pex file as it is on your server in order to make this work.
But if you have this, the
build/backy2.pex file will be a single file
deployment for your servers.
This is how you create it:
In order to run this, simply call
deactivate # deactivate the virtualenv ./build/backy2.pex --help
Building the docs¶
To build the docs, run:
. env/bin/activate cd docs make html
The active virtualenv is needed because backy2 docs make heavy use of the
.. command-output:: plugin which is used to render backy2’s output into the
The built html docs are then in
Data backends are in
src/backy2/data_backends. Their abstract implemetation is in
Which data backend is in use is directly defined in
backy.cfgin the section
[DataBackend]under the key
Meta backends are in
src/backy2/meta_backends. Their abstract implemetation is in
Which meta backend is in unse is directly defined in
backy.cfgin the section
[MetaBackend]under the key
The SQL migrations are in
src/backy2/meta_backends/sql_migrations. They are automatically generated with the script
alembic. This script only shortcuts the
-coption. The call is then
./alembic revision --autogenerate -m "Added snapshot_name to versions".
The NBD server is in the directory
I don’t need to tell you about pull requests, do I?
Have fun ;)