Update await blog post

parent ab3a0645
Pipeline #6295469 failed with stage
......@@ -14,44 +14,47 @@ keywords:
- 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:
I'm leading a migration to [Kubernetes][k8s] at my fulltime job at
Saltside. Our goal is to deploy our SoA application as a [helm][]
chart. This posed a few initial problems. The biggest problem is that
services depend on other services (this is SoA after all). 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 pods are started in any order. We can
easily solve this problem with Kubernetes [init
containers][]--specifically awaiting for dependencies to start.
We've open sourced our [await][source] CLI to address these problems.
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.
result is a simple shell script with a mix of python built on Alpine
Linux. The resulting is a small Docker image. It shouldn't slow down
pod creation and is small enough to use a base image.
`await` supports the following checks:
* **HTTP Servers**: runs `curl`
* **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][])
* **Local DynamodB**: `ListTables` against a local [Local DynamoDB][]
* **MySQL**: runs `show tables;`
* Arbitrary commands
Here are some exmples:
`await` uses URIS to determine the check
method. Each protocol in the URI maps to a check function. Here are
some examples:
```
# wait for an HTTP server
await http http://example.com
await http://example.com
# wait for an HTTP server for 2 minutes (default: 60 seconds)
await -r 120 http://example.com
......@@ -60,18 +63,29 @@ await -r 120 http://example.com
await http://example.com -- -H 'Special-Header: Foo'
# wait for a redis server
await redis -h my.server.com -p 2831
await redis://redis.mycompany.com
# wait for a redis server with extra options
await redis -h my.server.com -p 2831 -- -t 15
# wait for EC2 access
await cmd -- aws ec2 describe-instances
```
You can pull from `saltside/await` on [docker hub][].
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.
[Terje Larsen][terlar] & [Sitesh Jalan][sjalan] for most of the work.
Good luck our there and happy shipping!
[k8s]: http://kubernetes.io
[helm]: https://helm.sh
[source]: https://github.com/saltside/await
[terlar]: https://github.com/terlar
[sjalan]: https://github.com/sjalan
[local dynamodb]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
[docker hub]: https://hub.docker.com/saltside/await
[init containers]: https://kubernetes.io/docs/user-guide/pods/init-container/
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