Write first draft of await post

parent 25b43191
Pipeline #6268416 failed with stage
title: "Introducing await"
layout: post
author: ahawkins
type: BlogPosting
description: >
Introducing the await CLI primarily designed for Kubernetes init
- Kubernetes
- Docker
- Containers
- helm
I'm leading a migration to [Kubernetes][] at my fulltime job at
Saltside. Our goal is to package up our SoA application as a [helm][]
chart and deploy it that way. This posed a few initial problems. The
biggest problem is that some services depends on other services.
Service A may depend on service B to start. Databases are the second
problem. Services cannot start if they cannot connect to their
datastores. These problems occour because Kubernetes pods are started
in any order. We can easily solve this problem with Kubernetes [init
contianers][]--specifically awaiting for dependencies to start.
We've open source our [await][source] CLI. The `await` command is primarily
designed for Kubernetes init containers, but there are probably other
uses cases where it could be useful. We created `await` because we
wanted something that:
* Retried connections repeatedly until a timeout was reached
* Supported all our datastores / service types
* Provided a uniform UX.
There didn't seem to be any existing FOSS so we created our own. The
result is a simple shell script built on Alpine Linux. The resulting
Docker image is small which speeds up Pod creation.
`await` supports the following checks:
* **Redis**: runs `redis-cli ping`
* **MongoDB**: runs `showDBs()`
* **HTTP Servers**: runs `curl`
* **Memcached**: runs `INFO`
* **DynamodB**: runs `aws dynamodb list-tables` (useful when using
[Local DynamoDB][])
* **MySQL**: runs `show tables;`
Here are some exmples:
# wait for an HTTP server
await http http://example.com
# wait for an HTTP server for 2 minutes (default: 60 seconds)
await -r 120 http://example.com
# wait for an HTTP server with extra curl options
await http://example.com -- -H 'Special-Header: Foo'
# wait for a redis server
await redis -h my.server.com -p 2831
# wait for a redis server with extra options
await redis -h my.server.com -p 2831 -- -t 15
All `await` commands accept a `-r` for retries. The default is 60
attempts. Commands also accept the `-- [EXTRA_OPTS]` syntax to pass
arguments to the underlying call. This should provide users with
enough flexibity to set connection parameters for all their resources.
We're happy to take PRs to the [source][] on GitHub. Big thanks to
[Terje Larsen][] & [Sitesh Jalan][] for most of the work.
Good luck our there and happy shipping!
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment