Giter Club home page Giter Club logo

spring-nginx-dns's Introduction

Repository Summary

  • Docker
  • Docker Compose
  • Microservices-architecture (Spring Boot - Java Framework)
  • Microservices Communication using Feign client as REST client
  • H2 In-Memory Database (one service one H2 In-Memory Database)
  • Platform-Provided Service Discovery (Deployment infrastructure take care of service discovery)
  • Service-discovery (Docker-DNS)
  • API-gateway (NGINX)
  • Using NGINX in the backend as a reverse proxy
  • Shell Scripting

Microservices Demo

Restaurant application implemented in spring boot framework. NGINX is used as API Gateway and Docker DNS service as service discovery.

In order to set up infrastructure run the following command:

docker-compose up --build

Application testing is available via web_requests.sh script.

web_requests.sh

In order to destroy infrastructure run the following command:

docker-compose down -v

spring-nginx-dns Instructions

Start Docker Daemon: If you're using Docker for Windows, Then simply start the desktop app installed in:

C:\Program Files\Docker\Docker\Docker Desktop.exe

Position yourself using Git Bash in the folder where docker-compose.yml file is:

cd DOCKER-COMPOSE_FILE_PATH

Mapping environment variables from the environment file to the docker-compose.yml file (Check how your docker-compose.yml will finally look like, after environment variables substitution)

docker-compose --env-file .env config

To set up infrastructure run the following command in Git Bash:

docker-compose up --build

Docker-compose services/containers listing (one service one container)

docker-compose ps
docker ps

Request: GET http://localhost:8080/api/consumer/hello

http://localhost:8080/api/consumer/hello

Response:

Hello from consumer service with ip address 172.18.0.3!

Request: GET http://localhost:8080/api/kitchen/hello

http://localhost:8080/api/kitchen/hello

Response:

Hello from kitchen service with ip address 172.18.0.4!

Request: GET http://localhost:8080/api/order/hello

http://localhost:8080/api/order/hello

Response:

Hello from order service with ip address 172.18.0.2!

Fill H2 In-Memory Database with data using shell script. Run the following command in Git Bash

./web_requests.sh

Request: GET http://localhost:8080/api/consumer/verify/1

http://localhost:8080/api/consumer/verify/1

Response:

true

Check if data is added to H2 In-Memory Database using the H2 dashboard

Consumer-Service H2 In-Memory Database

http://localhost:9000/h2-console
JDBC URL:jdbc:h2:mem:myDb → paste jdbc:h2:mem:myDb  → Test Connection  → Connect → Click CONSUMER table → Run

Order-Service H2 In-Memory Database

http://localhost:9001/h2-console
JDBC URL:jdbc:h2:mem:myDb → paste jdbc:h2:mem:myDb  → Test Connection  → Connect → Click ORDER table → Run

Kitchen-Service H2 In-Memory Database

http://localhost:9002/h2-console
JDBC URL:jdbc:h2:mem:myDb → paste jdbc:h2:mem:myDb  → Test Connection  → Connect → Click TICKET table → Run

To destroy infrastructure run the following command in Git Bash:

docker-compose down -v

spring-nginx-dns's People

Contributors

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