1.1.4 • Published 5 years ago

wait-for-blah v1.1.4

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

wait-for-blah

An elegant utility that waits for docker containers to be ready by monitoring their stdout

An example

This utility was inspired but this real life situation:

You're waiting for a stub service (kafka) to be ready (create topics). Unfortunately existing libraries such as the excellent dadarek/wait-for-dependencies report ready when the service starts listening via TCP on a port not when the topic is created. For some people this is premature.

How it works

version: "3"
services:
  zookeeper:
    image: wurstmeister/zookeeper
    expose:
      - "2181"
    depends_on:
      - kafka
  kafka:
    image: wurstmeister/kafka:2.11-1.1.1
    exposr:
      - "9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: kafka
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_CREATE_TOPICS: custom-topic-1:1:1,custom-topic-2:1:1
  mongo:
    image: mongo
  tests:
    build: ./tests
    links:
      - kafka
      - stub
import wfb from 'wait-for-blah'

const waitForKafka = () => wfb('kafka', /Created log for partition/)
const waitForMongo = () => wfb('mongo', [/waiting for connections/])

(async () => {
  await waitForKafka()
  await waitForMongo()
  await wfb('tests')
})()
1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago