wait-for-service
Waits for a dependency before continuing. It's meant to be used in startup scripts like Docker's entrypoint. This project is forked from http://github.com/wlatanowicz/wait-for-service
Installing
pip install wait-for-service
Usage
wait-for-service dependency-url-1 dependency-url-2 ... dependency-url-n
ie:
wait-for-service https://my-server/healthz/ psql://user@db-host/db-name
Available checks
HTTP(s)
HTTP and HTTPS are available by default. Follows redirects; only response with HTTP code 2XX is accepted as valid.
Accepted URL schemas
- http://
- https://
Example
wait-for-service https://my-server/healthz/ http://my-server/healthz/
PostgreSQL
RDBMS has to accept connection and allow to perform simple SELECT query.
Installation
pip install wait-for-service[postgres]
Accepted URL schemas
- postgres://
- postgresql://
- psql://
Example
wait-for-service psql://admin:password@db-host/db_name
MySQL
RDBMS has to accept connection and allow to perform simple SELECT query.
Installation
pip install wait-for-service[mysql]
Accepted URL schemas
- mysql://
Example
wait-for-service mysql://admin:password@db-host/db_name
Redis
Rdis has to accept connection to selected database (defaults to 0).
Installation
pip install wait-for-service[redis]
Accepted URL schemas
- redis://
Example
wait-for-service redis://redis-host/5
Memcached
Memcached has to accept connection.
Installation
pip install wait-for-service[memcached]
Accepted URL schemas
- memcached://
Example
wait-for-service memcached://memcached-host/
MongoDB
MongoDB has to accept connection.
Installation
pip install wait-for-service[mongodb]
Accepted URL schemas
- mongodb://
Example
wait-for-service mongodb://admin:password@db-host/db_name
RabbitMQ
RabbitMQ has to accept connection to given vhost. You can use optional querystring params require_queue and require_exchange to additionaly check if particular queue or exchange exists (check will fail otherwise).
Installation
pip install wait-for-service[amqp]
Accepted URL schemas
- amqp://
Example
wait-for-service amqp://admin:password@rabbit-host/vhost
wait-for-service amqp://admin:password@rabbit-host/vhost?require_queue=myqueue
wait-for-service amqp://admin:password@rabbit-host/vhost?require_exchange=myexchange
wait-for-service amqp://admin:password@rabbit-host/vhost?require_exchange=myexchange&require_exchange=mysecondexchange&require_queue=myqueue&require_queue=mysecondqueue
Apache Kafka
Kafka has to accept connection. In HA mode (node count > 1) only one node is required to accept the connection.
Installation
pip install wait-for-service[kafka]
Accepted URL schemas
If port is not specified 9092 will be assumed, topic is optional but recommended
- kafka://bootstrap-host
- kafka://bootstrap-host:9092
- kafka://bootstrap-host,bootstrap-host2:9092
- kafka://bootstrap-host/topic
- kafka://bootstrap-host:9092/topic
- kafka://bootstrap-host,bootstrap-host2:9092/topic
Example
wait-for-service kafka://kafka-host/
wait-for-service kafka://kafka-first-host/,kafka://kafka-second-host/
TCP
Plain TCP is available by default. Service port is required.
Accepted URL schemas
- tcp://
Example
wait-for-service tcp://my-server:7624
Unix
Unix sockets are available by default.
Accepted URL schemas
- unix://
Example
wait-for-service unix:///var/run/docker.sock
Metadata
Release files for wait-for-service 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| wait_for_service-1.2.1.tar.gz | 6.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wait_for_service-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.5 kB
Release files / wait_for_service-1.2.1.tar.gz
| Download URL | wait_for_service-1.2.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2028aa23b2603a9cbe3ce3c997beb2da0516a020f415063367d4996574abc98
|
|
BLAKE2b-256 checksum How to use checksums |
b46c142265854bfbc166172290ae9e37caeebb2011904985207ce69a2cd31a2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / wait_for_service-1.2.1-py3-none-any.whl
| Download URL | wait_for_service-1.2.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59091f0054225cecd0568aec172dedcd95b623b193da2939c9b3d64208b78827
|
|
BLAKE2b-256 checksum How to use checksums |
ddd67e894e043003594d285ae8ff45b1279d3df8899a7a77392cdfda7015425f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for wait-for-service 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.