Code Monkey home page Code Monkey logo

review-service-h2's Introduction

review-service-h2

to create microservices faster, you need a backbone. This boilerplate prepared to practise core microservice concepts like:

  • cloud-native
    • stateless on K8s
    • state-full on GCP PaaS (not on K8s)
  • REST maturity (L2)
  • naming conventions
  • actuator (/health)
  • error-handling
  • logging
    • general {Slf4j}
    • message format standardization
    • distributed-tracing {sleuth}
    • monitoring
  • api-management
    • message-converter (such as text2json and vice versa)
  • security
  • profiles (dev, test, prod)
  • logical boundaries (separating dbs)
  • caching
    • L2 {JCache | Ehcache}
  • rest-template {Feign}
  • api-gateway {zuul}
  • load-balancing {ribbon}
  • fallbacks {hystrix}
  • config-server {spring}
  • service-discovery {eureka}
  • event-sourcing
  • CQRS (separate read and write queries)

Technology stack

  • Requirements (openjdk 11, docker, k8s)
  • spring boot 2.4.x, gradle 6.7, Lombok 1.18, log4j 2.x, Ehcache 3.x, junit 5.x

Naming Conventions

  • project name for a real service will take place below!
    • intellij top-level: review-service
    • package name: com.backbone.core
    • gradle's project name: review-service
      • jar name: build/libs/review-service-0.0.1-SNAPSHOT.jar
    • deployment name in k8s: review-service
    • url format: /review/1 or /reviews

OOP Architecture

  • Review ... as Entity
  • ReviewRepository
    • ReviewService (as JPA cache layer or call APIs)
      • ReviewController (as REST APIs)

How To Start

on IDE,

  1. mkdir microservice-backbone-boilerplate && cd microservice-backbone-boilerplate then
    • git clone https://github.com/tansudasli/review-service-h2.git && cd review-service-h2
  2. to Run the application
    • ./gradlew wrapper to download necessary wrappers. Then
    • ./gradlew bootRun to start,
    • ./gradlew bootJar to create jar lib, and run w/ java -jar build/libs/*.jar
  3. to test run curl localhost:8080
    • curl localhost:8080/dummy or curl localhost:8080/dummy/name
    • curl localhost:8080/reviews or curl localhost:8080/reviews/10
  4. to access h2-db check localhost:8080/h2 w/ conn. jdbc:h2:mem:reviews


on Kubernetes,

  1. Create GKE cluster by following in Readme.md.
  2. Prepare and deploy docker images to GCP
    • Edit gradle.properties
    • Run ./gradlew dockerTag. Test w/
      • docker images then docker run -d -p 8080:8080 IMAGE_NAME:TAG
    • Run ./gradlew dockerPushGCP
  3. Deploy app. to GKE cluster.
    • Run ./deploy.sh to deploy w/ .yaml files
    • to test, run kubectl get services and get EXTERNAL-IP then curl EXTERNAL-IP:8080 to test.

High Level Architecture -

an abstract representation of a micro service

Image

a more realistic scenario w/ data pipelines

Image

review-service-h2's People

Contributors

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