# -*- coding: utf-8 -*-
from distutils.core import setup

packages = \
['goutte']

package_data = \
{'': ['*']}

install_requires = \
['click>=7.0,<8.0',
 'colorlog>=3.1,<4.0',
 'python-digitalocean>=1.14,<2.0',
 'toml>=0.10.0,<0.11.0']

entry_points = \
{'console_scripts': ['goutte = goutte.main:entrypoint']}

setup_kwargs = {
    'name': 'goutte',
    'version': '1.0.1',
    'description': 'DigitalOcean snapshot automation service',
    'long_description': '# goutte <a href="https://travis-ci.org/tomochain/goutte"><img align="right" src="https://travis-ci.org/tomochain/goutte.svg?branch=develop"></a>\nDigitalOcean doesn\'t propose any way of automating snapshots.\nThere are [some SaaS](https://snapshooter.io/) that can take care of it but paying to execute some API requests seemed a bit off.\n\nThat\'s why we developed a simple script which can run with cron jobs or in CI services like Travis for free.\nWe use it daily to manage [our backups](https://github.com/tomochain/backups).\n\nIt includes:\n- Snapshoting droplets\n- Snapshoting volumes\n- Retention policy\n- Pruning snapshots\n\n## Requirements\n- Python ^3.6\n- A DigitalOcean account\n\n## Installation\nInstall it directly from pip:\n```bash\npip3 install --user goutte\n```\n\n## Configuration file\nGoutte takes its configuration from a pretty straightforward toml file.\nWe provided and example in `goutte.example.toml`.\n\n```toml\nretention = 10     # Number of backups to keep per droplet/volume\n\n[droplets]\nnames = [          # Array of droplets you want to snapshot\n  \'server01\',\n  \'server02\',\n  \'server03\',\n]\n\n[volumes]\nnames = [          # Array of volumes you want to snapshot\n  \'db01\',\n  \'redis01\',\n  \'redis02\',\n]\n```\n\n## Usage\nGoutte takes two arguments which can also be set via environment variables:\n\n| # | Help     | Description                         | Environment variable |\n| - | -------- | ----------------------------------- | -------------------- |\n| 1 | CONFIG   | Path to the toml configuration file | `GOUTTE_CONFIG`      |\n| 2 | DO_TOKEN | Your DigitalOcean API token         | `GOUTTE_DO_TOKEN`    |\n\n```bash\nUsage: goutte [OPTIONS] CONFIG DO_TOKEN\n\n  DigitalOcean snapshots automation.\n\nOptions:\n  --only [snapshot|prune]  Only snapshot or only prune\n  --debug                  Enable debug logging\n  --version                Show the version and exit.\n  --help                   Show this message and exit.\n```\n\nRunning "snapshot only" for a configuration file containing one droplet and one volume:\n```bash\n$ goutte goutte.toml $do_token --only snapshot\n13:32:48 - INFO - Starting goutte v1.0.1\n13:32:52 - INFO - sgp1-website-01 - Snapshot (goutte-sgp1-website-01-20181220-56bde)\n13:32:59 - INFO - sgp1-mariadb-01 - Snapshot (goutte-sgp1-mariadb-01-20181220-3673d)\n```\n\n## Run with Docker\nWe have a Docker image ready for you to use on Docker Hub.\nIt will read by default the configuration under `/goutte/goutte.toml`\n\n```bash\ndocker run \\\n  -e GOUTTE_DO_TOKEN=${do_token} \\\n  -v $(pwd)/goutte.toml:/goutte/goutte.toml \\\n  tomochain:goutte\n```\n\n## Automating with Travis\nYou can easily automate it via cron job but the easiest way would be by leveraging free CI tools like Travis.\n\n1. You can create a repo which contains your `goutte.toml` configuration and the following travis file `.travis.yml` :\n\n```yml\nlanguage: python\npython: 3.6\n\ninstall:\n  - pip install goutte\n\nscript:\n  - goutte goutte.toml # Don\'t forget to set GOUTTE_DO_TOKEN in Travis config\n```\n\n2. Enable the repo in Travis and then go to the configuration\n3. Add the environment variable GOUTTE_DO_TOKEN with the value of your DigitalOcean API key\n4. Enable daily cron job\n5. You\'re good to go, goutte will run everyday and take care of the snapshots.\n\n**Note**: You can have different retentions for different volumes by having multiple configurations.\n```yml\n# ...\nscript:\n  - goutte 10days.toml\n  - goutte 1day.toml\n```\n\nYou can see how we set it up for ourself [here](https://github.com/tomochain/backups).\n',
    'author': 'etienne-napoleone',
    'author_email': 'etienne@tomochain.com',
    'url': 'https://github.com/tomochain/goutte',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.5,<4.0',
}


setup(**setup_kwargs)
