An example webapp using Flask.
Run example from Docker Hub:
docker run -p 8080:8080 -it jecklgamis/flask-app-example:main
- Ubuntu Docker image
- Gunicorn WSGI server
- Build info, liveness and readiness probe endpoints
- PyTest unit tests
- HTTP/HTTPS listeners
- Kubernetes deployment (Helm chart)
- Python 3
- Docker
- Helm
- Make (optional)
Install dependencies (make install-deps
)
pip install -r requirements.txt
Build Docker image (make all
)
./generate-ssl-certs.sh
./generate-build-info.sh
pytest -s
docker build -t flask-app-example:main .
Run the app in Docker (make run
)
docker run -it flask-app-example:main
Run the app directly (./run-app.sh
)
FLASK_DEBUG=true
flask run --host 0.0.0.0 --port 8080
Run the app directly using HTTPS (USE_SSL=true ./run-app.sh
)
FLASK_DEBUG=true
flask run --cert server.crt --key server.key --host 0.0.0.0 --port 8443
Run unit tests
pytest
Run some basic endpoint tests (make smoke-tests
). Ensure the app is running.
./smoke-tests.py
- This assumes you can deploy to a Kubernetes cluster from your machine.
- Ensure you have
helm
andyq
installed.
For all the operations below, change directory to deployment/k8s/helm
.
Create Helm chart (make package
):
helm package ./chart
Install Helm chart (make install
):
helm install flask-app-example flask-app-example-v1.0.0-rc.1.tgz
Delete Helm chart (make uninstall
):
helm uninstall flask-app-example
Please raise issue or pull request? Thanks.
Have fun!