X-Git-Url: https://git.cworth.org/git?p=turbot;a=blobdiff_plain;f=Makefile;h=3b62ba8846018f83abd3257ec1141992bbadd771;hp=5199e6ae4317f99c1fa3f40e761ac003070dce31;hb=HEAD;hpb=6209247caaef8d6eea9a249713e1f590a47f46a0 diff --git a/Makefile b/Makefile index 5199e6a..3b62ba8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ DEPLOY_HOST=halibut.cworth.org DEPLOY_DIR=/srv/halibut.cworth.org/turbot export DEPLOY_DIR DO_NOT_DEPLOY=env .gitignore -DO_NOT_DELETE=.turbot.env +DO_NOT_DELETE=.slack-creds.env .gsheets-creds.json .gsheets-token.pickle help: @echo "Available targets (in rough order of expected use):" @@ -22,6 +22,10 @@ ifndef VIRTUAL_ENV $(error "No virtualenv active. Try '. ./env/bin/activate'") endif +.PHONY: flake +flake: + flake8 --exclude=env,.deploy* + .PHONY: bootstrap bootstrap: @echo "=== Creating python virtual environment ===" @@ -52,21 +56,42 @@ endif pip-compile --no-index --generate-hashes --allow-unsafe run: require-venv - python3 ./turbot.py + FLASK_APP=turbot.turbot FLASK_DEBUG=true flask run 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=%) \ - --exclude=$(DO_NOT_DELETE) \ + $(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 + make -C .deploy-lambda-source flake + make -C .deploy-lambda-source bootstrap + (cd .deploy-lambda-source; . env/bin/activate; make reqs) + (cd .deploy-lambda-source/env/lib/python*/site-packages; zip -r ../../../../turbot.zip .) + (cd .deploy-lambda-source/turbot_lambda; zip ../turbot.zip turbot_lambda.py) + (cd .deploy-lambda-source; zip turbot.zip $$(git ls-files -- turbot)) + (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-lambda