Back

wait (clj)

(source)

multimethod

Sets a wait strategy to the container. Supports :http, :health and :log as strategies. ## HTTP Strategy The :http strategy will only accept the container as initialized if it can be accessed via HTTP. It accepts a path, a port, a vector of status codes, a boolean that specifies if TLS is enabled, a read timeout in seconds and a map with basic credentials, containing username and password. Only the path is required, all others are optional. Example: ```clojure (wait {:wait-strategy :http :port 80 :path "/" :status-codes [200 201] :tls true :read-timeout 5 :basic-credentials {:username "user" :password "password" :startup-timeout 60}} container) ``` ## Health Strategy The :health strategy enables support for Docker's healthcheck feature, whereby you can directly leverage the healthy state of your container as your wait condition. Example: ```clojure (wait {:wait-strategy :health :startup-timeout 60} container) ``` ## Log Strategy The :log strategy accepts a message which simply causes the output of your container's log to be used in determining if the container is ready or not. The output is `grepped` against the log message. Example: ```clojure (wait {:wait-strategy :log :message "accept connections" :startup-timeout 60} container) ``` ## Port Strategy The port strategy waits for the first of the mapped ports to be opened. It only accepts the startup-timeout value as a parameter. Example: ```clojure (wait {:wait-strategy :port :startup-timeout 60} container ```

Examples