# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['queen', 'queen.parsing', 'queen.plugins']

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

install_requires = \
['sentry-sdk>=1.0.0,<2.0.0', 'toml>=0.10.2,<0.11.0']

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

setup_kwargs = {
    'name': 'borg-queen',
    'version': '0.1.0b1',
    'description': 'Wrapper for Borg Backup.',
    'long_description': "# Queen\n\nA wrapper around [Borg backup](https://www.borgbackup.org/).\n\nLike other borg wrappers, queen defines a site config file format that specifies\nwhat contents should go in a borg archive. It also defines a standard location\nin /etc/ where it will look for these site config files automatically. Unlike other\nwrappers, it can run some predefined actions (called plugins), that generate\nfiles to be included in the backup.\n\nCurrently, there are three plugins:\n\n-\t'postgres' that creates binary dumps using `pg_dump`\n-\t'mysql' that creates sql dumps using `mysqldump`\n-\t'docker_volume' that creates tarballs out of docker volumes\n\nMore plugins may be defined in the future.\n\n## Installation\n\nInstall using pip.\n\nYou must also have `borg` installed and available on the PATH.\n\nIf you use the `postgres` plugin, you also need `pg_dump` installed.\n\nIf you use the `mysql` plugin, you also need `mysqldump` installed.\n\nIf you use the `docker_volume` plugin, you also need `docker` installed.\n\n## Usage\n\n    usage: queen [-h] [-s SITE_CONFIG]\n\n    Take backups using Borg\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -s SITE_CONFIG, --site-config SITE_CONFIG\n                            Backup using the supplied config file instead of those\n                            in /etc/queen/sites.d/\n\n\nUnless supplied with `-s`, queen will process all site configs in\n`/etc/queen/sites.d/`.\n\n## Configuration\n\nQueen reads its configuration from `/etc/queen/queen.toml`\n\n```toml\nrepo_prefix = 'some@repo:prefix'\nsentry_dsn = 'some sentry dsn'\n\n[logging]\ndirectory = '/some/directory/'\n\n[borg_env]\nBORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'\n\n[[plugins.postgres]]\nhost = 'localhost'\n```\n\n`repo_prefix`, `sentry_dsn` and `logging.directory` are required.\n\nThe repo location will be a subdirectory inside `repo_prefix` named after your\nsite config's `project_name`. You can pass a [remote repository URL][1] to\ncreate your repo in a remote host, such as `user@host:/path`. The path\nspecified in `repo_prefix` must already exist.\n\n\n[1]: https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls\n\nThe `borg_env` table may contain environment variables. These will be used for\nthe call to `borg create`.\n\nThe `plugins` table may contain a table of tables. Keys under `plugins` must\ncorrespond to plugin names. Key inside each plugin will be merged with each\nsite's plugin configs, with the site's values taking precedence.\n\n## Site config example\nSite configs should be in toml and placed in `/etc/queen/sites.d/`\n\n```toml\nproject_name = 'myproject'\npassphrase = 'some secret'\npaths = [\n\t'/srv/python/myproject',\n\t'/etc/myproject'\n]\n\n[[plugins.postgres]]\ndatabase = 'myproject'\n\n[[plugins.mysql]]\ndatabase = 'myproject'\nuser = 'dbuser'\npassword = 'dbpassword'\n```\n\nSome notes:\n\n-\t`project_name` and `passphrase` are required\n-\t`paths` should be absolute\n-\tIf any of the paths does not exist, queen will emit a WARNING and create a\n\tborg archive with the rest of the configuration (existing paths and plugins)\n\n## Plugin configuration\n\nPlugins may be configured both globally and per site. When both configurations\nare present, they are merged with the site's configuration taking precedence.\n\nFor example, if you want to use a specific username & password for backing up\npostgres databases, you may specify them in the global configuration's `plugins.postgres`\ntable. You can then specify the rest of the configuration (eg. `database`) in each\nsite without repeating the username & password. If a single still site needs to override\nthe username & password, you can specify it on just that site and they will override the\nones in the global configuration.\n\n### Postgres\n\n`plugins.postgres` should be a list of tables, each one describing a database.\nEach table may contain the following keys:\n\n-\t`database`\n-\t`user`\n-\t`password`\n-\t`host`\n-\t`port`\n-\t`pg_dump`\n\nOnly `database` is required, all other keys are optional.\n\n`user`, `password`, `host` and `port` will be used to connect to postgres.\n\n`pg_dump` must be a list of strings and will be used as the binary to use for taking\nbackups. It is useful for specifying wrapper scripts for pg_dump, for example:\n\n-\t`['sudo', '-iu', 'postgres', 'pg_dump']` for changing the unix user that will invoke pg_dump.\n-\t`['docker', 'exec', 'container_name', 'pg_dump']` to take a backup from a running postgres\n\tcontainer.\n-\tYour own custom shell scripts, wrapping pg_dump\n\nIt must be compatible with the actual pg_dump binary and it defaults to `['pg_dump']`.\n\n\nFor backwards compatibility, `plugins.postgres` may be a list of strings, which\nare interpreted as database names.\n\n#### Sample config\n\nFull config:\n\n```toml\n# ...\n[[plugins.postgres]]\ndatabase = 'database_1'\nuser = 'user'\npassword = 'password'\nhost = 'host'\nport = 1234\npg_dump = ['sudo', '-iu', 'postgres', 'pg_dump']\n\n[[plugins.postgres]]\ndatabase = 'database_2'\nuser = 'user'\npassword = 'password'\nhost = 'host'\nport = 1234\n```\n\nLegacy config:\n\n```toml\n[plugins]\npostgres = [\n\t'database_1',\n\t'database_2'\n]\n```\n\n### MySQL\n\n`plugins.mysql` should be a list of tables, each one describing a database.\nEach table may contain the following keys:\n\n-\t`database`\n-\t`user`\n-\t`password`\n-\t`host`\n-\t`port`\n\nOnly `database` is required, all other keys are optional.\n\n#### Sample config\n\n```toml\n[[plugins.mysql]]\ndatabase = 'myproject'\nhost = '127.0.0.1'\nport = 1234\nuser = 'dbuser'\npassword = 'dbpassword'\n```\n\n### docker volume\n\n`plugins.docker_volume` should be a list of tables, each one describing a\ndocker volume. Each table may contain the following keys:\n\n- `name`: the name of the docker volume. Required.\n-\t`image`: the image that will be used for making the tarball. Defaults to `alpine`\n\n#### Sample config\n```toml\n[[plugins.docker_volume]]\nname = 'my_volume'\n\n[[plugins.docker_volume]]\nname = 'my_other_volume'\nimage = 'debian:bullseye-slim'\n```\n\n\n## Repo/Archive Format\n\nQueen is going to use your project as the repo name and create it if it does\nnot exist. Each Archive will be named as the ISO-8601 timestamp of the time the\nbackup was taken in UTC (unlike borg's `{utcnow}` it includes a timezone).\n\nInside each archive, your `paths` are included as is. Plugins place their\ncontent inside `_queen/{plugin_name}`.\n\nUsing the config above as an example your archive would contain:\n\n\tsrv/\n\t\tpython/\n\t\t\tmyproject/\n\t\t\t\t...\n\tetc/\n\t\tmyproject/\n\t\t\t...\n\t_queen/\n\t\tpostgres/\n\t\t\tmyproject.pgdump\n\t\tmysql/\n\t\t\tmyproject.dump.sql\n",
    'author': 'Indev',
    'author_email': 'admin@indevsoftware.io',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://bitbucket.org/indev/queen/',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
