|
| 1 | +SHELL := /bin/bash |
| 2 | +GREEN='\033[0;32m' |
| 3 | +YELLOW='\033[1;33m' |
| 4 | +NC='\033[0m' |
| 5 | + |
| 6 | +.PHONY: install-holy-lambda native-dry-run compile dry-run native-compile native-pack native-deploy native-destroy logs-tail |
| 7 | +BUCKET_NAME=holy-lambda--sqs-example |
| 8 | +STACK_NAME=holy-lambda--sqs-example |
| 9 | +APP_REGION=eu-central-1 |
| 10 | +LAMBDA_NAME=ReceiveStringLambdaFunction |
| 11 | +EVENT_PAYLOAD_FILE=./sample-receive-event.json |
| 12 | + |
| 13 | +prepare-dependencies: |
| 14 | + @cp /usr/lib/jvm/java-1.8.0-openjdk/jre/lib/amd64/libsunec.so ./dependencies/ |
| 15 | + |
| 16 | +make-bucket: |
| 17 | + @aws s3 mb s3://$(BUCKET_NAME) |
| 18 | + |
| 19 | +destroy-bucket: |
| 20 | + @aws s3 rb s3://$(BUCKET_NAME) --force --region $(APP_REGION) |
| 21 | + |
| 22 | +install-holy-lambda: |
| 23 | + @bash -c "cd ../../ && lein install" |
| 24 | + |
| 25 | +compile: |
| 26 | + @lein uberjar |
| 27 | + |
| 28 | +dry-api: |
| 29 | + @sam local start-api --skip-pull-image |
| 30 | + |
| 31 | +native-compile: |
| 32 | + @rm -Rf latest.zip |
| 33 | + @fnative "-jar target/sqs-example.jar \ |
| 34 | + --report-unsupported-elements-at-runtime \ |
| 35 | + --no-fallback \ |
| 36 | + --enable-url-protocols=http,https \ |
| 37 | + --no-server -J-Xmx3G -J-Xms3G \ |
| 38 | + --initialize-at-build-time \ |
| 39 | + -H:+PrintClassInitialization \ |
| 40 | + --enable-all-security-services \ |
| 41 | + -H:ReflectionConfigurationFiles=reflect.json \ |
| 42 | + -H:DynamicProxyConfigurationFiles=dynamic-proxies.json" |
| 43 | + @mv -f sqs-example bootstrap |
| 44 | + @zip -j latest bootstrap dependencies/libsunec.so |
| 45 | + |
| 46 | +native-dry-api: |
| 47 | + @sam local start-api --template ./native-template.yml --skip-pull-image |
| 48 | + |
| 49 | +native-sqs-invoke: |
| 50 | + @sam local invoke $(LAMBDA_NAME) --template ./native-template.yml --skip-pull-image -e $(EVENT_PAYLOAD_FILE) |
| 51 | + |
| 52 | +sqs-invoke: |
| 53 | + @sam local invoke $(LAMBDA_NAME) --template ./template.yml --skip-pull-image -e $(EVENT_PAYLOAD_FILE) |
| 54 | + |
| 55 | +pack: |
| 56 | + @sam package --template-file ./template.yml --output-template-file packaged.yaml --s3-bucket $(BUCKET_NAME) --s3-prefix "sqs-example-latest" |
| 57 | + |
| 58 | +deploy: |
| 59 | + @sam deploy --template-file ./packaged.yaml --stack-name $(STACK_NAME) --capabilities CAPABILITY_IAM --region $(APP_REGION) |
| 60 | + |
| 61 | +native-pack: |
| 62 | + @sam package --template-file ./native-template.yml --output-template-file native-packaged.yaml --s3-bucket $(BUCKET_NAME) --s3-prefix "sqs-example-latest" |
| 63 | + |
| 64 | +native-deploy: |
| 65 | + @sam deploy --template-file ./native-packaged.yaml --stack-name $(STACK_NAME) --capabilities CAPABILITY_IAM --region $(APP_REGION) |
| 66 | + |
| 67 | +native-destroy: |
| 68 | + @aws cloudformation delete-stack --stack-name $(STACK_NAME) --region $(APP_REGION) |
| 69 | + |
| 70 | +logs-tail: |
| 71 | + sam logs -n $(LAMBDA_NAME) --stack-name $(STACK_NAME) -t |
0 commit comments