to create microservices faster, you need a backbone. This boilerplate prepared to practise core microservice concepts like:
- cloud-native (stateless on K8s)
- cloud-native (state-full on GCP PaaS)
- REST maturity: L2 and L3 (HATEOS)
- naming conventions
- actuator (/health)
- error-handling
- logging: general {Slf4j}
- logging: distributed-tracing {sleuth}
- logging: monitoring
- api-management: message-converter (such as text2json and vice versa)
- security
- profiles (dev, test, prod)
- logical boundaries (separating dbs)
- 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)
- Requirements (openjdk 11, docker, GKE)
- spring boot 2.2.6, gradle 6.3, Lombok 1.18
-
project name for template
- intellij top-level: core-service-h2
- package name: com.backbone.core
-
project name for a real service will take place below!
- intellij top-level: product-service
- package name: com.backbone.core
- gradle's project name: product-service
- jar name: build/libs/product-service-0.0.1-SNAPSHOT.jar
- deployment name in k8s: product-service
- url format: /product/1 or /products
on IDE,
mkdir microservice-backbone-boilerplate && cd microservice-backbone-boilerplate
thengit clone https://github.com/tansudasli/core-service-h2.git && cd core-service-h2
- to Run the application
./gradlew bootRun
to start,./gradlew bootJar
to create jar lib, and run w/java -jar build/libs/*.jar
- to test run
curl localhost:8080
curl localhost:8080/dummy
orcurl localhost:8080/dummy/name
curl localhost:8080/products
orcurl localhost:8080/products/10
- to access h2-db check
localhost:8080/h2-console
w/ conn.jdbc:h2:mem:products
on Kubernetes,
- Create GKE cluster
mkdir microservice-backbone-boilerplate && cd microservice-backbone-boilerplate
then Follow the steps inReadme.md
.
- Prepare and deploy docker images to GCP
- Edit
gradle.properties
- Run
./gradlew dockerTag
. Test w/docker images
thendocker run -d -p 8080:8080 IMAGE_NAME:TAG
- Run
./gradlew dockerPushGCP
- Edit
- Deploy app. to GKE cluster.
- Run
./deploy.sh
to deploy w/ .yaml files - to test, run
kubectl get services
and get EXTERNAL-IP thencurl EXTERNAL-IP:8080
to test.
- Run
an abstract representation of a micro service
a more realistic scenario w/ data pipelines