Git Product home page Git Product logo

udacity-azure-course2's Introduction

Python application test with Github Actions

Overview

This is the second project of Udacity Cloud DevOps Engineer using Azure Nanodegree.

Project Plan

  • A link to a Trello board for the project:

https://trello.com/b/mkRe5Rne/udacity-azure-course2

  • A link to a spreadsheet that includes the original and final project plan:

https://docs.google.com/spreadsheets/d/1Q3iyPWt2bHowQ76-PuupFn5tF3dBx7mrWktgoqO_E2I/edit?usp=sharing

Instructions

Architectural Diagram

Project cloned into Azure Cloud Shell

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
  • Add public key to GitHub. (GitHub > Settings > SSH and GPG keys > Paste > Add the key)
  • Clone the repository
git clone [email protected]:voletri/udacity-azure-course2.git

Passing tests that are displayed after running the make all command from the Makefile

  • Create a virtual environment
python3 -m venv ~/.udacity-azure-course2
source ~/.udacity-azure-course2/bin/activate
  • Run: make all
cd udacity-azure-course2
make all

  • The following commands can be run in order to then test and start the application:
export FLASK_APP=app.py
flask run

Project running on Azure App Service

az webapp up --sku F1 -n udacity-azure-course2
  • Confirm webapp is created successfully

    Confirm app is up and running

    https://udacity-azure-course2.azurewebsites.net
    

Configure GitHub Actions

  • GitHub > Actions > set up a workflow yourself
name: Python application test with Github Actions

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Install dependencies
      run: |
        make install
    - name: Lint with pylint
      run: |
        make lint
    - name: Test with pytest
      run: |
        make test

Configure Azure Pipeline

Note the official documentation should be referred to and double checked asyou setup CI/CD. Successful deploy of the project in Azure Pipelines.

  • Logs from your running application here:
https://udacity-azure-course2.scm.azurewebsites.net/api/logs/docker
(.udacity-azure-course2) tri@Azure:~/udacity-azure-course2$ sh make_predict_azure_app.sh
Port: 443
{"prediction":[20.35373177134412]

  • Output of streamed log files from deployed application

Go to https://portal.azure.com/ -> App Service -> Select app -> In tab Monitoring -> Log stream

Or using command to display the logs of the server:

az webapp log tail -g trivl_rg_1166 -n udacity-azure-course2

  • Output of locust I will implement Locust

Create file locustfile.py

Using command start a local service in your environment, default port is 8089

locust -f locustfile.py

Enhancements

  • Improve error handling and tesing
  • Add new pytest tests in the Makefile
  • Setup different environments (DEV, Production)

Demo

Youtube demo link: https://youtu.be/B52y8BWTuRg

udacity-azure-course2's People

Contributors

voletri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.