]> git.cworth.org Git - turbot/commitdiff
Add target to deploy our lambda code to AWS
authorCarl Worth <cworth@cworth.org>
Sun, 11 Oct 2020 20:55:15 +0000 (13:55 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 11 Oct 2020 20:55:15 +0000 (13:55 -0700)
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

Makefile

index b71e017587473181f6cf2a76bb77a3d74cfaf060..f3c46a18adbb00697b35c6baf01f29802924f3c2 100644 (file)
--- 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