Build Status

Overview

In this project, you will build a Github repository from scratch and create a scaffolding that will assist you in performing both Continuous Integration and Continuous Delivery. You'll use Github Actions along with a Makefile, requirements.txt and application code to perform an initial lint, test, and install cycle. Next, you'll integrate this project with Azure Pipelines to enable Continuous Delivery to Azure App Service.

This repository contains project resources that I've created and the submissions folder contains:

  • project_plan: Contains Project Plan Excel file.
  • screenshots: Contains required screenshot files.

Project Plan

It is critical to have an effective project plan and task tracking.

Instructions

architecture diagram

Test project locally using Azure Cloud Shell

  1. Download project code into Azure Cloud Shell Go to Azure Portal and open Azure Cloud Shell then clone this repository Download project
  2. Create and Activate Python virtual environment
$ python -m venv ~/.myenv
$ source ~/.myenv/bin/activate
  1. Install and execute test locally (Make sure you have make command installed)
$ make all

Result: Make all result

Deploy the project to Azure Web App

$ az webapp up -g Azuredevops -n <Your global unique web app name>

After execute above command the app will be deployed and result is displayed as following example: deploy result

Execute test against deployed application Edit the host in file ./make_predict_azure_app.sh to your application URL after successfully deployed. Then execute below command to test.

$ ./make_predict_azure_app.sh

Result: Test Result

Setup Azure Pipelines

Please follow this instructions to set up Azure Pipeline for the project. In general, the following steps need to be done:

  1. Go to dev.azure.com and create an Azure Devops project.

  2. Create a service connection to your Azure resources.

  3. Create a pipeline with existing azure-pipeline.yaml file and change following variables:

    • azureServiceConnectionId: '[YOUR SERVICE CONNECTION ID]'
    • webAppName: '[YOUR DEPLOYED AZURE WEB APP NAME]'
    • environmentName: '[ENV NAME THAT YOU WANT]'
    • Change the Azure Pipeline agent pool name of pool: myAgentPool

The pipeline will be looked like this: pipeline Exammple of the run detail: pipeline detail

Successfull prediction after pipeline deploy the app: predict

Load test using locust

$ locust -H <YOUR WEB APP URL>

Example:

$ locust -H https://flask-ml-service-258964.azurewebsites.net/

locust result

Stream of the Log file

$ az webapp log tail

log

Enhancements

This pipeline can be enhanced as following:

  • Deploy to multiple deployment slot for Dev, Test, Prod.
  • Integrate with GitHub Action for CD.

Demo

Here is the demo video