{"id":20381541,"url":"https://github.com/snowdrop/cache-example","last_synced_at":"2025-04-12T08:53:04.078Z","repository":{"id":44549027,"uuid":"116839892","full_name":"snowdrop/cache-example","owner":"snowdrop","description":"Spring Boot Cache Booster ","archived":false,"fork":false,"pushed_at":"2022-10-26T11:39:23.000Z","size":1271,"stargazers_count":3,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"sb-2.7.x","last_synced_at":"2025-04-12T08:52:59.466Z","etag":null,"topics":["booster","cache","data-grid","example","infinispan","kubernetes","openshift","spring-boot"],"latest_commit_sha":null,"homepage":"","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.adoc","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":"2018-01-09T16:18:44.000Z","updated_at":"2022-02-11T04:26:19.000Z","dependencies_parsed_at":"2022-08-12T11:20:23.664Z","dependency_job_id":null,"html_url":"https://github.com/snowdrop/cache-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%2Fcache-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcache-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcache-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fcache-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowdrop","download_url":"https://codeload.github.com/snowdrop/cache-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","cache","data-grid","example","infinispan","kubernetes","openshift","spring-boot"],"created_at":"2024-11-15T02:14:14.696Z","updated_at":"2025-04-12T08:53:04.059Z","avatar_url":"https://github.com/snowdrop.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Cache Spring Boot Example\n:toc: left\n\n== Purpose\n\nThe purpose of this use case is to demonstrate how to use Red Hat JBoss Data Grid for\nOpenshift as a  cache, to increase the response time of applications.\nThis mission covers:\n\n * The deployment of the Red Hat JBoss Data Grid on OpenShift\n * How applications leverage this cache service\n\n== Technical details\n\nThe boosters demonstrates how Spring's Caching support can interact with the JBoss Datagrid caching server.\nWhat that means practically, is that the business code simply uses Spring's `@Cacheable` to cache return values\n\n== Deploying and interacting with the example\n\n- Create a new OpenShift project `cache-example` (or whatever you want to call it):\n\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n$ oc new-project cache-example\n----\n\n- Deploy JBoss Datagrid to Openshift\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n$ oc apply -f .openshiftio/cache.yml\n----\n\n\n- Build and deploy the Spring Boot applications using Dekorate\n\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n$ mvn clean verify -pl greeting-service -Popenshift -Ddekorate.deploy=true\n$ mvn clean verify -pl cute-name-service -Popenshift -Ddekorate.deploy=true\n----\n\n- Open the UI of the `greeting-service`. The URL can be determined by executing\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n$ oc get route/spring-boot-cache-greeting --template={{.spec.host}}\n----\n\nFrom the UI the user can invoke the `greeting-service` which in turn invokes the JBoss Datagrid and perhaps the `name-service`\ndepending on the state of the cache\n\n- Execute the integration test using Dekorate to verify the behavior of the system\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n$ oc delete project cache-example --ignore-not-found=true\n$ oc new-project cache-example\n$ ./run_tests_with_dekorate_in_ocp.sh\n----\n\nAlternativelly, tests can be executed against a specific Spring Boot or Dekorate version by passing the\nversion as a `-D\u003cvariable property name\u003e=value` parameter. For instance overriding both the Spring Boot and the Dekorate versions using their corresponding version properties is done the following way:\n\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n./run_tests_with_dekorate_in_ocp.sh -Dspring-boot.version=2.7.3 -Ddekorate.version=2.11.1\n----\n\n- Execute the integration test using S2i to verify the behavior of the system\n[source,bash,options=\"nowrap\",subs=\"attributes+\"]\n----\n$ oc delete project cache-example --ignore-not-found=true\n$ oc new-project cache-example\n$ ./run_tests_with_s2i.sh \"https://github.com/snowdrop/cache-example\" sb-2.4.x\n----\n\n== Deploying application on OpenShift using Helm\n\nFirst, make sure you have installed the Helm command line and connected/logged to a kubernetes cluster.\n\nThen, you need to install the example by doing:\n\n[source,shell script]\n----\nhelm install cache ./helm --set cute-name-service.route.expose=true --set cute-name-service.s2i.source.repo=https://github.com/snowdrop/cache-example --set cute-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/cache-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/cache-example/branches/all`.\n\nAnd to uninstall the chart, execute:\n\n[source,shell script]\n----\nhelm uninstall cache\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[source,shell script]\n----\nhelm install cache ./helm -n \u003ck8s namespace\u003e --set cute-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[source,shell script]\n----\nhelm uninstall cache\n----\n\n== Running Tests on OpenShift using Dekorate:\n\n[source,shell script]\n----\nsh run_tests_with_dekorate_in_ocp.sh\n----\n\n== Running Tests on OpenShift using S2i from Source:\n\n[source,shell script]\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[source,shell script]\n----\n./run_tests_with_s2i.sh \"https://github.com/snowdrop/cache-example\" branch-to-test\n----\n\n== Running Tests on Kubernetes with External Registry:\n\n[source,shell script]\n----\nmvn clean verify -Pkubernetes,kubernetes-it -Ddekorate.docker.registry=\u003curl to your registry, example: quay.io\u003e -Ddekorate.push=true\n----\n\n== Running Tests on OpenShift using Helm\n\n[source,shell script]\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[source,shell script]\n----\n./run_tests_with_helm_in_ocp.sh \"https://github.com/snowdrop/cache-example\" branch-to-test\n----\n\n== Running Tests on Kubernetes using Helm\n\nFirst, you need to create the k8s namespace:\n\n[source,shell script]\n----\nkubectl create namespace \u003cthe k8s namespace\u003e\n----\n\nThen, run the tests by specifying the container registry and the kubernetes namespace:\n[source,shell script]\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[source,shell script]\n----\n./run_tests_with_helm_in_k8s.sh \"quay.io/user\" \"myNamespace\"\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowdrop%2Fcache-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowdrop%2Fcache-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowdrop%2Fcache-example/lists"}