Package: holdup
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 LicenseInstalllationCurrently holdup is only published to PyPI andhub.docker.com.To install from PyPI:pip install holdupIt 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.zipAlternate installation (Docker image)Example:docker run --rm ionelmc/holdup tcp://foobar:1234Note that this will have some limitations:executing thecommandis pretty pointless because holdup will run in its own containeryou’ll probably need extra network configuration to be able to access servicesyou won’t be able to usedocker runinside a container without exposing a docker daemon in said containerUsageusage: 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:serviceA 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 meanany that pass.commandAn optional command to exec.optional arguments:-h,--helpshow this help message and exit-tSECONDS,--timeoutSECONDSTime to wait for services to be ready. Default: 60.0-TSECONDS,--check-timeoutSECONDSTime to wait for a single check. Default: 1.0-iSECONDS,--intervalSECONDSHow often to check. Default: 0.2-v,--verboseVerbose mode.--verbose-passwordsDisable PostgreSQL/HTTP password masking.-n,--no-abortIgnore failed services. This makesholdupreturn 0 exit code regardless of services actually responding.--insecureDisable SSL Certificate verification for HTTPS services.--versiondisplay the version of the holdup package and its location, then exit.Example:holdup tcp://foobar:1234 -- django-admin ...Documentationhttps://python-holdup.readthedocs.io/DevelopmentTo run all the tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog4.0.0 (2023-02-14)Added support for psycopg 3 (now theholdup[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-passwordsto disable this feature).Overhauled checks display a bit, output might be slightly different.Added support for basic and digest HTTP authentication.Published Docker image athttps://hub.docker.com/r/ionelmc/holdup(Alpine based).1.9.0 (2021-01-11)Added a--versionargument.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 onconnect_timeout). The float is now converted to an integer.1.8.0 (2019-05-28)Added a PostgreSQL check. It handles thethe database system is starting upproblem.
Contributed by Dan Ailenei in6.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--insecureoption andhttps+insecureprotocol).
Contributed by Mithun Ayachit in2.1.6.0 (2018-03-22)Added verbose mode (-vor--verbose).Changed default timeout to 60s (from 5s).1.5.0 (2017-06-07)Added aneval://expressionprotocol 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--intervaloption 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.