0

I am setting up the Spring-boot microservices with the cluster bi-direction Pivotal cloud cache.

I have set up the bi-directional cluster in Pivotal Cloud, I have a list of locators with ports. I have already some online docs. https://github.com/pivotal-cf/PCC-Sample-App-PizzaStore

But couldn't understand the on which configuration the spring boot app will know to connect.

I am looking for some tutorial or some reference where I can have spring boot app linked up with the PCC(gemfire)

freaksterz
  • 83
  • 3
  • 9

2 Answers2

3

When you deploy an application in Cloud Foundry, (or Pivotal Cloud), you need to bind it to one or more services. Service details are then automatically exposed to the app via the VCAP_SERVICES environment variable. In the case of PCC this will include the name and port of the locator. By adding the spring-geode-starter (or spring-gemfire-starter) jar to the application it will automatically process the VCAP_SERVICES value and extract the necessary endpoint information in order to connect to the cluster.

Furthermore, if security is enabled on your PCC instance, you will also need to have created a service key. As with the locator details, the necessary credentials will be exposed via VCAP_SERVICES and the starter jar will automatically process and configure them.

Jens D
  • 4,229
  • 3
  • 16
  • 19
3

The way you configure a app running in PCF (Pivotal Cloud Foundry) to talk to a PCC (Pivotal Cloud Cache) service instance is by binding the app to that service instance. You can bind it either by running the cf bind command or by adding the service name in the app`s manifest.yml, something like the below

  path: build/libs/cloudcache-pizza-store-1.0.0-SNAPSHOT.jar
  services:
    - dev-service-instance

I hope you are using Spring Boot for Apache Geode & Pivotal GemFire (SBDG) in your app, if not I recommend you to use it as it makes connecting to PCC service instance extremely easy. SBDG has the logic to extract credentials, hostname:ports needed to connect to a service instance.

You as a app developer just need to

  • Create the service instance.
  • Bind your app to the service instance.

The boilerplate code for configuring credentials, hostnames, ips are handled by SBDG.

srikanth
  • 1,211
  • 2
  • 9
  • 11