GithubHelp home page GithubHelp logo

rofrano / devops-workshop Goto Github PK

View Code? Open in Web Editor NEW
5.0 0.0 17.0 349.38 MB

DevOps Workshop Training that uses Vagrant, VirtualBox, Docker, and Minikube

License: Apache License 2.0

Dockerfile 1.38% Python 94.22% Makefile 4.39%

devops-workshop's Introduction

DevOps for Software Engineers Workshop 2020

This repository represents the starting point for a 3 hour workshop on DevOps for Software Engineers. It is menant to be forked to your own GitHub account so that you can create Issues and Pull Requests and push software updates as you follow along with the hands-on workshop.

Overview

Many job postings consider DevOps to consist largely of operation skills, but what about the software engineers that provide the Dev? This tutorial will give attendees first hand experience in building a microservice and deploying it as a container on Kubernetes using DevOps practices and methods. An overview of DevOps culture and cloud native microservice architecture will be presented as a backdrop to the hands-on exercise.

Attendees will build a RESTful Python Flask microservice using Test Driven Development techniques and run it locally. Then we will introduce the concepts of Docker and wrap that service in a Docker container and re-run our tests proving that the behavior has not changed. We will then set up a CI/CD pipeline and deploy the microservice to a local Kubernetes cluster. Finally we will add persistence to our microservice and deploy a Redis service in our Kubernetes cluster for our microservice to use showing how to use secrets for storing sensitive information like database credentials.

The tutorial will switch between lecture and lab several times as new concepts are introduced and then quickly demonstrated and implemented in the hands-on exercise. Attendees will come away with a good understanding of how modern software is delivered using DevOps tools and practices with a programmable containerized infrastructure like Kubernetes.

Prerequisites

To successfully follow along with this workshop you will need to have VirtualBox and Vagrant installed on your computer. The lab will be using an Ubuntu 18.04 virtual machine configured by Vagrant.

Agenda

The workshop Agenda is as follows:

Introduction and Setup

Overview of how the workshop will be run. Get Vagrant and VirtualBox installed and setup and building during the DevOps Overview section if you haven't done that before the workshop.

Follow these instructions to Install Prerequisite Software

Instructions on Working with Vagrant and VirtualBox

DevOps Overview

Brief Overview of DevOps with an emphasis on the Software Developer perspective. Attendees will be introduced to the practices that are covered in this workshop and also learn why culture is the most critical aspect of DevOps to get right.

Agile Planning

Introduction to Agile Planning concepts. Create an agile plan for the remainder of the workshop. Attendees will create Stories that they will execute during workshop. They will also use a Burndown chart to track their progress.

Stories include:

  1. Create a skeleton Flask service
  2. Add a counter where each GET increments the counter
  3. Make the counter persistent
  4. Add ability for multiple counters that are RESTful
  5. Setup Continuous Integration
  6. Add ability to delete a counter
  7. Add Docker support
  8. Add Kubernetes support

Full stories for planning are here

Social Coding

Introduction to the Git Feature Branch Workflow. Attendees will assign the first Story #1 from their Sprint Backlog to themselves, create a feature branch to work on the story, and issue a pull request to merge their code back into master.

Test Driven Development

Introduction to Test Driven Development. Attendees will write the test cases for the code they wish they had, and then implement that code following Agile Planning and Feature Branch Workflow. They will implement Story #2 to add a non-persistent counter where each GET increments the counter.

Microservices and REST APIs

Introduction to Microservice Architecture and REST APIs. Attendees will begin to code their first REST API for the hit counter application starting with test cases that follow good RESTful coding standards. Stories include Story #3 and Story #4 adding persistence to the counter in the form of a Redis database.

Continuous Integration and Continuous Delivery

Attendees will be introduced to the concepts of CI/CD and in particular Travis CI. They will connect their git repo to Travis CI so that their test cases run with every Pull Request. Stories include added Redis to their Travis CI in Story #5 and implementing the remainder of the REST interface in Story #6.

Introduction to Docker

Overview of Docker containers. Attendees will create a Dockerfile for their microservices and run it in a Docker container. They will implement Story #6 and update Travis CI to run tests for the Dockerized version.

