{"id":26092893,"url":"https://github.com/jazzshu/microservices","last_synced_at":"2026-05-08T13:19:21.826Z","repository":{"id":143113487,"uuid":"585595732","full_name":"jazzshu/microservices","owner":"jazzshu","description":"Microservices","archived":false,"fork":false,"pushed_at":"2023-01-17T14:29:45.000Z","size":156,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T11:57:37.889Z","etag":null,"topics":["cloud-config","cloud-gateway","elk-stack","eureka-server","logging","microservices","spring","spring-boot","spring-cloud"],"latest_commit_sha":null,"homepage":"","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/jazzshu.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":"2023-01-05T15:17:19.000Z","updated_at":"2023-01-17T14:33:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"dcfe8ddd-3ec8-4594-92f6-b652a6e7d162","html_url":"https://github.com/jazzshu/microservices","commit_stats":null,"previous_names":["jazzshu/microservices"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jazzshu/microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazzshu%2Fmicroservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazzshu%2Fmicroservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazzshu%2Fmicroservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazzshu%2Fmicroservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jazzshu","download_url":"https://codeload.github.com/jazzshu/microservices/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jazzshu%2Fmicroservices/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260232960,"owners_count":22978659,"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":["cloud-config","cloud-gateway","elk-stack","eureka-server","logging","microservices","spring","spring-boot","spring-cloud"],"created_at":"2025-03-09T11:10:20.949Z","updated_at":"2026-05-08T13:19:16.805Z","avatar_url":"https://github.com/jazzshu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microservice Architecture\n\nThis project show how to build and deploy a microservice-based project\n\nSpring 3, Java 17\n\n### ORDER-SERVICE / PAYMENT-SERVICE\nBasic Microservices with Controllers, Services, Entities nad Repositories.  \nThe database used is an in-memory database H2. \nThe Payment service and Order service runs on port 9191 and 9192 respectively.\n\nBoth of the services need to have an application.properties to add this particular property because it would not work as a yaml: \n```\nspring.config.import=configserver:http://localhost:9196\n```\n\n### SERVICE-REGISTRY\nThe Service Registry application is the place where the microservices need to be registered in order to communicate between one another.\nThis is possible thank to Spring Eureka. \nYou need to annotate the main class with @EnableEurekaServer and the microservices main class with @EnableDiscoveryClient.\nWith Spring 3 only version 2022.0.0 works.\nThe Service Registry runs on port 8761.\n\n### CLOUD-GATEWAY\nIt is like an orchestrator for the endpoints. You just hit the gateway endpoint, and it is able to redirect to the correct microservice based of the endpoint you are trying to hit. \nIt also needs to be annotated with @EnableDiscoveryClient as it is a microservice that needs to be registered on Eureka Server and needs the application.properties as well.\nWe create a Fallback Controller to tell the gateway what to do when one or more of the microservices are out, or broke. And we do that by using Resilience4j and adding the following to the application.yml\n```\nresilience4j:\n  circuitbreaker:\n    configs:\n      order-service:\n        failure-rate-threshold: 50\n        wait-duration-in-open-state: 30s\n      payment-service:\n        failure-rate-threshold: 50\n        wait-duration-in-open-state: 30s\n\n\nmanagement:\n  endpoints:\n    web:\n      exposure:\n        include: resilience4j.circuitbreakers.stream\n```\nThe Cloud-Gateway service runs on port 8989. Basically all of your endpoints should point to this port, it is then the gateways job to redirect to the correct microservice at the correct location and port.\n\n### CLOUD-CONFIG-SERVER\nIt is used to centralize all of the common properties of the microservices in a single place. In this case, this cloud-config-server is fetching the properties from a GitHub repository (https://github.com/JasonShuyinta/cloud-config-server). In this way you don't need to repeat yourself. \nThis as well needs to be annotated with @EnableDiscoveryClient and also @EnableConfigServer to let know Spring this is a configuration service.\nThe Cloud-Config-Server runs on port 9196.\n\n### ELK Stack\nTo store and visualize logs of the microservices, the ELK (ElasticSearch, LogStash, Kibana) Stack was used, specifically version 8.6.0.\nAfter you download and unzip all the softwares, there are some files to modify to adapt them to your system:\n- in elastisearch-8.6.0/config/elasticsearch.yml you should uncomment path.data and path.logs and make them correspond to the actual data and logs folder on your file system.\n- in the same file you need to disable the SSL security which by default is disabled: everywhere where there is \"enabled: true\" set it to false. For development purposes this is perfectly ok.\n- in kibana-8.6.0/config/kibana.yml you need to uncomment where it says elasticsearch.hosts: [\"http://localhost:9200\"]\n- in logastash-8.6.0 you need to add a logstash.conf file with the following content: \n\n```\ninput {\n  file {\n    path =\u003e \"path/to/your/log/file.log\"\n  }\n}\n\noutput {\n  elasticsearch {\n    hosts =\u003e [\"localhost:9200\"]\n    index =\u003e \"index_name-%{+YYYY.MM.dd}\"\n  }\n}\n```\n- To start the logstash bat you need to enter the command \n```\n.\\logstash.bat -f logstash.conf\n```\n\nDefault Ports\n- ElasticSearch: 9200\n- Kibana: 5601\n\n### Docker\nTo Dockerize this microservice architecture, you need remove the instance hostname from the application.yml because the dockerized service already knows its hostname. \nPlus we extrapolated the cloud-config server and hardcoded the properties for now. So at the moment the dockerized services are service-registry, payment-service, order-service and the cloud-gateway. \n\nTo boot up everything we used docker-compose instead of single handedly booting up each and every server. \nObviously to do so you need a Dockerfile in each and every service. In this Dockerfiles we simply downloaded Java 17 and copied the jar from the target file after we maven clean-installed the service. \n\nLibraries:\n\n- spring-cloud-starter-actuator\n- spring-cloud-starter-gateway\n- spring-cloud-starter-netflix-eureka-client\n- spring-cloud-starter-netflix-eureka-server\n- resilience4j\n- spring-cloud-starter-config\n- spring-boot-starter-data-jpa\n- spring-boot-starter-web\n- spring-cloud-config-server\n\nThis project was made following the steps of https://www.youtube.com/@Javatechie and with some small changes adapting it to 2023 and it is purely for personal learning purposes. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjazzshu%2Fmicroservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjazzshu%2Fmicroservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjazzshu%2Fmicroservices/lists"}