forked from tinyg210/shipment-list-demo
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (60 loc) · 2.88 KB
/
Makefile
File metadata and controls
72 lines (60 loc) · 2.88 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
70
71
72
export AWS_ACCESS_KEY_ID ?= test
export AWS_SECRET_ACCESS_KEY ?= test
export AWS_DEFAULT_REGION=us-east-1
SHELL := /bin/bash
## Show this help
usage:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
## Check if all required prerequisites are installed
check:
@command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; }
@command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; }
@command -v localstack > /dev/null 2>&1 || { echo "LocalStack is not installed. Please install LocalStack and try again."; exit 1; }
@command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; }
@command -v tflocal > /dev/null 2>&1 || { echo "tflocal is not installed. Please install tflocal and try again."; exit 1; }
@command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; }
@command -v java > /dev/null 2>&1 || { echo "Java is not installed. Please install Java and try again."; exit 1; }
@echo "All required prerequisites are available."
## Install dependencies
install:
@echo "Installing dependencies..."
cd shipment-picture-lambda-validator && mvn clean package shade:shade && cd ..
@if [ ! -d "shipment-list-frontend/node_modules" ]; then \
echo "node_modules not found. Running npm install..."; \
cd shipment-list-frontend && npm install; \
fi
@echo "All required dependencies are now available."
## Deploy the infrastructure
deploy:
@echo "Deploying the infrastructure..."
cd terraform && tflocal init && tflocal plan && tflocal apply --auto-approve
@echo "Infrastructure deployed successfully."
## Test the application
test:
@echo "Running the tests..."
mvn test -Dtest=dev.ancaghenade.shipmentlistdemo.integrationtests.ShipmentServiceIntegrationTest
@echo "Tests run successfully."
## Run the application
run:
@echo "Running the Spring Boot application..."
mvn spring-boot:run -Dspring-boot.run.profiles=dev
## Run the React application
frontend:
@echo "Running the React application..."
cd shipment-list-frontend && npm start
## Start LocalStack in detached mode
start:
@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)
@LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d
## Stop the Running LocalStack container
stop:
@echo
localstack stop
## Make sure the LocalStack container is up
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)
## Save the logs in a separate file
logs:
@localstack logs > logs.txt
.PHONY: usage install check start ready deploy logs stop test