Skip to content

Pet-slack/udacity-cicd-demo

Repository files navigation

Overview

Python application test with Github Actions

Machine Learning Predict at Cloud. This project uses MS Azure PaaS and it´s a DevOps compliance project.

Project Plan

This project is designed to be deployed at MS Azure App Services, using DevOps CI/CD pipelines

Getting Started

  1. Clone this repository
  2. Create your infrastructure as code
  3. Update this azure_pipelines.yml to reflect your Azure environment.

Dependencies

  1. Create an Azure Account
  2. Install the Azure command line interface
  3. Create an Azure DevOps account
  4. Install Azure Cloud Shell

Instructions

  • Architectural Diagram
    • CI Workflow
    • CD Workflow

Azure CLI or Azure Cloud Shell

PRE-REQ: Make sure you are logged at your Azure via Azure CLI command:

az login

  1. Clone this Github repository locally:
git clone https://github.com/Pet-slack/udacity-cicd-demo.git
cd udacity-cicd-demo
  1. Create your Python virtual environment
  • Create a Python3.x virtualenv
python3 -m venv ~/.v-python

Part1

  • Activate your virtualenv
source ~/.v-python/bin/activate
  1. Run your project locally
  • Set it up:
make all
  • Run the program:
python app.py
  • Test the program running a ML prediction:
sh ./make_prediction.sh

Part3

Github Actions

  • Check Github Actions CI status

Github Actions CI

Deploy to Azure

Azure logo
  1. Initial project App Service setup/deploy:
az webapp up --name <APP_NAME> --sku F1 --location <LOCATION> --resource-group <RESOURCE_GROUP>

Az Initial Setup

  1. Setup and deploy CI/CD 💪
  • Log in at Azure DevOps and setup a new project using this Github Repo as source
  • Create a Project: New Project >> Go to Pipelines: Create Pipeline >> Select Project Repository >> Save
  • Set up a new automatic Service Connection called myUdacitySP_Conn in Project Settings >> Service Connections >> Azure Resource Manager
  • Deploy the DevOps project to Azure App Service running the CI/CD pipeline

✔️   Run Pipeline: Go to Project >> Pipelines >> Pipelines >> Click on Pet-slack.udacity-cicd-demo >> Click on Run pipeline

  1. Check the CI/CD deployment 💙

Az CICD Deploy

  1. Test Azure App Service deployment:
udacity@Azure:~$ ./make_predict_azure_app.sh
Port: 443
{"prediction":[20.35373177134412]}

Az CICD Test

  1. Output of streamed log files from deployed application
az webapp log tail --name <APP_NAME> --resource-group <RESOURCE_GROUP>

Az CICD Logs

Quick Deploy

Run the following commands to fully deploy this project at MS Azure.

curl -s https://raw.githubusercontent.com/Pet-slack/udacity-cicd-demo/master/scripts/full-deploy-commands.sh | bash -s -- start
curl -s https://raw.githubusercontent.com/Pet-slack/udacity-cicd-demo/master/scripts/full-deploy-commands.sh | bash -s -- deploy

Run the following command to delete the Azure App Service.

curl -s https://raw.githubusercontent.com/Pet-slack/udacity-cicd-demo/master/scripts/full-deploy-commands.sh | bash -s -- delete

Load Testing

Locust load testing output for Azure App Service

Locust

Locust Test based on scripts/locustfile.py

Enhancements

  • Add multiple stages:
    • Deploy CD DEV stage. In progress at ml-dev branch
    • Deploy CD Github Actions option. Pending

Demo

Yutube Demo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors