Waits for a dependency before continuing. It's ment to be used in startup scripts like Docker's entrypoint.
pip install wait-for-dep
wait-for-dep dependency-url-1 dependency-url-2 ... dependency-url-n
ie:
wait-for-dep https://my-server/healthz/ psql://user@db-host/db-name
HTTP and HTTPS are available by default. Follows redirects; only response with HTTP code 2XX is accepted as valid.
- http://
- https://
wait-for-dep https://my-server/healthz/ http://my-server/healthz/
RDBMS has to accept connection and allow to perform simple SELECT query.
pip install wait-for-dep[postgres]
- postgres://
- postgresql://
- psql://
wait-for-dep psql://admin:password@db-host/db_name
RDBMS has to accept connection and allow to perform simple SELECT query.
pip install wait-for-dep[mysql]
- mysql://
wait-for-dep mysql://admin:password@db-host/db_name
Rdis has to accept connection to selected database (defaults to 0).
pip install wait-for-dep[redis]
- redis://
wait-for-dep redis://redis-host/5
Memcached has to accept connection.
pip install wait-for-dep[memcached]
- memcached://
wait-for-dep memcached://memcached-host/
MongoDB has to accept connection.
pip install wait-for-dep[mongodb]
- mongodb://
wait-for-dep mongodb://admin:password@db-host/db_name
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).
pip install wait-for-dep[amqp]
- amqp://
wait-for-dep amqp://admin:password@rabbit-host/vhost
wait-for-dep amqp://admin:password@rabbit-host/vhost?require_queue=myqueue
wait-for-dep amqp://admin:password@rabbit-host/vhost?require_exchange=myexchange
wait-for-dep amqp://admin:password@rabbit-host/vhost?require_exchange=myexchange&require_exchange=mysecondexchange&require_queue=myqueue&require_queue=mysecondqueue
Kafka has to accept connection. In HA mode (node count > 1) only one node is required to accept the connection.
pip install wait-for-dep[kafka]
- kafka://
wait-for-dep kafka://kafka-host/
wait-for-dep kafka://kafka-first-host/,kafka://kafka-second-host/
Plain TCP is available by default. Service port is required.
- tcp://
wait-for-dep tcp://my-server:7624
Unix sockets are available by default.
- unix://
wait-for-dep unix:///var/run/docker.sock