{"id":20381543,"url":"https://github.com/snowdrop/circuit-breaker-example","last_synced_at":"2025-04-12T08:53:03.954Z","repository":{"id":38251439,"uuid":"93411082","full_name":"snowdrop/circuit-breaker-example","owner":"snowdrop","description":"Spring Boot Circuit Breaker Booster","archived":false,"fork":false,"pushed_at":"2022-10-19T12:34:47.000Z","size":1336,"stargazers_count":2,"open_issues_count":2,"forks_count":11,"subscribers_count":5,"default_branch":"sb-2.7.x","last_synced_at":"2025-04-12T08:52:58.318Z","etag":null,"topics":["booster","circuit-breaker","example","kubernetes","openshift","rhoar","spring-boot"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snowdrop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-05T14:13:24.000Z","updated_at":"2022-02-11T04:26:15.000Z","dependencies_parsed_at":"2023-01-19T14:45:16.513Z","dependency_job_id":null,"html_url":"https://github.com/snowdrop/circuit-breaker-example","commit_stats":null,"previous_names":[],"tags_count":100,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcircuit-breaker-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcircuit-breaker-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcircuit-breaker-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcircuit-breaker-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowdrop","download_url":"https://codeload.github.com/snowdrop/circuit-breaker-example/tar.gz/refs/heads/sb-2.7.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543882,"owners_count":21121838,"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":["booster","circuit-breaker","example","kubernetes","openshift","rhoar","spring-boot"],"created_at":"2024-11-15T02:14:14.864Z","updated_at":"2025-04-12T08:53:03.933Z","avatar_url":"https://github.com/snowdrop.png","language":"Java","readme":"# Circuit Breaker Spring Boot Example\n\n## Table of Contents\n\n* [Circuit Breaker Spring Boot Example](#circuit-breaker-spring-boot-example)\n    * [Introduction](#introduction)\n    * [Deploying application on OpenShift using Dekorate](#deploying-application-on-openshift-using-dekorate)\n    * [Deploying application on OpenShift using Helm](#deploying-application-on-openshift-using-helm)\n    * [Deploying application on Kubernetes using Helm](#deploying-application-on-kubernetes-using-helm)\n    * [Running Tests on OpenShift using Dekorate](#running-tests-on-openshift-using-dekorate)\n    * [Running Tests on OpenShift using S2i from Source](#running-tests-on-openshift-using-s2i-from-source)\n    * [Running Tests on OpenShift using Helm](#running-tests-on-openshift-using-helm)\n    * [Running Tests on Kubernetes with Helm](#running-tests-on-kubernetes-using-helm)\n    * [Test the service](#test-the-service)\n        * [Maven Test](#maven-test)\n        * [Manual Test](#manual-test)\n\n## Introduction\n\nhttps://appdev.openshift.io/docs/spring-boot-runtime.html#mission-circuit-breaker-spring-boot\n\n## Deploying application on OpenShift using Dekorate\n\n- For the Greeting Service:\n```\n./mvnw clean verify -pl greeting-service -Popenshift -Ddekorate.deploy=true\n```\n\n- For the Name Service:\n```\n./mvnw clean verify -pl name-service -Popenshift -Ddekorate.deploy=true\n```\n\n## Deploying application on OpenShift using Helm\n\nFirst, make sure you have installed [the Helm command line](https://helm.sh/docs/intro/install/) and connected/logged to a kubernetes cluster.\n\nThen, you need to install the example by doing:\n\n```\nhelm install circuit-breaker ./helm --set name-service.route.expose=true --set name-service.s2i.source.repo=https://github.com/snowdrop/circuit-breaker-example --set name-service.s2i.source.ref=\u003cbranch-to-use\u003e --set greeting-service.route.expose=true --set greeting-service.s2i.source.repo=https://github.com/snowdrop/circuit-breaker-example --set greeting-service.s2i.source.ref=\u003cbranch-to-use\u003e\n```\n\n**note**: Replace `\u003cbranch-to-use\u003e` with one branch from `https://github.com/snowdrop/circuit-breaker-example/branches/all`.\n\nAnd to uninstall the chart, execute:\n\n```\nhelm uninstall circuit-breaker\n```\n\n## Deploying application on Kubernetes using Helm\n\nRequirements:\n- Have installed [the Helm command line](https://helm.sh/docs/intro/install/)\n- Have connected/logged to a kubernetes cluster\n\nYou need to install the example by doing:\n\n```\nhelm install circuit-breaker ./helm -n \u003ck8s namespace\u003e --set name-service.ingress.host=\u003cyour k8s domain\u003e --set greeting-service.ingress.host=\u003cyour k8s domain\u003e\n```\n\nAnd to uninstall the chart, execute:\n\n```\nhelm uninstall circuit-breaker\n```\n\n## Running Tests on OpenShift using Dekorate\n\n```\n./run_tests_with_dekorate_in_ocp.sh\n```\n\n## Running Tests on OpenShift using S2i from Source\n\n```\n./run_tests_with_s2i.sh\n```\n\nThis script can take 2 parameters referring to the repository and the branch to use to source the images from.\n\n```bash\n./run_tests_with_s2i.sh \"https://github.com/snowdrop/circuit-breaker-example\" branch-to-test\n```\n\n## Running Tests on OpenShift using Helm\n\n```\n./run_tests_with_helm_in_ocp.sh\n```\n\nThis script can take 2 parameters referring to the repository and the branch to use to source the images from.\n\n```bash\n./run_tests_with_helm_in_ocp.sh \"https://github.com/snowdrop/circuit-breaker-example\" branch-to-test\n```\n\n## Running Tests on Kubernetes using Helm\n\nFirst, you need to create the k8s namespace:\n\n```\nkubectl create namespace \u003cthe k8s namespace\u003e\n```\n\nThen, run the tests by specifying the container registry and the kubernetes namespace:\n```\n./run_tests_with_helm_in_k8s.sh \u003cyour container registry: for example \"quay.io/user\"\u003e \u003cthe k8s namespace\u003e\n```\n\nFor example:\n\n```\n./run_tests_with_helm_in_k8s.sh \"quay.io/user\" \"myNamespace\"\n```\n\n## Test the service\n\n### Maven Test\nThis service can be tested using the following Maven task.\n\n```shell\n$ mvn clean verify\n```\n\n### Manual Test\n\n```shell\n$ oc get route\nNAME                                   HOST/PORT                                                                                                                                      PATH   SERVICES                               PORT   TERMINATION   WILDCARD\ngreeting                               greeting-circuit-breaker.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance                                      greeting                               8080                 None\nspring-boot-circuit-breaker-greeting   spring-boot-circuit-breaker-greeting-circuit-breaker.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance          spring-boot-circuit-breaker-greeting   8080                 None\nspring-boot-circuit-breaker-name       spring-boot-circuit-breaker-name-circuit-breaker.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance              spring-boot-circuit-breaker-name       8080                 None\n```\n\nCheck the name-service state.\n\n```shell\n$ curl http://spring-boot-circuit-breaker-name-default.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/info\n{\"state\":\"ok\"}\n```\n\nCall the name-service name service on OK state.\n\n```shell\n$ curl http://spring-boot-circuit-breaker-name-default.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/name\nWorld\n```\n\nSet the service status to FAIL using GET.\n\n```shell\n$ curl \"http://spring-boot-circuit-breaker-name-default.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/state?state=fail\"\n{\"state\":\"fail\"}\n```\n\nCall the name-service name service on fail state.\n\n```shell\n$ curl -v http://spring-boot-circuit-breaker-name-default.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/name\n...\n\u003c HTTP/1.1 500\n...\nName service down\n```\n\nSet the service status to OK using PUT.\n\n```shell\n$ curl -X PUT -H \"Content-Type: application/json\" --data '{\"state\":\"ok\"}' \"http://spring-boot-circuit-breaker-name-default.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/state\"\n{\"state\":\"ok\"}\n```\n\nCall the greeting service having the name service OK.\n\n```shell\n$ curl -X PUT -H \"Content-Type: application/json\" --data '{\"state\":\"ok\"}' \"http://greeting-circuit-breaker.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/state\"\n{\"content\":\"Hello, World!\"}\n```\n\nSet the service status to FAIL using PUT.\n\n```shell\n$ curl -X PUT -H \"Content-Type: application/json\" --data '{\"state\":\"fail\"}' \"http://spring-boot-circuit-breaker-name-default.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/state\"\n{\"state\":\"fail\"}\n```\n\nCall the greeting service having the name service OK.\n\n```shell\n$ curl -X PUT -H \"Content-Type: application/json\" --data '{\"state\":\"ok\"}' \"http://greeting-circuit-breaker.snowdrop-ocp-470-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000.my.openshift.instance/api/state\"\n{\"content\":\"Hello, Fallback!\"}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowdrop%2Fcircuit-breaker-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowdrop%2Fcircuit-breaker-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowdrop%2Fcircuit-breaker-example/lists"}