Metadata-Version: 2.1
Name: holdup
Version: 1.8.1
Summary: A tool to wait for services and execute command. Useful for Docker containers that depend on slow to start services (like almost everything).
Home-page: https://github.com/ionelmc/python-holdup
Author: Ionel Cristian Mărieș
Author-email: contact@ionelmc.ro
License: BSD-2-Clause
Project-URL: Documentation, https://python-holdup.readthedocs.io/
Project-URL: Changelog, https://python-holdup.readthedocs.io/en/latest/changelog.html
Project-URL: Issue Tracker, https://github.com/ionelmc/python-holdup/issues
Description: ========
        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
        ============
        
        ::
        
            pip install holdup
        
        Documentation
        =============
        
        Usage: ``holdup [-h] [-t SECONDS] [-T SECONDS] [-i SECONDS] [-n] [--insecure] 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",
            "http://urn", "http://urn", "https+insecure//urn" (status 200 expected). 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
          -n, --no-abort        Ignore failed services. This makes `holdup` return 0
                                exit code regardless of services actually responding.
          --insecure            Skip SSL Certificate verification for HTTPS services.
        
        Suggested use
        -------------
        
        Assuming you always want the container to wait add this in your ``Dockerfile``::
        
            COPY entrypoint.sh /
            ENTRYPOINT ["/entrypoint.sh"]
            CMD ["/bin/bash"]
        
        Then in ``entrypoint.sh`` you could have::
        
            #!/bin/sh
            set -eux
            urlstrip() { string=${@##*://}; echo ${string%%[\?/]*}; }
            exec holdup \
                 "tcp://$DJANGO_DATABASE_HOST:$DJANGO_DATABASE_PORT" \
                 "tcp://$(urlstrip $CELERY_RESULT_BACKEND)" \
                 -- "$@"
        
        The only disadvantage is that you might occasionally need to use ``docker run --entrypoint=''`` to avoid running holdup. No biggie.
        
        Insecure HTTPS Service Checks
        -------------------------------
        
        You may choose to skip SSL validation when waiting for an HTTPS service (for e.g., when using an IP Address). This can be done using either of the following methods::
        
            # Specifying a https+insecure protocol
            holdup https+insecure://10.1.2.3/
        
            # Specifying the --insecure` option
            holdup --insecure https://10.1.2.3/
        
        Skipping SSL Certificate verification requires a minimum of Python-2.7.9 or Python-3.4.3.
        
        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
        =========
        
        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 <https://github.com/ionelmc/python-holdup/pull/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 <https://github.com/ionelmc/python-holdup/pull/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.
        
Keywords: wait,port,service,docker,unix,domain,socket,tcpwaiter,holdup,hold-up
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Utilities
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
Provides-Extra: pg
