Skip to main content

Wrap docker-compose to acheive dev-perfect CI

Project description

compoctl backup

Backup data into ./backup.

Example configuration that makes it work as-is:

volumes:
- ./backup/postgres:/backup
labels:
  io.compoctl.backup.cmd: pg_dumpall -U postgres -f /backup/data.dump

This will dump pg data into ./backup/postgres, and also export docker-compose running config into ./backup/docker-compose.restore.yml

It will also execute the docker-compose.backup.yml if it exists. This is were you can spawn a container that mounts ./backup and proceeds to the secure backup export over the network that you want for production.

To prevent permission issues, containers should at no time write the ./backup directory itself.

compoctl restore

Copy docker-compose.yml back from ./backup and run restore commands.

This is a destructive operation that will delete all volumes except the backup volume, up each service one by one and apply the restore command.

Example configuration that makes it work as-is:

volumes:
- ./backup/postgres:/backup
labels:
  compoctl.restore: psql -U postgres -f /backup/data.dump

Note that the ./backup directory must have been provisioned with the backup command priorly.

Also, the cluster will be unusable/down during the restore operation.

compoctl apply

Chain pull/down/up/logs/ps:

compoctl -f ./foo.yml apply

# will run:
docker-compose -f ./foo.yml pull
docker-compose -f ./foo.yml down
docker-compose -f ./foo.yml up -d
docker-compose -f ./foo.yml logs
docker-compose -f ./foo.yml ps

Development status

POC working, will need tweaking to support more complex operations. The objective is to stabilize the commands before proposing them upstream to docker-compose.

Install

Install with pip: pip install compoctl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compoctl-0.1.2.post1.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file compoctl-0.1.2.post1.tar.gz.

File metadata

  • Download URL: compoctl-0.1.2.post1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for compoctl-0.1.2.post1.tar.gz
Algorithm Hash digest
SHA256 56b07ee6c8dfb641018bd605735e329af465683fd8769bff975efbeac978c9e1
MD5 d86ed2173bdde4895e32e9273a819aef
BLAKE2b-256 225397f202cdeaaa91ea9597067bf4bd6151adc0e2b30539b40a1c3396b65de4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page