waitforit

command module
v2.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 12 Imported by: 0

README

wait for it

Build Status Coverage Status

Wait until an address become available.

Download

Releases

Options
  • -address: Address (e.g. http://google.com or tcp://mysql_ip:mysql_port) - former full-connection
  • -host: Host to connect
  • -port: Port to connect (default 80)
  • -timeout: Seconds to wait until the address become available
  • -retry: Milliseconds to wait between retries (default 500)
  • -debug: Enable debug
  • -v: Show the current version
  • -file: Path to the JSON file with the configs
  • -- : Execute a post command once the address became available
Example
Running
waitforit -host=google.com -port=90 -timeout=20 -debug

waitforit -address=tcp://google.com:90 -timeout=20 -debug

waitforit -address=http://google.com -timeout=20 -debug

waitforit -address=http://google.com:90 -timeout=20 -retry=500 -debug

waitforit -address=http://google.com -timeout=20 -debug -- printf "Google Works\!"
Using with config file

Create a JSON file describing the hosts you would like to wait for.

Example JSON:

{
  "configs": [
    {
      "host": "google.com",
      "port": 80,
      "timeout": 20,
      "retry": 500
    },
    {
      "address": "http://google.com:80",
      "timeout": 40
    }
  ]
}
waitforit -file=./config.json
Installing with a Dockerfile
Using curl
FROM node:6.5.0

ENV WAITFORIT_VERSION="v1.3.1"
RUN curl -o /usr/local/bin/waitforit -sSL https://github.com/maxcnunes/waitforit/releases/download/$WAITFORIT_VERSION/waitforit-linux_amd64 && \
    chmod +x /usr/local/bin/waitforit
Using wget
FROM node:6.5.0

ENV WAITFORIT_VERSION="v1.3.1"
RUN wget -q -O /usr/local/bin/waitforit https://github.com/maxcnunes/waitforit/releases/download/$WAITFORIT_VERSION/waitforit-linux_amd64 \
    && chmod +x /usr/local/bin/waitforit
Using COPY (from local file system)
FROM node:6.5.0

COPY waitforit-linux_amd64 /usr/local/bin/waitforit
RUN chmod +x /usr/local/bin/waitforit

Development

make run

Running with Docker and Compose:

docker-compose run --rm local
docker-compose run --rm local go run src/waitforit/main.go -h

Test

make test

Build

make build

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL