@@ -7,40 +7,63 @@ SHELL := /bin/bash
7
7
usage :
8
8
@fgrep -h " ##" $(MAKEFILE_LIST ) | fgrep -v fgrep | sed -e ' s/\\$$//' | sed -e ' s/##//'
9
9
10
+ # # Check if all required prerequisites are installed
11
+ check :
12
+ @command -v docker > /dev/null 2>&1 || { echo " Docker is not installed. Please install Docker and try again." ; exit 1; }
13
+ @command -v node > /dev/null 2>&1 || { echo " Node.js is not installed. Please install Node.js and try again." ; exit 1; }
14
+ @command -v aws > /dev/null 2>&1 || { echo " AWS CLI is not installed. Please install AWS CLI and try again." ; exit 1; }
15
+ @command -v localstack > /dev/null 2>&1 || { echo " LocalStack is not installed. Please install LocalStack and try again." ; exit 1; }
16
+ @command -v cdk > /dev/null 2>&1 || { echo " CDK is not installed. Please install CDK and try again." ; exit 1; }
17
+ @command -v cdklocal > /dev/null 2>&1 || { echo " cdklocal is not installed. Please install cdklocal and try again." ; exit 1; }
18
+ @command -v aws > /dev/null 2>&1 || { echo " AWS CLI is not installed. Please install AWS CLI and try again." ; exit 1; }
19
+ @command -v awslocal > /dev/null 2>&1 || { echo " awslocal is not installed. Please install awslocal and try again." ; exit 1; }
20
+ @echo " All required prerequisites are available."
21
+
10
22
# # Install dependencies
11
23
install :
12
- @which localstack || pip install localstack
13
- @which awslocal || pip install awscli-local
14
- @which cdklocal || npm install -g aws-cdk-local aws-cdk
24
+ @if [ ! -d " node_modules" ]; then \
25
+ echo " node_modules not found. Running npm install..." ; \
26
+ npm install; \
27
+ fi
28
+ @if [ ! -d " demos/rds-query-fn-code/node_modules" ]; then \
29
+ echo " demos/rds-query-fn-code/node_modules not found. Running npm install..." ; \
30
+ npm install --prefix demos/rds-query-fn-code; \
31
+ fi
32
+ @echo " All required dependencies are available."
15
33
16
34
# # Deploy the infrastructure
17
- build :
18
- npm install && cd demos/rds-query-fn-code && npm install
19
-
20
- # # Bootstap the CDK sample
21
- bootstrap :
22
- cdklocal bootstrap
23
-
24
- # # Deploy the CDK sample
25
35
deploy :
36
+ @echo " Bootstrapping CDK..."
37
+ cdklocal bootstrap
38
+ @echo " Deploying CDK..."
26
39
cdklocal deploy --require-approval never
40
+ @echo " CDK deployed successfully."
41
+
42
+ # # Run the tests
43
+ test :
44
+ @echo " Running tests..."
45
+ npm test
46
+ @echo " Tests completed successfully."
27
47
28
48
# # Start LocalStack in detached mode
29
49
start :
30
- RDS_MYSQL_DOCKER=1 localstack start -d
50
+ @echo " Starting LocalStack..."
51
+ @LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN ) localstack start -d
52
+ @echo " LocalStack started successfully."
31
53
32
54
# # Stop the Running LocalStack container
33
55
stop :
34
- @echo
35
- localstack stop
56
+ @echo " Stopping LocalStack..."
57
+ @localstack stop
58
+ @echo " LocalStack stopped successfully."
36
59
37
60
# # Make sure the LocalStack container is up
38
61
ready :
39
62
@echo Waiting on the LocalStack container...
40
63
@localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1)
41
64
42
- # # Save the logs in a separate file, since the LS container will only contain the logs of the last sample run.
65
+ # # Save the logs in a separate file
43
66
logs :
44
67
@localstack logs > logs.txt
45
68
46
- .PHONY : usage install bootstrap build deploy deploy start stop ready logs
69
+ .PHONY : usage check start ready install deploy test logs stop
0 commit comments