GithubHelp home page GithubHelp logo

isabella232 / stakater-devops-labs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stakater-archive/stakater-devops-labs

0.0 0.0 0.0 3.43 MB

The Lab for the DevOps Workshop with Kubernetes and Containers

Home Page: https://stakater.com/opensource

License: Apache License 2.0

JavaScript 18.55% Java 60.30% Groovy 3.34% CSS 1.20% HTML 12.09% Dockerfile 2.69% TSQL 1.82%

stakater-devops-labs's Introduction

Stakater-devops-labs

Overview

The Lab for the DevOps Workshop with Kubernetes and Containers.

Description

Nordmart is an online store web application built using Spring Boot, WildFly Swarm, Eclipse Vert.x, Node.js and AngularJS adopting the microservices architecture.

  • Web: A Node.js/Angular front-end. Details can be found on this link

  • API Gateway: vert.x service aggregates API calls to back-end services and provides a condenses REST API for front-end. Details can be found on this link

  • Catalog: Spring Boot service exposing REST API for the product catalog and product information. Details can be found on this link.

  • Inventory: WildFly Swarm service exposing REST API for product's inventory status. Details can be found on this link

  • Cart: Spring Boot service exposing REST API for shopping cart. Details can be found on this link

Architecture

The diagram given below shows architecture of the application.

                              +-------------+
                              |             |
                              |     Web     |
                              |             |
                              |   Node.js   |
                              |  AngularJS  |
                              +------+------+
                                     |
                                     v
                              +------+------+
                              |             |
                              | API Gateway |
                              |             |
                              |   Vert.x    |
                              |             |
                              +------+------+
                                     |
                 +---------+---------+-------------------+
                 v                   v                   v
          +------+------+     +------+------+     +------+------+
          |             |     |             |     |             |
          |   Catalog   |     |  Inventory  |     |     Cart    |
          |             |     |             |     |             |
          | Spring Boot |     |WildFly Swarm|     | Spring Boot |
          |             |     |             |     |             |
          +------+------+     +-------------+     +-------------+
                 |                                       |
                 v                                       v
          +------+------+                         +------+------+
          |             |                         |             |
          |    MySQL    |                         |    MySQL    |
          |             |                         |             |
          +-------------+                         +-------------+

Views

The app contains two main screens.

  • First one is the home screen which lists all the products. It fetches all the products from catalog and their available stock value from inventory and displays them. You can add an item to the cart using the respective Add To Cart button.

    home.png

  • Second is the cart screen which shows the items currently in your cost and their cost.

    cart.png

Monitoring

Dasbhoards given below can be used to monitor application by configuring them in Monitoring stack. If monitoring stack is not already configured use guidelines given in this link to configure it.

  • JVM metrics dashboard can be configured using this config.

    jvm.png

  • Catalog service metrics dashboard can be configured using this config.

    catalog-service.png

Deployment

Kubernetes

Pre Requisites

  • A working Kubernetes cluster.

  • A Jenkins server. You can run one locally by executing

    docker run -u root --rm -d -p 8080:8080 -p 50000:50000 -v jenkins-data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
  • Deploy Stakater Stacks(Global, Logging, Monitoring, Release, Tracing) by following this guide.

    Once the stacks are deployed and running you can use Forecastle, which is automatically installed by Global stack, to see all the apps installed in the cluster i.e forecastle.png

  • We already have separate repositories for the different microservices in the stakater-lab organization with the prefix stakater-nordmart-. Similarly there are other repositories for dev-tools, dev-apps and prod-apps which you will need. You can either use them for demo or fork your own repositories. To enable CI/CD for these apps, create a new pipeline by following the steps below

    • Go to New Item -> Github Organization and select git credentials from drop down and set owner to stakater-lab or the name of your organization.

    • Add following things in the projects section:

      • filter by name (with regular expression) and behaviour should be Repositories. with the following expression stakater-nordmart.* (if you follow the same naming convention as followed in stakater-lab)
      • Advance clone behaviours with default setting
    • In the Automatic branch project triggering section add this regular expression (PR-\d+|master).

    • Once all the configuration are done look at the Scan Organization log console to make sure that only pipeline for apps run and no other pipeline run.

GitOps - Dev Stack

In the dev stack, you can deploy using GitOps via flux. To install flux, run the dev-tools pipeline created above.

Once the pipeline is run, get the ssh key of flux by executing

kubectl -n nordmart-dev logs deployment/flux-nordmart-dev | grep identity.pub | cut -d '"' -f2

and add it to the dev-apps repository on github.

Flux will start watching the repository and will automatically apply any changes in the repository on the cluster. It will also keep a watch for new images and update the stack and repo when a new version of image becomes available.

So as soon as you push to master branch of an app e.g cart, Jenkins will push the image to nexus and flux will update the deployment automatically.

CI Ops - Prod Stack

In production stack, we use CI Ops so whenever you wish to update an app, go to prod-apps repository and update the docker image version of the respective app in the respective *-release file. When you create the pull request for this change, Jenkins will verify the change by executing dry-run functionality. If it succeeds then you can merge the pull request. Once this change gets merged to master branch Jenkins will re-run the pipeline and update the deployment in prod stack.

Acknowledgement

stakater-devops-labs's People

Contributors

aliartiza75 avatar rasheedamir avatar kahootali avatar stakater-user avatar usamaahmadkhan 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.