1
votes

I developed a simple prototype of a complete microservice architecture with Spring Cloud and OSS libraries that I can run fluently on my computer. I'm trying to deploy the whole thing to Cloud Foundry, and going throught the documentation I found a lot of articles discussing how to use PCF discovery service, but how about using our eureka server? I tried to use user provided service but my microservices can't bind to the URL even when restaging them. How can I achieve such thing?

The second question is (If I can make eureka works): should I declare my config server also as a user provided service?

1
Did you see this article? It's a little bit Pivotal specific, but you should be able to do the same thing with all OSS software with a little extra work: content.pivotal.io/blog/… - Daniel Mikusa

1 Answers

1
votes

Following the docs create-user-provided-service

You should first create the cups like this:

  1. cf cups SERVICE_INSTANCE -p PATH_TO_FILE

the file could be a json file with a content like this: {"key1":"value1","key2":"value2"}

  1. bind your app to the service through a manifest.yml file that resides in your app directory
services: 
 -SERVICENAME
  1. get the service value through an application.yml file property like this

    url: ${vcap.services.servicename.key1}

    for default values you can do

    url: ${vcap.services.servicename.key1:defaultURL}

After you have created the cups, the manifest.yml and the aplication.yml, you have to push your application or restart it.

Should I declare my config server also as a user provided service?

I believe you should, your config server will probably be accesed by multiple microservices therefore you should keep the config server url in the user provided service and connect your multiple apps to this service.