Introduction to Kubernetes

Overview of Kubernetes. Attendees will deploy the Docker version of their microservice in a Kubernetes cluster. They will implement Story #7 and will also have to deploy a Redis service in Kubernetes for their microservice.

Copyright

(c) 2019, 2020 John Rofrano, All Rights Reserved

devops-workshop's People

Contributors

rofrano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

devops-workshop's Issues

Add ability to delete a counter

As a: User
I need: the ability to delete a counter
So that: I can remove unwanted counters

Assumptions:

  • Deleting a counter will remove it from the database
  • If the counter doesn't exist a 204_NO_CONTENT will be returned

Acceptance Criteria:

Given I have counter named foo
When I delete the counter named foo
Then I should receive a 204_NO_CONTENT
And I retrieve the counter named foo
Then I should receive 404_NOT_FOUND
And I delete the counter named foo again
Then I should receive a 204_NO_CONTENT

Add Docker support

As a: Service Provider
I need: the ability to deploy my service using Docker
So that: I can move with speed and agility

Assumptions:

  • Need to create a Dockerfle for the service
  • Need to update Travis CI to use Docker version

Acceptance Criteria:

Given I have my service in a Docker image
When I user docker run
Then I should have my service running in a contatiner

Create a skeleton Flask service

As a: Service Provider
I need: a minimal Flask service
So that: my developers have a starting point to add code

Assumptions:

  • Only the root / URl needs to be defined
  • Call it app.py for now

Acceptance Criteria:

Given I have a skeleton Flask app
When I call the / URL
Then I should see "Hello from Flask" returned

Add ability for multiple counters that are RESTful

As a: User
I need: the ability to create multiple RESTful counters
So that: I can keep track of multiple hit targets

Assumptions:

  • We will implement using REST API guidelines
  • Add ability to create multiple named counters
  • Add ability to update counters by name

Tasks:

  • Need to update root / URL to return json message
  • Need to rename /counter to /counters
  • Need to change GET to only return the counter
  • Need to implemtent POST to create new counters
  • Need to implement PUT to update multiple counters

Acceptance Criteria:

Given I have a multi-counter ability
When I create a counter named foo
And I update the counter named foo to 1
And I call the hit /counters/foo URL
Then I should see 1 returned from the service

Make the counter persistent

As a: User
I need: the hit counter to persist the last known count
So that: I don't loose track of the count after the service is restarted

Assumptions:

  • We will use Redis as the persistent store
  • A Redis image from Docker should be used

Tasks:

  • Need to update the Vagrantfile with Redis Docker image
  • Need to create a Model that uses Redis

Acceptance Criteria:

Given I have a persistent counter
When I advance the hit counter to 2
And I restart the hit counter service
And I call the hit /counter URL
Then I should see 3 returned from the service

Add Kubernetes support

As a: Service Provider
I need: the ability to deploy my service on Kubernetes
So that: I can easily scale it out horizontally as needed

Assumptions:

  • Need to create Kubernetes manifests
  • Need a to deploy a Redis database in Kubernetes

Tasks:

  • Create a deployment.yaml file for service
  • Create a service.yaml file for the service
  • Create a redis.yaml file to deploy Redis as a StatefulService

Acceptance Criteria:

Given I have my service in Kubernetes
When I ask Kubernetes to scale to 5 instance
Then I should have 5 instances of my service running

Setup Continuous Integration

As a: Developer
I need: the ability to continuously test my code
So that: I can know if a Pull Request has broken the build

Assumptions:

  • We will use Travis CI
  • Need to tell Travis CI that we need a Redis database

Acceptance Criteria:

Given I have set up Travis CI
When I make a Pull Request
Then my automated tests should run automatically
And if they fail the build will be stopped

Add a counter where each GET increments the counter

As a: User
I need: a way to register a hit on the counter
So that: it increments with every access

Assumptions:

  • Calling the GET /counter URl will increment the counter
  • No need for the counter to be persistent for now

Acceptance Criteria:

Given I have a counter
When I call the /counter URL
Then I should see the counter increment

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.