Git Product home page Git Product logo

sample-spring-cloud-consul's Introduction

Microservices With Spring Cloud Consul Demo Project Twitter

CircleCI

SonarCloud Bugs Coverage Lines of Code

In this project I'm demonstrating you how to use Hashicorp's Consul as a discovery and configuration server with Spring Cloud Consul and other Spring Cloud projects for building microservice-based architecture.

Getting Started

  1. To build and run sample applications you need to have Maven, JDK11+ and Docker. However, the simplest way to start with it is through any IDE like Intellij or Eclipse.
  2. First, you have to run Consul on Docker container
$ docker run -d --name consul-1 -p 8500:8500 -e CONSUL_BIND_INTERFACE=eth0 consul
  1. Then you can compile your application with Maven mvn clean install command and using java -jar ... command. Or you can just build it and run using your IDE. Each application is listeting on dynamically generated port.

Architecture

Our sample microservices-based system consists of the following modules:

  • gateway-service - a module that uses Spring Cloud Gateway for running Spring Boot application that acts as a proxy/gateway in our architecture.
  • account-service - a module containing the first of our sample microservices that allows to perform CRUD operation on in-memory repository of accounts
  • customer-service - a module containing the second of our sample microservices that allows to perform CRUD operation on in-memory repository of customers. It communicates with account-service.
  • product-service - a module containing the third of our sample microservices that allows to perform CRUD operation on in-memory repository of products.
  • order-service - a module containing the fourth of our sample microservices that allows to perform CRUD operation on in-memory repository of orders. It communicates with all other microservices.

The following picture illustrates the architecture described above.


When running sample applications we can test more advanced scenario. We may leverage Zone Affinity mechanism to prefer communication inside a single zone. We can also start a cluster of Consul modes started locally on Docker containers. Here's the picture illustrating such an architecture:


Description

Detailed description can be found here: Microservices with Spring Boot, Spring Cloud Gateway and Consul Cluster

sample-spring-cloud-consul's People

Contributors

piomin avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sample-spring-cloud-consul's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.


Warning

Renovate failed to look up the following dependencies: Failed to look up maven package pl.piomin.services:sample-spring-cloud-consul.

Files affected: account-service/pom.xml, customer-service/pom.xml, gateway-service/pom.xml, order-service/pom.xml, product-service/pom.xml


This repository currently has no open or pending branches.

Detected dependencies

circleci
.circleci/config.yml
  • cimg/openjdk 21.0.2
  • maven 1.4.1
maven
account-service/pom.xml
  • pl.piomin.services:sample-spring-cloud-consul 1.1
  • net.logstash.logback:logstash-logback-encoder 7.4
  • org.testcontainers:junit-jupiter 1.19.8
  • org.testcontainers:consul 1.19.8
customer-service/pom.xml
  • pl.piomin.services:sample-spring-cloud-consul 1.1
  • net.logstash.logback:logstash-logback-encoder 7.4
  • org.testcontainers:junit-jupiter 1.19.8
  • org.testcontainers:consul 1.19.8
  • io.specto:hoverfly-java-junit5 0.18.1
gateway-service/pom.xml
  • pl.piomin.services:sample-spring-cloud-consul 1.1
  • org.testcontainers:junit-jupiter 1.19.8
  • org.testcontainers:consul 1.19.8
order-service/pom.xml
  • pl.piomin.services:sample-spring-cloud-consul 1.1
  • net.logstash.logback:logstash-logback-encoder 7.4
  • org.testcontainers:junit-jupiter 1.19.8
  • org.testcontainers:consul 1.19.8
  • io.specto:hoverfly-java-junit5 0.18.1
pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.2.5
  • org.springframework.cloud:spring-cloud-dependencies 2023.0.1
product-service/pom.xml
  • pl.piomin.services:sample-spring-cloud-consul 1.1
  • net.logstash.logback:logstash-logback-encoder 7.4
  • org.testcontainers:junit-jupiter 1.19.8
  • org.testcontainers:consul 1.19.8

  • Check this box to trigger a request for Renovate to run again on this repository

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.