2

We have a few spring-boot micro-services running on PCF for which we have the PCF cloud config server for serving the configurations for various profile/environments. These micro-services are bound to the config server and all are managed by the PCF infrastructure. We have a few services running on Virtual Machines which are not managed by PCF. Is it possible to serve the resources from the same PCF config server to the services running on the VM which is not managed by PCF?

Sundara Raghavan
  • 401
  • 6
  • 20
  • 1
    I haven't tried this, but I think it should work. Create a service key from your SCS Config Server service instance using the cf cli (i'd recommend one per app outside PCF). Then view the service key using the cf cli to get it's information. Pass that information to your app running on the VM and so long as the network/routing permits, you should be able to communicate. An easy way to pass the info along is to manually define a `VCAP_SERVICES` env variable on your VM. Spring Boot should read this just like when it's running on CF, causing it to work very similarly. – Daniel Mikusa Mar 01 '19 at 03:10
  • Thanks @DanielMikusa. It worked after I set the environment variable SPRING_PROFILES_ACTIVE=dev – Sundara Raghavan Mar 01 '19 at 11:25
  • Is there anything more you can share? Enabling an arbitrary profile isn't going to be enough. What did you configure in your `dev` profile? – Daniel Mikusa Mar 02 '19 at 02:28
  • @DanielMikusa When the profile property is not set to 'dev' in the 'bootstrap.yml', the profile was set to 'default' which triggered a login prompt even though I had a relaxed security config in place. I still don't know if this is a best practice. I need to know how to do it the right way. But, once I set the profile property as 'dev', I was able to consume the resources seamlessly. – Sundara Raghavan Mar 05 '19 at 06:51
  • @DanielMikusa I have updated my original question with the updates of what ever that I have done regarding the same. – Sundara Raghavan Mar 05 '19 at 06:59
  • You might consider making it into an answer, but thanks for sharing! – Daniel Mikusa Mar 05 '19 at 15:18
  • Thanks for the suggestion. I have made my update as an answer. – Sundara Raghavan Mar 05 '19 at 15:24

1 Answers1

1

Atlast, this is what I had to do to connect an external service from VM to connect to the PCF managed Config Server. enter image description here

enter image description here enter image description here

enter image description here

When the profile property was not set to 'dev' in the bootstrap.yml, the profile was set to 'default' which triggered a login prompt even though I had a relaxed security config in place. I still don't know if this is a best practice. But, once I set the profile property as 'dev', I was able to consume the resouces seamlessly.

Sundara Raghavan
  • 401
  • 6
  • 20