Giter Club home page Giter Club logo

cloud-native-applications-with-microservices-architectures-red-hat-do092's Introduction

Cloud-Native Applications with Microservices Architectures | Red Hat DO092

This are my notes about the course Developing Cloud-Native Applications with Microservices Architectures. By Burr Sutter, developer advocate from Red Hat.

How to combine different frameworks and tools into a microservices architecture that fits your organizational needs.

The source files are in: https://github.com/burrsutter/kube4docker

1 - Microservices Overview: What and Why?

Your Jorney to Microservices

  1. Re-org to DevOps
  2. Self-service, on demand, elastic, infra as code
  3. Automation puppet, chef, ansible and/or kubernets
  4. Continuous integration & Continuous delivery Deployment pipeline
  5. Advanced deplyment techniques (blue/green deployment or canary deployment) *) be like Super Cool Silicon Valley DotCom Startup \o/

https://martinfowler.com/bliki/MicroservicePrerequisites.html

If you're not mature enough, and you're not big enough, and you not skilled enough, you probably don't want to get the microservices ride. |_ How many days/weeks to provision a new VM? |_ Who is on the pager for production app outage? |_ Who is the own of the application? The person who architect and created it? |_ phoenix vs snowflake?

Books to read:

  • The Phoenix project
  • Refactoring databases - Livro por Scott W. Ambler
  • Migrating to Microservice databases - Edson Yanaga

Microservice Principles/Characteristics

  1. Deployment Independence - updates to an individual microservice have no negative impact to any other component of the system. Optimzes for replacement;
  2. Organized around business capabilities
  3. Products not projects
  4. API Focused
  5. Smart endpoints and dumb pipes
  6. Decentralized Governance
  7. Decentralized Data Management (for example each team choose your db)
  8. Infrastructure Automation (infra as code)
  9. Design for failure
  10. Evolutionary Design @burrsutter

2 - API: Building and Deploying a Microservice (and demonstration)

The easiest part is make a API. The other things are complex.

Hot Tip: Fabric8 Maven Plugin. For instrumenting your spring boot, wf swarm, vert.x or java ee project's pom.xml. Hot Tip 2: go to https://start.spring.io/ and just add web dependencies

Main commands

  • mvn clean compile package

  • docker build -t burr/myvertex:v1 .

  • docker run -it -p 8080:8080 burr/myvertex:v1

  • curl http://192.168.99.101:8080/hello

  • kubectl get namespaces

  • kubectl create -f ./kubedemo-namespace.yaml

  • kubectl --namespace=kubedemo create -f kubedemo-deployment.yaml --record --validate=false

  • kubectl get pods --namespace=kubedemo

  • kubectl --namespace=kubedemo expose deployment --port=8080 myvertx --type=LoadBalancer

  • kubectl --namespace=kubedemo scale deployment myvertx --replicas=3

update

  • docker build -t burr/myvertx:v2 .
  • kubectl --namespace=kubedemo set image deployment/myvertx myvertx=burr/myvertx:v2

others

show history

  • kubectl --namespace=kubedemo rollout history deployment myvertx

undo

  • kubectl --namespace=kubedemo rollout undo deployment/myvertx

run spring

  • mvn spring-boot:run

configure fabricate

  • mvn io.fabric8-maven-plugin:3.3.5:setup

deploy fabricate

  • mvn fabric8:deploy

3- Discovery & Invocation

How does Service A find and then invoke service B??

It's possible use NetFlixOSS Eureka and Ribbon.

When you are inside the cluster, just refer to it by its service name.

For exemple: producer -> http://producer:8080/

String url = "http://producer:8080/";
ResponseEntity<String> response  = restTemplate.getForEntity(url, String.class);
System.out.println(response.getBody());

4 - Microservices Patterns (and demonstration)

With microservices you always have to think about failure.

When a failure ocours, you need think in the fallback scenario.

API Gateway

Agregate the businics logic on the server-side, also reducing network traffic to the client.

Chaining

The requests will be deep. It means to call A, B, C and D. On fail happens a cascading fail.

Mixed

The requests will be assincronous/sincronous.

5 - Circuit Breakers (and demonstration)

Netflix OSS gave us a specific circuit breaker and bulkhead implementation called Hystrix.

6 - Circuit Breakers (and demonstration)

Netflix OSS gave us a specific circuit breaker and bulkhead implementation called Hystrix.

7 - Pipelines

For pipelines it's possible use jenkins. Also (by me) spinnaker.

8 - Security

You can use SSO and KeyCloak

https://developers.redhat.com/blog/2017/05/25/easily-secure-your-spring-boot-applications-with-keycloak/

https://github.com/sebastienblanc/spring-boot-keycloak-tutorial

9 - Logging, Monitoring and Tracing

Logging:

  • ElasticSearch - an object store where all logs are stored
  • Fluentd - Gather logs from Nodes and feeds them to Elastic
  • Kibana - A web UI for Elastic

Monitoring:

  • Heapster, hawkular, Cassandra

Tracing: jaegertracing or opentracing.io

10 - Blue/Green Deployment

When you are using Blue/Green we have two production enviroment. The green one is the main, and the blue is a new version. If the things break, both are up and the roolback it's fast.

11 - Canary

On this deployment, we send a tiny fraction of the user audience to a specific build.

12 - Moving from Monolith to Microservices

https://martinfowler.com/bliki/MonolithFirst.html

https://www.martinfowler.com/bliki/StranglerApplication.html

ff4j

cloud-native-applications-with-microservices-architectures-red-hat-do092's People

Contributors

verissimor 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.