Skip to main content

goutte

DigitalOcean doesn't propose any way of automating snapshots. There are some SaaS that can take care of it but paying to execute some API requests seemed a bit off.

That's why we developed a simple script which can run with cron jobs or in CI services like Travis for free. We use it daily to manage our backups.

It includes:

  • Snapshoting droplets
  • Snapshoting volumes
  • Retention policy
  • Pruning snapshots

Requirements

  • Python ^3.6
  • A DigitalOcean account

Installation

Install it directly from pip:

pip3 install --user goutte

Configuration file

Goutte takes its configuration from a pretty straightforward toml file. We provided and example in goutte.example.toml.

retention = 10     # Number of backups to keep per droplet/volume

[droplets]
names = [          # Array of droplets you want to snapshot
  'server01',
  'server02',
  'server03',
]

[volumes]
names = [          # Array of volumes you want to snapshot
  'db01',
  'redis01',
  'redis02',
]

Usage

Goutte takes two arguments which can also be set via environment variables:

# Help Description Environment variable
1 CONFIG Path to the toml configuration file GOUTTE_CONFIG
2 DO_TOKEN Your DigitalOcean API token GOUTTE_DO_TOKEN
Usage: goutte [OPTIONS] CONFIG DO_TOKEN

  DigitalOcean snapshots automation.

Options:
  --only [snapshot|prune]  Only snapshot or only prune
  --debug                  Enable debug logging
  --version                Show the version and exit.
  --help                   Show this message and exit.

Running "snapshot only" for a configuration file containing one droplet and one volume:

$ goutte goutte.toml $do_token --only snapshot
13:32:48 - INFO - Starting goutte v1.0.1
13:32:52 - INFO - sgp1-website-01 - Snapshot (goutte-sgp1-website-01-20181220-56bde)
13:32:59 - INFO - sgp1-mariadb-01 - Snapshot (goutte-sgp1-mariadb-01-20181220-3673d)

Run with Docker

We have a Docker image ready for you to use on Docker Hub. It will read by default the configuration under /goutte/goutte.toml

docker run \
  -e GOUTTE_DO_TOKEN=${do_token} \
  -v $(pwd)/goutte.toml:/goutte/goutte.toml \
  tomochain:goutte

Automating with Travis

You can easily automate it via cron job but the easiest way would be by leveraging free CI tools like Travis.

  1. You can create a repo which contains your goutte.toml configuration and the following travis file .travis.yml :
language: python
python: 3.6

install:
  - pip install goutte

script:
  - goutte goutte.toml # Don't forget to set GOUTTE_DO_TOKEN in Travis config
  1. Enable the repo in Travis and then go to the configuration
  2. Add the environment variable GOUTTE_DO_TOKEN with the value of your DigitalOcean API key
  3. Enable daily cron job
  4. You're good to go, goutte will run everyday and take care of the snapshots.

Note: You can have different retentions for different volumes by having multiple configurations.

# ...
script:
  - goutte 10days.toml
  - goutte 1day.toml

You can see how we set it up for ourself here.

Metadata

Release files for goutte 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for goutte 1.0.1
File Size Uploaded Provenance Actions
goutte-1.0.1.tar.gz 17.2 kB Without provenance Details for goutte-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for goutte 1.0.1
File Interpreter ABI Platform Actions
goutte-1.0.1-py3-none-any.whl Python 3 none any Details for goutte-1.0.1-py3-none-any.whl

Total release size: 65.9 kB

Release files / goutte-1.0.1.tar.gz

Download URL goutte-1.0.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f4fe55df5dc4d9c0db1444a53415ee5fffc555df18c00246fcf0690c715353b7
BLAKE2b-256 checksum
How to use checksums
36800a65cedaa2955f174254915e400ac4c05ed68530cbe7b39fab83fa19635c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / goutte-1.0.1-py3-none-any.whl

Download URL goutte-1.0.1-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8abeb3814df249cc1ea8ad0fa4a81d342d5bf25b3f115e4955b2814c7db5d15b
BLAKE2b-256 checksum
How to use checksums
bb2de6e505a290bf6a8de03f5e9dfdd14ce8938b48ba6e51f65866b654c40147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Security for goutte 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page