forked from localstack-samples/localstack-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (24 loc) · 1.32 KB
/
Makefile
File metadata and controls
30 lines (24 loc) · 1.32 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
export AWS_ACCESS_KEY_ID ?= test
export AWS_SECRET_ACCESS_KEY ?= test
export AWS_DEFAULT_REGION = us-east-1
usage: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
install: ## Install dependencies
yarn
which serverless || yarn add -D serverless
which localstack || pip install localstack
deploy: ## Deploy the app
@make install; \
echo "Deploying Serverless app to local environment"; \
SLS_DEBUG=1 ./node_modules/serverless/bin/serverless.js deploy --stage local
send-request: ## Send a test request to the deployed application
@echo Looking up API ID from deployed API Gateway REST APIs ...; \
apiId=$$(awslocal apigateway get-rest-apis | jq -r '.items[] | select(.name="local-localstack-demo") | .id'); \
echo Sending request to API Gateway REST APIs ID "$$apiId" ...; \
requestID=$$(curl -s -d '{}' http://$$apiId.execute-api.localhost.localstack.cloud:4566/local/requests | jq -r .requestID); \
echo "Received request ID '$$requestID'"; \
for i in 1 2 3 4 5 6 7 8 9 10; do echo "Polling for processing result to appear in s3://archive-bucket/..."; awslocal s3 ls s3://archive-bucket/ | grep $$requestID && exit; sleep 3; done
lint: ## Run code linter
@yarn lint
@flake8 demo
.PHONY: usage install deploy send-request lint