From: Carl Worth Date: Sun, 11 Oct 2020 20:55:15 +0000 (-0700) Subject: Add target to deploy our lambda code to AWS X-Git-Url: https://git.cworth.org/git?p=turbot;a=commitdiff_plain;h=06dd63c8d89e54447486ec219bb5ffbf4cb6f958 Add target to deploy our lambda code to AWS The existing "make deploy" target now calls out to two targets: make flask: Deploys code to Flask app at halibut.cworth.org make lambda: Deploys code to AWS lambda function --- diff --git a/Makefile b/Makefile index b71e017..f3c46a1 100644 --- a/Makefile +++ b/Makefile @@ -57,16 +57,33 @@ run: require-venv turbot.wsgi: turbot.wsgi.in Makefile envsubst < turbot.wsgi.in > turbot.wsgi -deploy: - rm -rf .deploy-source - git clone . .deploy-source - rm -rf .deploy-source/.git - make -C .deploy-source turbot.wsgi - (cd .deploy-source; rsync -avz \ +.PHONY: deploy-flask +deploy-flask: + rm -rf .deploy-flask-source + git clone . .deploy-flask-source + rm -rf .deploy-flask-source/.git + make -C .deploy-flask-source turbot.wsgi + (cd .deploy-flask-source; rsync -avz \ $(DO_NOT_DEPLOY:%=--exclude=%) \ $(patsubst %,--exclude %,$(DO_NOT_DELETE)) \ --delete \ --delete-after \ ./ $(DEPLOY_HOST):$(DEPLOY_DIR) ) - rm -rf .deploy-source + rm -rf .deploy-flask-source ssh $(DEPLOY_HOST) '(cd $(DEPLOY_DIR); make bootstrap; . env/bin/activate; make reqs)' + +.PHONY: deploy-lambda +deploy-lambda: + rm -rf .deploy-lambda-source + git clone . .deploy-lambda-source + rm -rf .deploy-lambda-source/.git + (cd .deploy-lambda-source/lambda; zip ../turbot.zip lambda_function.py) + (cd .deploy-lambda-source; \ + aws lambda update-function-code \ + --profile halibut \ + --function-name turbot \ + --zip-file fileb://turbot.zip ) + rm -rf .deploy-lambda-source + +.PHONY: deploy +deploy: deploy-flask deploy-lambda