All Projects → funkyfuture → compose-dump

funkyfuture / compose-dump

Licence: ISC License
Dump and restore Docker Compose-projects

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to compose-dump

Bareos
Main repository with the code for the libraries and daemons
Stars: ✭ 651 (+4550%)
Mutual labels:  backup, archiving
Wal E
Continuous Archiving for Postgres
Stars: ✭ 3,313 (+23564.29%)
Mutual labels:  backup, archiving
Libarchive
Multi-format archive and compression library
Stars: ✭ 1,625 (+11507.14%)
Mutual labels:  backup, archiving
Pg probackup
Backup and recovery manager for PostgreSQL
Stars: ✭ 383 (+2635.71%)
Mutual labels:  backup, archiving
Pgbackrest
Reliable PostgreSQL Backup & Restore
Stars: ✭ 766 (+5371.43%)
Mutual labels:  backup, archiving
Mkstage4
Bash Utility for Creating Stage 4 Tarballs
Stars: ✭ 55 (+292.86%)
Mutual labels:  backup, archiving
Wal G
Archival and Restoration for Postgres
Stars: ✭ 1,974 (+14000%)
Mutual labels:  backup, archiving
emsm
A lightweight, easy to extend minecraft server manager.
Stars: ✭ 72 (+414.29%)
Mutual labels:  backup
yii2-db-manager
Database Backup and Restore functionality
Stars: ✭ 96 (+585.71%)
Mutual labels:  backup
grafana
Grafana dashboard for Veeam solutions
Stars: ✭ 31 (+121.43%)
Mutual labels:  backup
restique
A wrapper around restic with profiles
Stars: ✭ 43 (+207.14%)
Mutual labels:  backup
docker-backup
💾 Docker container for incremental backups based on alpine (S3, Google Cloud Storage, FTP, SFTP, SCP, rsync, file...)
Stars: ✭ 19 (+35.71%)
Mutual labels:  backup
iceshelf
A simple tool to allow storage of signed, encrypted, incremental backups using Amazon's Glacier storage
Stars: ✭ 28 (+100%)
Mutual labels:  backup
backup-github-repo
Backup all the issues and pull requests of a Github repo, including the comments, events, and labels, as JSON and as HTML
Stars: ✭ 31 (+121.43%)
Mutual labels:  backup
gickup
No description or website provided.
Stars: ✭ 471 (+3264.29%)
Mutual labels:  backup
docker-aws-s3-sync
Docker container to sync a folder to Amazon S3
Stars: ✭ 21 (+50%)
Mutual labels:  backup
pastpages.org
The news homepage archive
Stars: ✭ 81 (+478.57%)
Mutual labels:  archiving
couchbackup
CouchDB backup and restore command-line utility.
Stars: ✭ 15 (+7.14%)
Mutual labels:  backup
kube-dump
Backup a Kubernetes cluster as a yaml manifest
Stars: ✭ 142 (+914.29%)
Mutual labels:  backup
s3backup
No more custom backup scripts please ...
Stars: ✭ 20 (+42.86%)
Mutual labels:  backup

Overview

This piece of code is tested with only a small number of use-cases yet.
You are invited to contribute.

compose-dump let's you backup and (not yet) restore Docker Compose -projects. Like docker-compose this tool operates usually in a project- folder. It's intended to be a simple tool for usage within a broader backup-logic. The extent of a backup can be controlled by content scopes and services.

Main features

  • Archives Docker Compose projects.
  • Optionally include configuration with all its referenced files.
  • Optionally include volumes of specified services.
  • Store dumps in a directory, as archive on disk or as archive to the standard output.

See planned features below.

Installation

With pipsi (recommended to avoid library version conflicts):

$ pipsi install compose-dump

Or with pip:

$ pip install compose-dump

To install an editable development instance:

$ cd compose-dump
$ pipsi install -e .  # or use `pip`

Usage

Examples

Fully dump a compose-project from project_path to /var/backups/compose:

$ cd project_path
$ compose-dump backup -t /var/backups/compose

Write a gzip-compressed archive to a remote host via ssh:

$ cd project_path
$ compose-dump backup -x gz | ssh user@host "cat - > ~/backup.tar.gz"

Only dump configuration and data from container-volumes of the service web:

$ compose-dump backup --config --volumes web

Backup all projects with a docker-compose.yml to /var/backups/compose:

$ find . -name "docker-compose.yml" -type f -execdir compose-dump backup -t /var/backups/compose \;

Command line reference:

$ compose-dump
$ compose-dump backup --help

Backup structure

Any data that is located outside the project's scope is ignored. In particular this are mounted volumes that are not in the project-path or below and volumes in volumes_from-referenced containers. Consider this not as a limitation, but as a feature to endorse good practices; handle these objects in your broader backup-logic.

The resulting dump is structured this way:

+ <hostname>_<project_name>__<shorted_path_hash>___<date>_<time>  # that's the default
  - Manifest.yml
  + config
    - <config_files>…  # Usually docker-compose.yml and its referenced files
    - <build_contexts>…
  + volumes
    + mounted
      <host path relative to project path>…
    + project
      <project volume in a tar archive>…
    + services
      + <service>…
        <service volume in a tar archive>…

Contributing

Fork it, report issues and open pull requests at https://github.com/funkyfuture/compose-dump . All code is to be formatted with black.

Testing

The integration tests require a docker client on the test machine. To keep the temporary directories that contain integration tests' results, invoke pytest with the --keep-results option.

Before opening a pull request, make sure you run tests against all supported dependencies with make test-all.

You are free to hate me for relying mainly on integration tests. But keep it to yourself, the world's already filled up with hatred. I suggest anyone with such sentiment uses this dark energy to implement improvements.

Style notes

The code may seem cumbersome when it comes to paths. This is caused by anticipation of the file system path protocol that comes with Python 3.6 and later. The rule of thumb here is: Always use :class:`pathlib.Path` objects to represent paths, convert values for function calls with :func:`str`, convert results to Path instances. Until 3.6's reign has come.

TODO / Known issues / Caveats

general

  • make use of compose config hashes
  • docs: point to environment variables regarding tls config
  • make use of mypy

backup

You may run into issues if a volume's archive delivered by the Docker daemon is larger than the available memory. Thus you should avoid such scenarios on production systems. This does not apply for mounted volumes. If you can't avoid such cases, please open an issue.

  • test volumes defined in extended services
  • filter volumes
  • only pause actually affected services
  • backup-configuration from a file in a project's folder
  • maybe:
    • respect .dockerignore
    • .backupignore
    • read config from stdin

restore

  • implement an automated restoration of a project-dump
  • read from stdin
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].