Configuration of the REST Waiter can be done through the following environment variables:
- WAITER_ATTEMPTS (mandatory): Number of attempts the waiter will ping the service. If there is no succesful ping after that given number of attempts, it means that the service is expected to never be ready for the current context, so the process will exit with error code 1.
- WAITER_ATTEMPT_SLEEPTIME (mandatory): Amount of time the waiter will wait in seconds after an unsuccesful ping attempt. After that time, a new attempt will begin.
- WAITER_DEBUG (optional, default: false): If true, it will show in console the response of the ping command executed on attemps, otherwise it will be hidden.
- HTTP_URL (mandatory): URL of the shape
- HTTP_STATUS_CODE (mandatory): The expected HTTP STATUS CODE meaning that the resource behind the given HTTP URL is OK, typically 200.
$ docker run --name elasticsearch_server -d elasticsearch:1.5.2
$ docker run -it --rm --link elasticsearch_server:elasticsearch_server \
-e HTTP_URL=http://elasticsearch_server:9200/_cluster/health \
-e HTTP_STATUS_CODE=200 \
-e WAITER_DEBUG=false \
-e WAITER_ATTEMPTS=20 \
-e WAITER_ATTEMPT_SLEEPTIME=1 \
theypsilon/waiter-rest:0.1.21 && echo DONE!
[WAITER] WAITER_ATTEMPTS: 20 | WAITER_ATTEMPT_SLEEPTIME: 1
[WAITER] .. OK