v1.0.0 → Project on Google Cloud Platform (GCP) focused on learning how to use Docker and Kubernetes, how to expose Flask Applications and how to separate different tasks when deploying a simple ML model as a structure of microservices.
v2.0.0 → Implemented a complete CI/CD pipeline consisting of Unit Testing, Integration Tests, Automatic building and pushing images to DockerHub, End-to-End tests and Automatic Deployment to a GKE cluster in GCP. Unit Tests are run on every commit whereas the rest of the steps are only triggered for commits to Main branch with [SRC] at the start of the commit message
- Frontend → The only service with Public IP with which the user can interact.
- Backend → Handles the connections with the database and the Machine Learning model.
- Mysql → Serves as a Database that stores the predictions of the Machine Learning model.
- Model → Pretrained ML model on the Iris dataset
docker network create cloudprojectiris
docker run -d --name mysql --net cloudprojectiris victorrgez/cloudprojectirismysql
docker run -d --name model --net cloudprojectiris victorrgez/cloudprojectirismodel
docker run -d -p=0.0.0.0:5000:5000 --name frontend --net cloudprojectiris victorrgez/cloudprojectirisfrontend
docker run -d --name backend --net cloudprojectiris victorrgez/cloudprojectirisbackend
- Visit http://localhost:5000 or copy the external IP of your machine instead of
localhost
docker stop backend frontend model mysql
docker rm backend frontend model mysql
- Remove the images individually with
docker rmi
(you can list them withdocker image ls
) docker network rm cloudprojectiris
git clone https://github.com/victorrgez/cloudprojectiris.git
cd cloudprojectiris
docker-compose up -d
docker-compose down -v
docker-compose down
git clone https://github.com/victorrgez/cloudprojectiris.git
- Install
kompose.io
following the instructions for your OS https://kompose.io/installation/ cd cloudprojectiris
kompose convert -f docker-compose.yml
- Add
type: LoadBalancer
inside thespec
block in the filefrontend-service.yaml
like in here kubectl apply -f .
(ignore warnings about docker-compose.yml)- Wait a couple of minutes for
mysql
service to start-up so thatbackend
can eventually become healthy kubectl get service frontend
- Copy the
EXTERNAL-IP
in your browser and put:5000
at the end
Alternatively you can run kubectl apply -f .
inside the kubernetesYAMLFiles
folder instead of using kompose.io
kubectl delete services frontend backend mysql model
kubectl delete deployments frontend backend mysql model
kubectl delete pvc statefuldatabase