{ "info": { "author": "Adam Rehn", "author_email": "adam@adamrehn.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Build Tools" ], "description": "Docker Idle Watchdog\n====================\n\nThe docker-watchdog Python package provides a background service that monitors Docker container hosts for periods of inactivity and performs an automatic shutdown of the host after a predefined idle threshold is reached. In a similar manner to the [shutdown-if-idle](https://github.com/PolicyStat/shutdown-if-idle) package, the intended use case is the automatic shutdown of cloud VMs that have been started on demand as part of a Continuous Integration (CI) pipeline, albeit with a focus on Docker container hosts.\n\nThe key features of the package include:\n\n- Supports Windows, macOS, and Linux\n- Provides easy service installation under all supported operating systems\n- Takes cloud provider billing granularity into account to ensure shutdown decisions are cost-effective\n\n\n## Contents\n\n- [Installation](#installation)\n - [Requirements](#requirements)\n - [Package installation](#package-installation)\n - [Service installation](#service-installation)\n - [Installation scripts for cloud servers](#installation-scripts-for-cloud-servers)\n- [Configuration](#configuration)\n- [Legal](#legal)\n\n\n## Installation\n\n### Requirements\n\nThe docker-watchdog package requires the following:\n\n- Python 3.5 or newer\n- Under macOS and Linux, the [pleaserun](https://github.com/jordansissel/pleaserun) Ruby gem needs to be installed to perform service installation\n\n### Package installation\n\nTo install the docker-watchdog Python package itself, simply run:\n\n```\npip3 install docker-watchdog\n```\n\n(You may need to prefix this command with `sudo` under macOS and Linux.)\n\nOnce the package is installed, you can run the watchdog via either of these commands:\n\n```bash\n# Uses the wrapper generated by pip\ndocker-watchdog\n\n# Invokes the package directly via the Python interpreter\npython3 -m docker_watchdog\n```\n\n### Service installation\n\nTo install the startup service for docker-watchdog, ensure you have any [necessary dependencies](#requirements) installed and run the following command with elevated privileges:\n\n```\ndocker-watchdog --install\n```\n\nThe background service will then start automatically the next time the host system boots up.\n\n### Installation scripts for cloud servers\n\nTo simplify the setup process for cloud servers, the [scripts](https://github.com/adamrehn/docker-watchdog/tree/master/scripts) directory contains installation scripts for common Docker container host platforms. The scripts automatically install docker-watchdog and its dependencies, and register the docker-watchdog startup service.\n\nScripts are provided for the following platforms:\n\n- **Windows Server**: [scripts/install_windows_server.ps1](https://github.com/adamrehn/docker-watchdog/blob/master/scripts/install_windows_server.ps1)\n\n Installs the [Chocolatey](https://chocolatey.org/) package manager, uses Chocolatey to install Python and docker-watchdog, and registers the docker-watchdog startup service.\n\n To use this script, run the following command from an elevated PowerShell prompt:\n\n ```powershell\n Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/adamrehn/docker-watchdog/master/scripts/install_windows_server.ps1'))\n ```\n\n- **Debian-based Linux distros**: [scripts/install_debian.sh](https://github.com/adamrehn/docker-watchdog/blob/master/scripts/install_debian.sh)\n\n Installs Python, Ruby, pleaserun, and docker-watchdog, and registers the docker-watchdog startup service.\n\n To use this script, run the following command with root priveleges:\n\n ```bash\n curl -fsSL 'https://raw.githubusercontent.com/adamrehn/docker-watchdog/master/scripts/install_debian.sh' | bash\n ```\n\n\n## Configuration\n\nThe watchdog can be configured either via a JSON configuration file or via environment variables. These two methods can also be used together, in which case values from the configuration file will take precedence over values from environment variables. Any settings for which a value has not been specified will fallback to using a sane default.\n\nThe location of the JSON configuration file is based on the operating system and runtime environment:\n\n- Under Windows: `%APPDATA%\\docker-watchdog\\config.json`\n- Under macOS and Linux:\n - If running as a non-root user: `$HOME/.config/docker-watchdog/config.json`\n - If running as the root user: `/etc/docker-watchdog/config.json`\n\nThe available configuration settings are as follows:\n\n|JSON Key |Environment Variable |Default |Description |\n|-------------|---------------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------|\n|`sleep` |`DOCKER_WATCHDOG_SLEEP_INTERVAL` |60 |Specifies the interval (in seconds) to sleep for between sampling runs. |\n|`timeout` |`DOCKER_WATCHDOG_IDLE_TIMEOUT` |600 |Specifies the period of inactivity (in seconds) required to consider the system idle. |\n|`billing` |`DOCKER_WATCHDOG_BILLING_GRANULARITY` |0 |Specifies the billing granularity (in seconds) if the host is a cloud VM, or zero otherwise. |\n|`percentage` |`DOCKER_WATCHDOG_EFFECTIVE_PERCENTAGE` |0.9 |Specifies the minimum percentage (0.0 to 1.0) of the current billing unit that must have elapsed to consider a shutdown to be cost-effective. |\n\n\n## Legal\n\nCopyright © 2019, Adam Rehn. Licensed under the MIT License, see the file [LICENSE](https://github.com/adamrehn/docker-watchdog/blob/master/LICENSE) for details.\n\nDevelopment of this package was funded by [Deepdrive, Inc](https://deepdrive.io/).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/adamrehn/docker-watchdog", "keywords": "docker continuous-integration", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "docker-watchdog", "package_url": "https://pypi.org/project/docker-watchdog/", "platform": "", "project_url": "https://pypi.org/project/docker-watchdog/", "project_urls": { "Homepage": "http://github.com/adamrehn/docker-watchdog" }, "release_url": "https://pypi.org/project/docker-watchdog/0.0.5/", "requires_dist": [ "docker (>=3.0.0)", "humanfriendly", "requests", "setuptools (>=38.6.0)", "twine (>=1.11.0)", "uptime", "wheel (>=0.31.0)" ], "requires_python": ">=3.5", "summary": "Service to perform automatic shutdown of idle container hosts", "version": "0.0.5" }, "last_serial": 4774759, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4ee26f568f409cc7bcf10527162034b8", "sha256": "7120c06b5b86207bc53c469feee100db39fefdc12fc2615ac5cffb5009be12ef" }, "downloads": -1, "filename": "docker_watchdog-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4ee26f568f409cc7bcf10527162034b8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10813, "upload_time": "2019-02-03T05:25:48", "url": "https://files.pythonhosted.org/packages/fc/11/1d3cfc53dc37dbe38dd2d4f65d1bd78a13e947ca3a176068e5abcafa55a4/docker_watchdog-0.0.1-py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "0c1f02186c168fa0b0e133b8bcc2da2c", "sha256": "48262c4810ea89d4e29307257ff04a63ede862f0f5b42218245daa815a277428" }, "downloads": -1, "filename": "docker_watchdog-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0c1f02186c168fa0b0e133b8bcc2da2c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10814, "upload_time": "2019-02-03T06:03:40", "url": "https://files.pythonhosted.org/packages/09/6a/d48a1bd05624d6e1d42e61eedb5edad047a6e9c5c2d05a788563ee8ae907/docker_watchdog-0.0.2-py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "9b7622f0a3d6822589e0d5d503b4db28", "sha256": "620cea510aa66cc36d9298d3fa751e5854f065ae8dffc051a8041e323a951842" }, "downloads": -1, "filename": "docker_watchdog-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9b7622f0a3d6822589e0d5d503b4db28", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10817, "upload_time": "2019-02-03T06:13:54", "url": "https://files.pythonhosted.org/packages/14/63/8faf9f4e672123bcfeef4805279a4774a5977807ddd31316116c53f0f4e7/docker_watchdog-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "f44b6ec8c8860373234871228175e7df", "sha256": "3cd53d23c60e1651a13810bc2e87929fa99030b28666d74977138bfe972823f8" }, "downloads": -1, "filename": "docker_watchdog-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "f44b6ec8c8860373234871228175e7df", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10832, "upload_time": "2019-02-03T06:36:15", "url": "https://files.pythonhosted.org/packages/ac/8c/3c70f340c08ed19396d97a114d6c6db3a5e6670f819a0e774f88bdd6dc62/docker_watchdog-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "e9bf180570083c3e1b9a436d644552ec", "sha256": "1788603feb37d731bf1a020e0949cde4c36bc7c0443a79fa627dfff0eed0a62f" }, "downloads": -1, "filename": "docker_watchdog-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e9bf180570083c3e1b9a436d644552ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10847, "upload_time": "2019-02-03T14:00:50", "url": "https://files.pythonhosted.org/packages/ec/c3/81765d3ac2d55b31276c03be5dce84e6ab525ac062e30987d8dd948a89f5/docker_watchdog-0.0.5-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e9bf180570083c3e1b9a436d644552ec", "sha256": "1788603feb37d731bf1a020e0949cde4c36bc7c0443a79fa627dfff0eed0a62f" }, "downloads": -1, "filename": "docker_watchdog-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e9bf180570083c3e1b9a436d644552ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 10847, "upload_time": "2019-02-03T14:00:50", "url": "https://files.pythonhosted.org/packages/ec/c3/81765d3ac2d55b31276c03be5dce84e6ab525ac062e30987d8dd948a89f5/docker_watchdog-0.0.5-py3-none-any.whl" } ] }