-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (45 loc) · 1.75 KB
/
Makefile
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
VENV_BIN ?= python3 -m venv
VENV_DIR ?= .venv
PIP_CMD ?= pip3
USERNAME ?= admin
DB_NAME ?= dms_sample
USERPWD ?= 1Wp2Aide=z=,eLX3RrD4gJ4o54puex
STACK_NAME ?= DMsSampleSetupStack
DB_ENDPOINT ?= mariadb_server
DB_PORT ?= 3306
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 = USERNAME=$(USERNAME) DB_NAME=$(DB_NAME) USERPWD=$(USERPWD) STACK_NAME=$(STACK_NAME)
LOCAL_ENV = USERNAME=$(USERNAME) DB_NAME=$(DB_NAME) USERPWD=$(USERPWD) STACK_NAME=$(STACK_NAME) DB_ENDPOINT=$(DB_ENDPOINT) DB_PORT=$(DB_PORT) 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:
$(LOCAL_ENV) docker compose up --build --detach --wait
install: venv
$(VENV_RUN); $(PIP_CMD) install -r requirements.txt
deploy:
$(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:
$(VENV_RUN); $(CLOUD_ENV) cdk bootstrap
$(VENV_RUN); $(CLOUD_ENV) cdk deploy --require-approval never
destroy:
docker-compose down
destroy-aws: venv
$(VENV_RUN); $(CLOUD_ENV) cdk destroy --require-approval never
run:
$(VENV_RUN); $(LOCAL_ENV) python run.py
run-aws:
$(VENV_RUN); $(CLOUD_ENV) python run.py