========
Overview
========
A tool to wait for services and execute command. Useful for Docker containers that depend on slow to start services
(like almost everything).
* Free software: BSD 2-Clause License
Installation
============
Currently holdup is only published to PyPI and `hub.docker.com <https://hub.docker.com/r/ionelmc/holdup>`_.
To install from PyPI::
pip install holdup
It has no dependencies except the optional PostgreSQL check support, which you'd install with::
pip install 'holdup[pg]'
You can also install the in-development version with::
pip install https://github.com/ionelmc/python-holdup/archive/master.zip
Alternate installation (Docker image)
-------------------------------------
Example::
docker run --rm ionelmc/holdup tcp://foobar:1234
Note that this will have some limitations:
* executing the ``command`` is pretty pointless because holdup will run in its own container
* you'll probably need extra network configuration to be able to access services
* you won't be able to use `docker run` inside a container without exposing a docker daemon in said container
Usage
=====
usage: holdup [-h] [-t SECONDS] [-T SECONDS] [-i SECONDS] [-n] service [service ...] [-- command [arg [arg ...]]]
Wait for services to be ready and optionally exec command.
positional arguments:
service
A service to wait for. Supported protocols: "tcp://host:port/", "path:///path/to/something", "unix:///path/to/domain.sock", "eval://expr", "pg://user:password@host:port/dbname" ("postgres" and "postgresql" also allowed), "http://urn", "https://urn", "https+insecure://urn" (status 200 expected for http*). Join protocols with a comma to make holdup exit at the first passing one, eg: "tcp://host:1,host:2" or "tcp://host:1,tcp://host:2" are equivalent and mean `any that pass`.
command
An optional command to exec.
optional arguments:
-h, --help show this help message and exit
-t SECONDS, --timeout SECONDS
Time to wait for services to be ready. Default: 60.0
-T SECONDS, --check-timeout SECONDS
Time to wait for a single check. Default: 1.0
-i SECONDS, --interval SECONDS
How often to check. Default: 0.2
-v, --verbose Verbose mode.
--verbose-passwords Disable PostgreSQL/HTTP password masking.
-n, --no-abort Ignore failed services. This makes `holdup` return 0 exit code regardless of services actually responding.
--insecure Disable SSL Certificate verification for HTTPS services.
--version display the version of the holdup package and its location, then exit.
Example::
holdup tcp://foobar:1234 -- django-admin ...
Documentation
=============
https://python-holdup.readthedocs.io/
Development
===========
To run all the tests run::
tox
Note, to combine the coverage data from all the tox environments run:
.. list-table::
:widths: 10 90
:stub-columns: 1
- - Windows
- ::
set PYTEST_ADDOPTS=--cov-append
tox
- - Other
- ::
PYTEST_ADDOPTS=--cov-append tox
Changelog
=========
5.1.1 (2024-05-21)
------------------
* Do not display an authentication mask for http protocols if there are no actual credentials specified.
5.1.0 (2024-04-12)
------------------
* Fixed buggy handling when http checks are specified with a port.
* Changed User-Agent header and stripped port from Host header for http checks.
* Refactored a bunch of code into a separate ``holdup.checks`` module.
5.0.0 (2024-04-11)
------------------
* Added a static binary in the Github release (built with Pyinstaller on Alpine, as a static bin).
* Dropped support for Python 3.7 and added in Python 3.12 in the test suite.
4.0.0 (2023-02-14)
------------------
* Added support for psycopg 3 (now the ``holdup[pg]`` extra will require that). The old psycopg2 is still supported for now.
* Dropped support for Python 3.6 and added in Python 3.11 in the test suite.
3.0.0 (2022-03-20)
------------------
* Dropped support for Python 2.
* Switched CI from Travis to GitHub Actions.
* Fixed bugs with password masking (it wasn't working for postgresql URIs).
2.0.0 (2021-04-08)
------------------
* Added support for password masking (``--verbose-passwords`` to disable this feature).
* Overhauled checks display a bit, output might be slightly different.
* Added support for basic and digest HTTP authentication.
* Published Docker image at https://hub.docker.com/r/ionelmc/holdup (Alpine based).
1.9.0 (2021-01-11)
------------------
* Added a ``--version`` argument.
* Changed verbose output to mask passwords in postgresql checks.
1.8.1 (2020-12-16)
------------------
* Add support for PostgreSQL 12+ clients (strict integer type-checking on ``connect_timeout``). The float is now converted to an integer.
1.8.0 (2019-05-28)
------------------
* Added a PostgreSQL check. It handles the ``the database system is starting up`` problem.
Contributed by Dan Ailenei in ``6``.
* Changed output so it's more clear and more brief:
* arguments (checks) are quoted when printed,
* "any" checks give exact info about what made it pass,
* repetitive information is removed.
* Simplified the internals for the "AnyCheck".
1.7.0 (2018-11-24)
------------------
* Added support for skipping SSL certificate verification for HTTPS services
(the ``--insecure`` option and ``https+insecure`` protocol).
Contributed by Mithun Ayachit in ``2``.
1.6.0 (2018-03-22)
------------------
* Added verbose mode (`-v` or ``--verbose``).
* Changed default timeout to 60s (from 5s).
1.5.0 (2017-06-07)
------------------
* Added an ``eval://expression`` protocol for weird user-defined checks.
1.4.0 (2017-03-27)
------------------
* Added support for HTTP(S) check.
1.3.0 (2017-02-21)
------------------
* Add support for "any" service check (service syntax with comma).
1.2.1 (2016-06-17)
------------------
* Handle situation where internal operations would take more than planned.
1.2.0 (2016-05-25)
------------------
* Added a file check.
1.1.0 (2016-05-06)
------------------
* Removed debug print.
* Added ``--interval`` option for how often to check. No more spinloops.
1.0.0 (2016-04-22)
------------------
* Improved tests.
* Always log to stderr.
0.1.0 (2016-04-21)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/ionelmc/python-holdup",
"name": "holdup",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "wait, port, service, docker, unix, domain, socket, tcp, waiter, holdup, hold-up",
"author": "Ionel Cristian M\u0103rie\u0219",
"author_email": "contact@ionelmc.ro",
"download_url": "https://files.pythonhosted.org/packages/f4/fb/cbf09e6f2d68291dc3bb7508190affb8586f85757a2c0026b3f553017861/holdup-5.1.1.tar.gz",
"platform": null,
"description": "========\nOverview\n========\n\n\n\nA tool to wait for services and execute command. Useful for Docker containers that depend on slow to start services\n(like almost everything).\n\n* Free software: BSD 2-Clause License\n\nInstallation\n============\n\nCurrently holdup is only published to PyPI and `hub.docker.com <https://hub.docker.com/r/ionelmc/holdup>`_.\n\nTo install from PyPI::\n\n pip install holdup\n\nIt has no dependencies except the optional PostgreSQL check support, which you'd install with::\n\n pip install 'holdup[pg]'\n\nYou can also install the in-development version with::\n\n pip install https://github.com/ionelmc/python-holdup/archive/master.zip\n\nAlternate installation (Docker image)\n-------------------------------------\n\nExample::\n\n docker run --rm ionelmc/holdup tcp://foobar:1234\n\nNote that this will have some limitations:\n\n* executing the ``command`` is pretty pointless because holdup will run in its own container\n* you'll probably need extra network configuration to be able to access services\n* you won't be able to use `docker run` inside a container without exposing a docker daemon in said container\n\n\nUsage\n=====\n\nusage: holdup [-h] [-t SECONDS] [-T SECONDS] [-i SECONDS] [-n] service [service ...] [-- command [arg [arg ...]]]\n\nWait for services to be ready and optionally exec command.\n\npositional arguments:\n service\n A service to wait for. Supported protocols: \"tcp://host:port/\", \"path:///path/to/something\", \"unix:///path/to/domain.sock\", \"eval://expr\", \"pg://user:password@host:port/dbname\" (\"postgres\" and \"postgresql\" also allowed), \"http://urn\", \"https://urn\", \"https+insecure://urn\" (status 200 expected for http*). Join protocols with a comma to make holdup exit at the first passing one, eg: \"tcp://host:1,host:2\" or \"tcp://host:1,tcp://host:2\" are equivalent and mean `any that pass`.\n command\n An optional command to exec.\n\noptional arguments:\n -h, --help show this help message and exit\n -t SECONDS, --timeout SECONDS\n Time to wait for services to be ready. Default: 60.0\n -T SECONDS, --check-timeout SECONDS\n Time to wait for a single check. Default: 1.0\n -i SECONDS, --interval SECONDS\n How often to check. Default: 0.2\n -v, --verbose Verbose mode.\n --verbose-passwords Disable PostgreSQL/HTTP password masking.\n -n, --no-abort Ignore failed services. This makes `holdup` return 0 exit code regardless of services actually responding.\n --insecure Disable SSL Certificate verification for HTTPS services.\n --version display the version of the holdup package and its location, then exit.\n\nExample::\n\n holdup tcp://foobar:1234 -- django-admin ...\n\nDocumentation\n=============\n\nhttps://python-holdup.readthedocs.io/\n\nDevelopment\n===========\n\nTo run all the tests run::\n\n tox\n\nNote, to combine the coverage data from all the tox environments run:\n\n.. list-table::\n :widths: 10 90\n :stub-columns: 1\n\n - - Windows\n - ::\n\n set PYTEST_ADDOPTS=--cov-append\n tox\n\n - - Other\n - ::\n\n PYTEST_ADDOPTS=--cov-append tox\n\n\nChangelog\n=========\n\n5.1.1 (2024-05-21)\n------------------\n\n* Do not display an authentication mask for http protocols if there are no actual credentials specified.\n\n5.1.0 (2024-04-12)\n------------------\n\n* Fixed buggy handling when http checks are specified with a port.\n* Changed User-Agent header and stripped port from Host header for http checks.\n* Refactored a bunch of code into a separate ``holdup.checks`` module.\n\n5.0.0 (2024-04-11)\n------------------\n\n* Added a static binary in the Github release (built with Pyinstaller on Alpine, as a static bin).\n* Dropped support for Python 3.7 and added in Python 3.12 in the test suite.\n\n4.0.0 (2023-02-14)\n------------------\n\n* Added support for psycopg 3 (now the ``holdup[pg]`` extra will require that). The old psycopg2 is still supported for now.\n* Dropped support for Python 3.6 and added in Python 3.11 in the test suite.\n\n3.0.0 (2022-03-20)\n------------------\n\n* Dropped support for Python 2.\n* Switched CI from Travis to GitHub Actions.\n* Fixed bugs with password masking (it wasn't working for postgresql URIs).\n\n2.0.0 (2021-04-08)\n------------------\n\n* Added support for password masking (``--verbose-passwords`` to disable this feature).\n* Overhauled checks display a bit, output might be slightly different.\n* Added support for basic and digest HTTP authentication.\n* Published Docker image at https://hub.docker.com/r/ionelmc/holdup (Alpine based).\n\n1.9.0 (2021-01-11)\n------------------\n\n* Added a ``--version`` argument.\n* Changed verbose output to mask passwords in postgresql checks.\n\n1.8.1 (2020-12-16)\n------------------\n\n* Add support for PostgreSQL 12+ clients (strict integer type-checking on ``connect_timeout``). The float is now converted to an integer.\n\n1.8.0 (2019-05-28)\n------------------\n\n* Added a PostgreSQL check. It handles the ``the database system is starting up`` problem.\n Contributed by Dan Ailenei in ``6``.\n* Changed output so it's more clear and more brief:\n\n * arguments (checks) are quoted when printed,\n * \"any\" checks give exact info about what made it pass,\n * repetitive information is removed.\n* Simplified the internals for the \"AnyCheck\".\n\n1.7.0 (2018-11-24)\n------------------\n\n* Added support for skipping SSL certificate verification for HTTPS services\n (the ``--insecure`` option and ``https+insecure`` protocol).\n Contributed by Mithun Ayachit in ``2``.\n\n1.6.0 (2018-03-22)\n------------------\n\n* Added verbose mode (`-v` or ``--verbose``).\n* Changed default timeout to 60s (from 5s).\n\n1.5.0 (2017-06-07)\n------------------\n\n* Added an ``eval://expression`` protocol for weird user-defined checks.\n\n1.4.0 (2017-03-27)\n------------------\n\n* Added support for HTTP(S) check.\n\n1.3.0 (2017-02-21)\n------------------\n\n* Add support for \"any\" service check (service syntax with comma).\n\n1.2.1 (2016-06-17)\n------------------\n\n* Handle situation where internal operations would take more than planned.\n\n1.2.0 (2016-05-25)\n------------------\n\n* Added a file check.\n\n1.1.0 (2016-05-06)\n------------------\n\n* Removed debug print.\n* Added ``--interval`` option for how often to check. No more spinloops.\n\n1.0.0 (2016-04-22)\n------------------\n\n* Improved tests.\n* Always log to stderr.\n\n0.1.0 (2016-04-21)\n------------------\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "A tool to wait for services and execute command. Useful for Docker containers that depend on slow to start services (like almost everything).",
"version": "5.1.1",
"project_urls": {
"Changelog": "https://python-holdup.readthedocs.io/en/latest/changelog.html",
"Documentation": "https://python-holdup.readthedocs.io/",
"Homepage": "https://github.com/ionelmc/python-holdup",
"Issue Tracker": "https://github.com/ionelmc/python-holdup/issues"
},
"split_keywords": [
"wait",
" port",
" service",
" docker",
" unix",
" domain",
" socket",
" tcp",
" waiter",
" holdup",
" hold-up"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "100cd6e2f8a51412ca039555639c415e3cefbeb850bed24899abccdbadfc9200",
"md5": "da000ed59a42398bb6e632af511cb55f",
"sha256": "3826fd9a9a88f311418c6f79cf12e69bc0f039706f4bde0fc9fd4b2dd8108b76"
},
"downloads": -1,
"filename": "holdup-5.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "da000ed59a42398bb6e632af511cb55f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11321,
"upload_time": "2024-05-22T00:25:23",
"upload_time_iso_8601": "2024-05-22T00:25:23.261361Z",
"url": "https://files.pythonhosted.org/packages/10/0c/d6e2f8a51412ca039555639c415e3cefbeb850bed24899abccdbadfc9200/holdup-5.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f4fbcbf09e6f2d68291dc3bb7508190affb8586f85757a2c0026b3f553017861",
"md5": "f9a32e292952d8e28f95d65cef7cb2b0",
"sha256": "244981e3546b4f9a1e04010eb73f52dbab0cc6dd2dcae0edbebcb71e2815b7eb"
},
"downloads": -1,
"filename": "holdup-5.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f9a32e292952d8e28f95d65cef7cb2b0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 28931,
"upload_time": "2024-05-22T00:25:25",
"upload_time_iso_8601": "2024-05-22T00:25:25.504853Z",
"url": "https://files.pythonhosted.org/packages/f4/fb/cbf09e6f2d68291dc3bb7508190affb8586f85757a2c0026b3f553017861/holdup-5.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-22 00:25:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ionelmc",
"github_project": "python-holdup",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "holdup"
}