-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
99 lines (67 loc) · 3.23 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)base.mk
INPUT_CONFIG_FILE=config.json
INPUT_CONFIG_PATH=$(SELF_DIR)$(INPUT_CONFIG_FILE)
ifneq ("$(wildcard $(INPUT_CONFIG_PATH))","")
STACK_CONFIG_NAME := $(call FromInConf,$(INPUT_CONFIG_PATH),stack_config_name)
AWS_REGION := $(call FromInConf,$(INPUT_CONFIG_PATH),region)
STAGE := $(call FromInConf,$(INPUT_CONFIG_PATH),stage)
else
$(error Missing input config file: $(INPUT_CONFIG_FILE))
endif
STACK_OUTPUT_PATH=$(SELF_DIR)stackoutput.json
target:
$(info ${HELP_MESSAGE})
@exit 0
init: ## initialize CDK environment. Needed only the first time
@echo "Initializing CDK environment"
@cdk bootstrap
deploy: ##=> Deploy services
$(info [*] Deploying backend...)
$(MAKE) deploy.backend
$(MAKE) deploy.lex
deploy.backend: ##=> Deploy backend lambda handlers
@echo "Pushing CDK stack '$(STACK_CONFIG_NAME)' using the Default CLI profile to cloud"
@npm run build
@cdk deploy $(STACK_CONFIG_NAME) \
--require-approval never \
--outputs-file $(STACK_OUTPUT_PATH) \
deploy.lex:
$(MAKE) deploy.lex.id
$(MAKE) deploy.lex.med
$(MAKE) deploy.lex.symptom
$(MAKE) deploy.lex.confirm
delete: ##=> Delete services
$(MAKE) delete.backend
delete.backend: ##=> Delete backend services deployed through CDK
cdk destroy
deploy.lex.confirm:
$(info [*] Deploy Lex bot to confirm report time during outbound call...)
$(eval LAMBDA_ENDPOINT ?= $(call FromOutConf,$(STACK_OUTPUT_PATH),$(STACK_CONFIG_NAME), ConfirmReportTimeLexHandlerArn))
$(info Confirm report time Lex bot lambda: ${LAMBDA_ENDPOINT})
lex-bot-deploy -s lex-vui/ConfirmTimeToReport_Export.json --lambda-endpoint ${LAMBDA_ENDPOINT} --verbose --alias ${STAGE} --region ${AWS_REGION}
deploy.lex.id: ##=> Deploy identify verification Lex bot
$(info [*] Deploy identify verification Lex bot...)
$(eval LAMBDA_ENDPOINT ?= $(call FromOutConf,$(STACK_OUTPUT_PATH),$(STACK_CONFIG_NAME), VerifyIdentityLexHandlerArn))
$(info Identify verification Lex bot lambda: ${LAMBDA_ENDPOINT})
lex-bot-deploy -s lex-vui/VerifyIdentity_Export.json --lambda-endpoint ${LAMBDA_ENDPOINT} --verbose --alias ${STAGE} --region ${AWS_REGION}
deploy.lex.med: ##=> Deploy medication diary Lex bot
$(info [*] Deploy medication diary Lex bot...)
$(eval LAMBDA_ENDPOINT ?= $(call FromOutConf,$(STACK_OUTPUT_PATH),$(STACK_CONFIG_NAME), MedicationDiaryHandlerArn))
$(info Medication diary Lex bot lambda: ${LAMBDA_ENDPOINT})
lex-bot-deploy -s lex-vui/Medication_Export.json --lambda-endpoint ${LAMBDA_ENDPOINT} --verbose --alias ${STAGE} --region ${AWS_REGION}
deploy.lex.symptom: ##=> Deploy symptom Lex bot
$(info [*] Deploy symptom Lex bot...)
$(eval LAMBDA_ENDPOINT ?= $(call FromOutConf,$(STACK_OUTPUT_PATH),$(STACK_CONFIG_NAME), GatherSymptomLexHandlerArn))
$(info Symptom report Lex bot lambda: ${LAMBDA_ENDPOINT})
lex-bot-deploy -s lex-vui/SymptomReport_Export.json --lambda-endpoint ${LAMBDA_ENDPOINT} --verbose --alias ${STAGE} --region ${AWS_REGION}
test.bots:
lex-bot-test --test-file tests/integ/test-symptom-bot.yml --alias dev --quiet
define HELP_MESSAGE
...::: Bootstraps environment with necessary tools :::...
$ make init
...::: Deploy all resources :::...
$ make deploy
...::: Delete all deployed resources :::...
$ make delete
endef