Skip to content

shopKubernetesSpringboot/product

Repository files navigation

Getting Started

Description

Fully reactive Product REST API.

Also see the related projects:

Prerequisites

  • Enable annotation processors (in your IDE for lombok)

Architecture

  • Reactive Layers architecture (spring-framework reactor).
  • Java non-blocking functional programming: reactor+streams.
  • REST API's with Spring-WebFlux.
  • Persistence with reactive MongoDb.

Notes:

Run

Spring boot application

  • Run ShopProductApp as a spring-boot app:
    • command line: gradlew :bootRun
    • intellij: right button on ShopProductApp.java & Run...

With docker

#optional
docker system prune

#build & run image
#profile prod to exclude embedded mongo, also don't execute tests
./gradlew build -Pprofile=prod -x test
docker build -t techtests/shopproduct .
#run mongo & check connection
docker run -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password --name shop-mongo --network-alias shop-mongo mongo
mongo --host mongodb://localhost:27017
#get docker mongo ip
MONGO_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' shop-mongo)
# or docker inspect <containerId> | grep "IPAddress"
#run microservice
docker run -p 8081:8081 -e "SPRING_PROFILES_ACTIVE=prod" -e "MONGO_IP=$MONGO_IP" -t techtests/shopproduct

With kubernetes/minikube

Kubernetes

Compile, publish to docker and deploy to kubernetes

Product SpringBootApp

./publishToDocker.sh && bash -c '../kubernetes/publish.sh $0' product

Mongo container (preconfigured & with data preloaded)

cd mongo
./publishToDocker.sh && bash -c '../../kubernetes/publish.sh $0' mongo 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published