Giter VIP home page Giter VIP logo

waitforit's Introduction

waitforit

waitforit is a command line utility and library for delaying a script until a requisite service is available.

For example, when using docker-compose, it is common that entrypoint scripts need to wait until the database container has started and been initialized.

Initializing a nodejs server container that depends on a Postrgres instance with a database called ghost:

#!/usr/bin/env sh
set -ex
waitforit -k -r 60 postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@db:5432/ghost
exec npm start --production

Usage

Usage:
    waitforit [options] <uri> [--exists=<item>]
    waitforit -h | --help | --version

Options:
    -h --help                Show this screen.
    -s, --silent             Silent
    -t, --timeout=<timeout>  Maximum time per attempt [default: 5s]
                             Valid time units are "ns", "us" (or "µs"), "ms",
                             "s", "m", "h"
    -r, --retry=<retry>      Number of times to retry after failure [default: 5]
                             Set to -1 to always retry
    --retry-delay=<delay>    Time to wait before retrying [default: 1s]
                             Valid time units are "ns", "us" (or "µs"), "ms",
                             "s", "m", "h"
    --exists=<item>          Wait for item to exist
                             For redis, this is waits for the key to exist
                             For DBs, this waits for the table to exist
    -k, --insecure           Disable SSL certificate validation
    --expand-env             Expand environmental variables in URI
    --version                Show version.

URI Examples:
    redis://127.0.0.1
    redis://[email protected]/7
    http://username:[email protected]:8080/hello
    mysql://scott:[email protected]/ghost
    postgres://ghost:[email protected]/ghost

Downloads

See https://github.com/kung-foo/waitforit/releases

waitforit's People

Contributors

kung-foo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.