From fbae58f66499b9d5213db23f6bc9779fd615fd2f Mon Sep 17 00:00:00 2001 From: ltagliamonte Date: Mon, 20 Jun 2022 11:37:11 -0700 Subject: [PATCH] add Makefile to build and push to ECR --- Makefile | 15 +++++++++++++++ README.md | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b590695 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +.PHONY: all +all: ecr-login build push + +SHA := $(shell git rev-parse HEAD) +DOCKER_IMAGE_NAME := prometheus-gravel-gateway + +ecr-login: + aws ecr get-login-password --profile $(AWS_PROFILE) --region $(AWS_REGION) | docker login --username AWS --password-stdin $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com + +build: + docker build -t $(DOCKER_IMAGE_NAME):$(SHA) . + +push: + docker push $(DOCKER_IMAGE_NAME):$(SHA) + diff --git a/README.md b/README.md index faccb21..ed2cffb 100644 --- a/README.md +++ b/README.md @@ -188,3 +188,14 @@ ship with them. In particular, there was three semantics I was trying to drive: 3. Info values - Things like the build information. When a new labelset comes along for these metrics, I want to be able to replace all the old labelsets, e.g. upgrading from `{version="0.1"}` to `{version="0.2"}` should replace the `{version="0.1"}` labelset Existing gateways, like the [prom-aggregation-gateway](https://github.com/weaveworks/prom-aggregation-gateway), or [pushgateway](https://github.com/prometheus/pushgateway) are all or nothing in regards to aggregation - the pushgateway does not aggregate at all, completly replacing values as they come in. The aggregation gateway is the opposite here - it aggregates everything. What I wanted was something that allows more flexibility in how metrics are aggregated. To that end, I wrote the Gravel Gateway + +## How to publish a new image in ECR +``` +export AWS_PROFILE= +export AWS_ACCOUNT_ID= +export AWS_REGION= +export DOCKER_IMAGE_NAME=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/prometheus-gravel-gateway +make ecr-login +make build DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} +make push DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME} +```