In this project we are given a pre-trained, sklearn
model that has been trained to predict housing prices in Boston according to several features, such as average rooms in a home and data about highway access, teacher-to-pupil ratios, and so on. You can read more about the data, which was initially taken from Kaggle, on the data source site. This project we operationalize a Python flask app—in a provided file, app.py
—that serves out predictions (inference) about housing prices through API calls.
- Test your project code using linting
- Complete a Dockerfile to containerize this application
- Deploy our containerized application using Docker and make a prediction
- Improve the log statements in the source code for this application
- Configure Kubernetes and create a Kubernetes cluster
- Deploy a container using Kubernetes and make a prediction
- Upload a complete Github repo with CircleCI to indicate that your code has been tested
- Create a virtualenv and activate it
- python3 -m venv ~/.devops
- source ~/.devops/bin/activate
- Run
make install
to install the necessary dependencies - While you still have your .devops environment activated, you will still need to install: Docker, Hadolint, Kubernetes (Minikube)
- Run make lint to check final version of Docker file
- Standalone:
python app.py
- Run in Docker:
./run_docker.sh
- Run in Kubernetes:
./run_kubernetes.sh
- Prediction application will be running on http://hostip:8000
- While it is running execute make_predicion.sh to invoke predicting application in the conainer app.py via API calls
- Setup and Configure Docker locally
- Setup and Configure Kubernetes locally
- Create Flask app in Container
- Run via kubectl
- .circleci/config.yml: Configuration file for CircleCI
- Dockerfile: Spec that isntructs docker how to buil application container
- Makefile: All the required commands to install and lint the applicaiton
- app.py: Boston housing prices predicting application
- requirements.txt: List of required packages to be installed for our application to run
- model_data/boston_housing_prediction.joblib: Pre-trained,
sklearn
model that has been trained to predict housing prices in Boston, used by app.py - run_docker.sh: Shell script that builds and runs the docker container
- run_kubernetes.sh: Shell script that runs prediction app as a pod in kubernetes
- make_prediction.sh: Prediction application invokation script
- upload_docker.sh: Shell script that tags and uploads our docker image to dockerhub
- output_txt_files/docker_out.txt: Running run_docker.sh and make_prediction.sh output file
- output_txt_files/kubernetes_out.txt Running run_kubernetes.sh and make_prediction.sh output file