{"id":16119686,"url":"https://github.com/piomin/sample-spring-cloud-consul","last_synced_at":"2025-04-06T08:15:22.953Z","repository":{"id":65084850,"uuid":"116064241","full_name":"piomin/sample-spring-cloud-consul","owner":"piomin","description":"Spring Boot applications/microservices demo using Consul discovery \u0026 config ","archived":false,"fork":false,"pushed_at":"2025-03-21T10:31:41.000Z","size":142,"stargazers_count":62,"open_issues_count":2,"forks_count":48,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T07:11:12.211Z","etag":null,"topics":["consul","consul-kv-store","microservices","spring-boot","spring-cloud","spring-cloud-consul","spring-cloud-gateway"],"latest_commit_sha":null,"homepage":"https://piotrminkowski.com/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piomin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-02T22:35:59.000Z","updated_at":"2025-03-21T10:31:44.000Z","dependencies_parsed_at":"2023-01-11T21:38:43.431Z","dependency_job_id":"f8035e82-c9f2-49ba-8c8a-26584e516df9","html_url":"https://github.com/piomin/sample-spring-cloud-consul","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-cloud-consul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-cloud-consul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-cloud-consul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-cloud-consul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piomin","download_url":"https://codeload.github.com/piomin/sample-spring-cloud-consul/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451667,"owners_count":20940944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consul","consul-kv-store","microservices","spring-boot","spring-cloud","spring-cloud-consul","spring-cloud-gateway"],"created_at":"2024-10-09T20:54:47.727Z","updated_at":"2025-04-06T08:15:22.929Z","avatar_url":"https://github.com/piomin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microservices With Spring Cloud Consul Demo Project [![Twitter](https://img.shields.io/twitter/follow/piotr_minkowski.svg?style=social\u0026logo=twitter\u0026label=Follow%20Me)](https://twitter.com/piotr_minkowski)\n\n[![CircleCI](https://circleci.com/gh/piomin/sample-spring-cloud-consul.svg?style=svg)](https://circleci.com/gh/piomin/sample-spring-cloud-consul)\n\n[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-black.svg)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-cloud-consul)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-spring-cloud-consul\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-cloud-consul)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-spring-cloud-consul\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-cloud-consul)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-spring-cloud-consul\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=piomin_sample-spring-cloud-consul)\n\nIn this project I'm demonstrating you how to use Hashicorp's **Consul** as a discovery and configuration server with [Spring Cloud Consul](https://spring.io/projects/spring-cloud-consul) and other Spring Cloud projects for building microservice-based architecture.\n\n## Getting Started\n1. 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.\n2. First, you have to run Consul on Docker container\n```\n$ docker run -d --name consul-1 -p 8500:8500 -e CONSUL_BIND_INTERFACE=eth0 consul\n```\n3. 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.\n\n## Architecture\nOur sample microservices-based system consists of the following modules:\n- **gateway-service** - a module that uses Spring Cloud Gateway for running Spring Boot application that acts as a proxy/gateway in our architecture.\n- **account-service** -  a module containing the first of our sample microservices that allows to perform CRUD operation on in-memory repository of accounts\n- **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.\n- **product-service** - a module containing the third of our sample microservices that allows to perform CRUD operation on in-memory repository of products.\n- **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.\n\nThe following picture illustrates the architecture described above.\n\n\u003cimg src=\"https://piotrminkowski.files.wordpress.com/2019/11/microservices-consul-1-1.png\" title=\"Architecture\"\u003e\u003cbr/\u003e\n\nWhen 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:\n\n\u003cimg src=\"https://piotrminkowski.files.wordpress.com/2019/11/microservices-consul-2.png\" title=\"Architecture\"\u003e\u003cbr/\u003e\n\n## Description\nDetailed description can be found here: [Microservices with Spring Boot, Spring Cloud Gateway and Consul Cluster](https://piotrminkowski.com/2019/11/06/microservices-with-spring-boot-spring-cloud-gateway-and-consul-cluster/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fsample-spring-cloud-consul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiomin%2Fsample-spring-cloud-consul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fsample-spring-cloud-consul/lists"}