This repository allows one to quickly create a Flask service. The service can be run locally in a Docker container and then easily deployed to AWS Lambda.
git clonethe repo that uses this as a templategit submodule initorsyncorupdate, I'm not sure which works but I don't think running all of them hurts!./scripts/start_containers.sh
- Note: If you run into an issue related to a file in housekeeping_flask/ being recognized as a directory instead of a file, you probably tried to start the containers before getting the submodule contents. Redownload the submodule, prune you containers, and volumes and retry.
- To show submodules:
git config --file=.gitmodules -l(from https://tech.serhatteker.com/post/2019-01/changing-git-submodules-urlbranch-to/) - To update which version of a submodule this repo expects:
cdto submodule- With changes in the submodule,
git add,git commit, andgit pushlike normal. cdback to the root of this repository, one level above the submodulegit add housekeeping_flask/git commit -m 'update housekeeping_flask version;'git push
Note: ./scipts/deploy should work after the first deployment and if the containers are running. If not, follow the below steps.
From the root of the Git repo.
git status: Make sure you're on master!- Stop containers.
- Start containers.
docker exec -it public_api bashcd /usr/src/public_apipython3 -m venv venvsource ./venv/bin/activatepip install zappapip install -r requirements.txtzappa package -s zappa_settings.yaml -o out.zipexitto get out of the container.cd my_api/:zappa deploy -z out.zip -s zappa_settings.json- NOTE: The first time you deploy using
zappa deploywith-z out.zipit'll fail because the IAM Execution role doesn't exist. This is a bug with zappa. To fix, first dozappa deploywithout-z out.zip. Zappa will create the execution role, though the command will fail. The command output will have a line like: ```
Creating documentguardian-public-api-dev-ZappaLambdaExecutionRole IAM Role.. Creating zappa-permissions policy on documentguardian-public-api-dev-ZappaLambdaExecutionRole IAM Role.
After that, `zappa deploy -z out.zip -s zappa_settings.json ` should pass.- NOTE: The first time you deploy using