-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (51 loc) · 2.75 KB
/
Copy pathMakefile
File metadata and controls
69 lines (51 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
VENV_BIN ?= python3 -m venv
VENV_DIR ?= .venv
PIP_CMD ?= pip3
STACK_NAME ?= DmsS3ToKinesisStack
BUCKET_NAME ?= source-bucket-s3-kinesis-dms
BUCKET_FOLDER ?= sourceData
CHANGE_DATA ?= changedata
ENDPOINT_URL = http://localhost.localstack.cloud:4566
export AWS_ACCESS_KEY_ID ?= test
export AWS_SECRET_ACCESS_KEY ?= test
export AWS_DEFAULT_REGION ?= us-east-1
VENV_RUN = . $(VENV_ACTIVATE)
CLOUD_ENV = STACK_NAME=$(STACK_NAME) BUCKET_NAME=$(BUCKET_NAME) BUCKET_FOLDER=$(BUCKET_FOLDER) CHANGE_DATA=$(CHANGE_DATA)
LOCAL_ENV = STACK_NAME=$(STACK_NAME) BUCKET_NAME=$(BUCKET_NAME) BUCKET_FOLDER=$(BUCKET_FOLDER) CHANGE_DATA=$(CHANGE_DATA) ENDPOINT_URL=$(ENDPOINT_URL)
ifeq ($(OS), Windows_NT)
VENV_ACTIVATE = $(VENV_DIR)/Scripts/activate
else
VENV_ACTIVATE = $(VENV_DIR)/bin/activate
endif
usage: ## Show this help
@grep -Fh "##" $(MAKEFILE_LIST) | grep -Fv fgrep | sed -e 's/:.*##\s*/##/g' | awk -F'##' '{ printf "%-25s %s\n", $$1, $$2 }'
$(VENV_ACTIVATE):
test -d $(VENV_DIR) || $(VENV_BIN) $(VENV_DIR)
$(VENV_RUN); touch $(VENV_ACTIVATE)
venv: $(VENV_ACTIVATE) ## Create a new (empty) virtual environment
start: ## Start the localstack container in the detached mode
@test -n "${LOCALSTACK_AUTH_TOKEN}" || (echo "LOCALSTACK_AUTH_TOKEN is not set. Find your token at https://app.localstack.cloud/workspace/auth-token"; exit 1)
$(LOCAL_ENV) LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) docker compose up --build --detach --wait
stop: ## Stop the localstack container
docker compose down
ready: ## Wait until LocalStack is ready
@echo Waiting on the LocalStack container...
@localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1)
logs: ## Save the logs in a separate file
@localstack logs > logs.txt
install: venv ## Install the dependencies
$(VENV_RUN); $(PIP_CMD) install -r requirements.txt
deploy: ## Deploy the stack to the localstack
$(VENV_RUN); $(LOCAL_ENV) cdklocal bootstrap --output ./cdk.local.out
$(VENV_RUN); $(LOCAL_ENV) cdklocal deploy --require-approval never --output ./cdk.local.out
deploy-aws: ## Deploy the stack to the AWS
$(VENV_RUN); $(CLOUD_ENV) cdk bootstrap
$(VENV_RUN); $(CLOUD_ENV) cdk deploy --require-approval never
destroy: ## Stop the localstack container
docker-compose down
destroy-aws: venv ## Destroy the stack from the AWS
$(VENV_RUN); $(CLOUD_ENV) cdk destroy --require-approval never
run: ## Run the application with the localstack
$(VENV_RUN); $(LOCAL_ENV) python run.py
run-aws: ## Run the application with the AWS
$(VENV_RUN); $(CLOUD_ENV) python run.py