Skip to content

arcanjoaq/wait-for

Repository files navigation

wait-for

Wait-for is a binary used to wait for a resource (like a database or a message broker) to be available. It supports PostgreSQL, MySQL, MongoDB databases and RabbitMQ message broker.

Installing

Here is an example of wait-for installation in a Dockerfile:

ENV WAIT_FOR_VERSION=v0.0.4
RUN wget "https://github.com/arcanjoaq/wait-for/releases/download/${WAIT_FOR_VERSION}/wait-for" && chmod u+x wait-for

Usage

Basically, the option --type determines the target resource. Here are some examples of wait-for:

MySQL

./wait-for --type mysql \
           --host localhost \
           --port 3306 \
           --user root \
           --password mysql \
           --name mysql \
           --maxAttempts 100

PostgreSQL

./wait-for --type postgres \
           --host localhost \
           --port 5432 \
           --user test \
           --password test \
           --name test \
           --maxAttempts 100

MongoDB

./wait-for --type mongodb \
           --host localhost \
           --port 27017 \
           --user test \
           --password test \
           --name test \
           --maxAttempts 100

RabbitMQ

./wait-for --type rabbitmq \
           --host localhost \
           --port 5672 \
           --user test \
           --password test \
           --name '/' \
           --maxAttempts 100

Options

--type: Set resource type.

--host: Set target host. The default value is "localhost".

--port: Set resource port. The default value depends on resource type.

--user: Set resource user.

--password: Set resource password.

--name: Se resource name. It is database name or virtual host name.

--seconds: Set number of seconds to wait for a resource. The default value is "10".

--maxAttempts: Set max attempts quantity. The default value is "3".

Linting

make lint

Building

make build

Licensing

Apache 2.0

About

Binary to wait for resources like databases and message brokers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •