/flask-ml-az-serverless

Flask Machine Learning Azure serverless

Primary LanguagePython

Azure CI/CD

Overview

This project titled 'Building a CI/CD Pipeline' project is part of the 'DevOps Engineer for Microsoft Azure' Udacity nanodegree program.

The objective of this project is to :

A. Create an Azure pipeline.

B. Deploy the python app (provided in the project resource) in Azure cloud.

C. Test and validate that the pipeline deploys the code changes.

The following steps will implement the task of building a CI/CD pipeline: Note: The goal of the python application in this project is to predict housing prices in Boston.

  1. Create a github repository and upload the starter code to it.
  2. Create a workflow using Github Actions and deploy the app in Azure cloud.
  3. Create a CI/CD pipeline in Azure DevOps and deploy the app using Azure pipeline in Azure App service.
  4. Run Flask app and validate the results (prediction).
  5. Perform load test using locust and note the results.
  6. Make sure Code changes committed to the GitHub repo would trigger automated code deployment.

High level Architecure

Az_CICD_Architecture.pngimage

Project Timeline Trello board - https://trello.com/b/1cuoVD4k/azcicd

Project Timeline Spreadheet - https://github.com/robertnick04/flask-ml-az-serverless/blob/main/AzureCICD_Project_Timeline.xlsx

Project Demo Video - https://www.youtube.com/watch?v=jvwVc1S0qDo&t=23s

CI

1. Connect to the Cloud shell from the terminal and clone the project repository

Screen Shot 2021-09-23 at 5 31 43 PM (2)

2. Install requirements for python virtual environment

Screen Shot 2021-09-23 at 5 47 18 PM (2)

3. Build using Github actions

Screen Shot 2021-09-23 at 5 56 16 PM (2)

4. Validate app is deployed successfully using Github actions and the app is running

Screen Shot 2021-09-23 at 6 34 13 PM (2)

5. Setup CI with Azure pipelines

Screen Shot 2021-09-23 at 6 46 37 PM (2)

6. Deploy the app using Azure pipeline

Screen Shot 2021-09-24 at 4 05 30 PM (2)

7. Validate app is deployed successfully using Azure pipeline and the app is running

Screen Shot 2021-09-24 at 4 05 05 PM (2)

8. Run the 'make prediction' script and validate the result

Screen Shot 2021-09-24 at 4 06 08 PM (2)

9. Validate the prediction

Screen Shot 2021-09-24 at 4 08 05 PM (2)

10. Tail the log

Screen Shot 2021-09-24 at 4 10 00 PM (2)

11. Run the load test using locust

Screen Shot 2021-11-18 at 4 43 07 PM

Screen Shot 2021-11-18 at 4 42 58 PM

Future Improvements

This project could be enhanced by including the following items:

  • PROD and NON-PROD environments such as Dev, test/stage could be implemented.
  • A policy could be implemented to require Pull requests are reviewed and approved before merging the code to the main branch