This service is an API allowing for things that are managing deployments to write data and things representing the data to query it.
Data is written from multiple sources (e.g. Lambdas, ECS, EKS, EC2) so this exposes a uniform API for these sources to store the data.
You'll need the following tools
- Terraform
- Docker
- Go
To install these on OSX run brew install hashicorp/tap/terraform golang docker
Running make dev_env
will setup a local DynamoDB and configure it with Terraform
Running make data_generation
will generate some data into the local DynamoDB
Running make run_all_docker_compose
will run the API in Docker, however it can also be run locally with make run_api_local
Running make reset_dev_env
will reset all the data in DynamoDB
- NoSQL Workbench for viewing data, you can follow these instructions to get set up. Use
localhost:4566
for the host, the region and credentials can be any value as this is using localstack.
- Component is a unique name for a service within an environment, it is always lower case alpha-numeric characters that may contain hyphens and full stops. e.g.
abc.def
,ab-123
, and123-def.xyz
- Environment is a string that matches
^[a-z]+(-[a-z]+){0,2}$
- Deployable is a unique combination of component & environment
curl -d '{"Records":[{"Component":"abc.def","Environment":"prod-all","State":"Ok","Timestamp":"2024-07-30T14:06:41+00:00"}]}' localhost:8080/records
curl localhost:8080/historical/abc.def | jq
{
"Records": [
{
"Component": "abc.def",
"Environment": "prod-all",
"Timestamp": "2024-07-30T15:06:41+01:00",
"State": "Ok"
}
]
}
This endpoint returns the latest status for each deployable
curl localhost:8080/current | jq
{
"Records": [
{
"Component": "abc.def",
"Environment": "prod-all",
"Timestamp": "2024-07-30T15:06:41+01:00",
"State": "Ok"
}
]
}
Imagine you are working on an engineering team and someone has put this code up for a PR for you to review.
Your task is the following;
- Fork this repository in GitHub
- Create a PR with comments detailing
- The mistakes that you find
- Corrections you'd suggest or a rough description of what the change should be
- The reasoning behind the change
- The things that can't be changed are
- The body returned in normal operation by the external API defined by the API codebase must not change
- The data must be stored in DynamoDB, however the underlying format may be changed
If something isn't clear please do let us know so we can help clarify any issues.