⏳ A tiny application that waits for a set of services to become available before exiting clean. Ideal for init containers.
Waiter is a tiny application that will wait for a set of services to become available and then exit cleanly when they are all available. This is ideal for with init-containers in Kubernetes so your application will only start when all its service dependencies are available.
It supports the following services:
This is most useful when used as an init container within a Kubernetes pod. You can add individual init containers for each service or configure multiple services within the same container to reduce (the small) overhead in starting individual containers.
initContainers:
- name: waiter
image: ghcr.io/adamcooke/waiter:v1
env:
- name: SERVICES
value: mysql
- name: MYSQL_HOST
value: mysql.default.svc.cluster.local
- name: MYSQL_USERNAME
value: root
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-credentials
key: password
- name: MYSQL_DATABASE
value: my_database
Alternatively, you can use this directly within Docker if you wish.
docker run --rm -e SERVICES=mysql -e MYSQL_HOST=mysql -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=my_database ghcr.io/adamcooke/waiter:v1
All configuration is provided through environment variables. The following variables are available:
SERVICES
- an array of service types (seperated by commas) to wait for (options: mysql
, redis
)INTERVAL
- the length of time to wait between checks in seconds (default: 2
)MYSQL_HOST
- the hostname or IP of a MySQLMYSQL_PORT
- the MySQL port (default: 3306)MYSQL_USERNAME
- the MySQL username (default: root)MYSQL_PASSWORD
- the MySQL passwordMYSQL_DATABASE
- the MySQL database to check presence ofMYSQL_TABLE
- the MySQL table (within above database) to check presence ofREDIS_HOST
- the hostname or IP of a RedisREDIS_PORT
- the Redis port (default 6379)REDIS_PASSWORD
- the Redis server password