diff --git a/services/logging/Makefile b/services/logging/Makefile index 3ce840440..504fdb5eb 100644 --- a/services/logging/Makefile +++ b/services/logging/Makefile @@ -7,11 +7,24 @@ STACK_NAME = $(notdir $(shell pwd)) TEMP_COMPOSE=.stack.${STACK_NAME}.yaml REPO_BASE_DIR := $(shell git rev-parse --show-toplevel) +define create-s3-bucket + # ensure bucket is available in S3... + set -o allexport; \ + source .env; \ + echo Creating bucket "$${S3_BUCKET_NAME_LOKI}";\ + export S3_ACCESS_KEY=$${S3_ACCESS_KEY_LOKI}; \ + export S3_SECRET_KEY=$${S3_SECRET_KEY_LOKI}; \ + export STORAGE_DOMAIN=$${STORAGE_DOMAIN}; \ + ${REPO_BASE_DIR}/scripts/create-s3-bucket.bash "$${S3_BUCKET_NAME_LOKI}" && \ + set +o allexport; \ + # bucket is available in S3 +endef + # TARGETS -------------------------------------------------- include ${REPO_BASE_DIR}/scripts/common.Makefile .PHONY: up -up: .init .env ${TEMP_COMPOSE} ## Deploys graylog stack +up: .init .env ${TEMP_COMPOSE} ## Deploys logging stack @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} ${STACK_NAME} $(MAKE) configure @@ -43,6 +56,7 @@ up-master: .init .env ${TEMP_COMPOSE}-master .PHONY: up-local ## Deploys graylog stack for local deployment up-local: .init .env ${TEMP_COMPOSE}-local ## Deploys graylog stack for local cluster + @$(create-s3-bucket) @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE}-local ${STACK_NAME} $(MAKE) configure diff --git a/services/logging/template.env b/services/logging/template.env index d660de18a..84d8cd522 100644 --- a/services/logging/template.env +++ b/services/logging/template.env @@ -23,3 +23,4 @@ S3_BUCKET_NAME_LOKI=${S3_BUCKET_NAME_LOKI} S3_FORCE_PATH_STYLE_LOKI=${S3_FORCE_PATH_STYLE_LOKI} S3_REGION_LOKI=${S3_REGION_LOKI} S3_SECRET_KEY_LOKI=${S3_SECRET_KEY_LOKI} +STORAGE_DOMAIN=${STORAGE_DOMAIN}