|
Some checks are pending
ci/woodpecker/push/ci Pipeline is running
A stored null given_name or family_name crashed every protected route. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|---|---|---|
| .woodpecker | ||
| ci | ||
| command_functions | ||
| config | ||
| docs | ||
| grafana | ||
| helper | ||
| routes | ||
| scripts | ||
| service | ||
| terraform | ||
| tests | ||
| translations | ||
| .dockerignore | ||
| .DS_Store | ||
| .gitignore | ||
| .python-version | ||
| .zappaignore | ||
| api_spec.py | ||
| app.py | ||
| AWSCLIV2.pkg | ||
| changelog.md | ||
| docker-compose_ci_app.yml | ||
| docker-compose_ci_deployment.yml | ||
| docker-compose_dev.yml | ||
| Dockerfile_dev | ||
| Dockerfile_prod | ||
| gunicorn.conf.py | ||
| i18n.py | ||
| Jenkinsfile | ||
| makefile | ||
| Pipfile | ||
| pytest.ini | ||
| README.md | ||
| zappa-api-template-1647279457.json | ||
| zappa_settings.json | ||
Swobbee REST APi
activate virtual environment
pipenv shell
install dependencies
pipenv install
or
pipenv install --sequential
Using this command will make sure that the dependencies are installed in the order as found in pipfile.
therefor avoiding installing incorrect version of dependencies.
After installing the dependencies, make sure pycryptodome with version 3.14.1 is installed.
Otherwise, there will be error with python 3.7.3
run api locally
switch between stack by changing the environment variable STACK
FLASK_APP=app.py STACK=beta FLASK_ENV=development flask run
deploy new api (new lambda/rest-api)
<name> api name links to a definition in zappa_settings.json. Choose your definition, or create a new one, before deploy a new
stack.
zappa deploy <name>
deploy (update) exsisting stack <name>
Take a look into zappa_settings.json to get exsting Stacks and Stages
zappa update <name>
undeploy api
zappa undeploy <name>
Documentation
Check out zappa-aws-docu and Github for more documentation.
Local development using docker
Requirements
Docker, docker-compose and make utility installed. All make cmd can be found at ./makefile
Docker version 20.10.5+dfsg1, build 55c4c88
docker-compose version 1.25.0, build unknown
Build docker image
This is the common image for all staging with all the dependencies needed to run the app. It can be used to run with different staging environment (beta, dev, local ...)
make build-dev --> Create common image for all staging environments
Run docker image for local development
make run-dev --> Run app with STACK=dev
Deployment to staging using docker-compose
- First build the image
make build-dev
- Second deploy using zappa via docker compose:
make docker-deploy-beta --> deploy to beta stage (zappa update beta_v1)
make staging-beta --> deploy to jenkins stage (zappa update staging-beta)
make docker-deploy-dev --> deploy to dev stage (zappa update dev_v1)
make docker-deploy-release --> deploy to dev stage (zappa update rel_v1)
Testing and deploy with Jenkins CI/CD pipeline
Stages of the pipeline: PREPARATION => BUILD => TEST => DEPLOY
The pipeline will ONLY run automatically after a merge request. If you want to run start the pipeline before creating a merge request, click the play button next to your branch at this URL
The BUILD stage will be skipped by default. If you add new dependencies into the Pipfile then add keyword build to your last commit message before pushing to remote and start the pipeline. It will detect it and rebuild the project again. Example commit Refactor | build
Deploy
For each deployment the whole project will be rebuild and tested by default. ONLY when all the tests are passed, the new version can be deployed
Conditions to run auto deployment
It's a merge request to selected branches as pre-defined in the following
AND the keyword deploy muss be present in merge commit message
Example merge commit: Resolve "random feature | deploy
Target stage is based on the following:
TARGET_BRANCH_TO_AUTO_DEPLOY_2_STAGING_BETA='beta' --> accepted merge request on branch beta should triggered deployment on staging-beta stage
TARGET_BRANCH_TO_AUTO_DEPLOY_2_RELEASE='dummy-place-holder' --> accepted merge request on branch dummy-place-holder should triggered deployment on release stage