Skip to content

Repository files navigation

Python application test with Github Actions

Overview

The goal of this project is to demonstrate the usage of a CI/CD pipeline for an Azure deployment, demonstrating code testing and automation. For a working demo we use the application flask-sklearn.

Project Plan

Instructions

Architectural Diagram (Shows how key parts of the system work)

Architecture

To make this project work we have to do the follwing steps

Resource group

First step is to create a resource group in Azure for our resources. I named it udacity-project-2.

Resource Group

Project running on Azure App Service

Next step is the creation of an Azure AppService. The CD pipeline will deploy the python application (flask-sklearn) into this AppService. I named it udacity-devops-2.

Azure Webapp

Project cloned into Azure Cloud Shell

To test the application later we clone our Github repo into Microsoft Azure CloudShell.

cd ~
git clone git@github.com:daniel-mersch/udacity-devops-2.git
cd udacity-devops-2

Repository cloned

Preparations

To run a python app in CloudShell we have to first install a virtual environment and all dependencies. This is done by executing our Makefile.

make all

make all

Output of a test run

Now we run a test of our code.

make test

make test

Successful deploy of the project in Azure Pipelines.

With each push to the Github repo the CI pipeline runs.

Github Action

A successful run of the CI pipeline triggers a run of the CD pipeline in Azure.

Webapp Deployment

Running Azure App Service from Azure Pipelines automatic deployment

The Webapp can be accessed via webbrowser: https://udacity-devops-2.azurewebsites.net/

Azure Webapp

Successful prediction from deployed flask app in Azure Cloud Shell.

We have a little shell script called make_predict_azure_app.sh, which makes a test call to our WebApp.

./make_predict_azure_app.sh

Output running Prediction

Output of streamed log files from deployed application

Last step is to verify, that our Webapp is running like expected. Therefore we take a look at the streamed log.

Streamed Log AppService Log Stream

Enhancements

For the future we should update the application to a current python version. The used version 3.5 is no longer supported, neither by Github Actions nor by Azure AppService, therefore we need to update the requirements.

Python error

Python 3.5 throws deprecated error. Python 3.5 throws deprecated error

Python 3.7 is the minimum supported version. Python 3.7 is the minimum supported version

Demo

Screencast on Youtube

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages