Using Spring Cloud Services in Pivotal Platform Dev

Page last updated:

This topic describes how to deploy and use the Spring Cloud® Services (SCS) suite within Pivotal Platform Dev. For more information about SCS, see the Spring Cloud Services documentation.

Overview

When configured to use SCS, Pivotal Platform Dev provides the following services:

The sections below describe how to launch SCS and use the Config Server. The Service Registry and Circuit Breaker Dashboard work by default when Pivotal Platform Dev is launched with SCS enabled.

Launch Spring Cloud Services

To launch Pivotal Platform Dev using SCS:

  1. Navigate to your workspace.

  2. Run:

    cf dev start -s scs
    

    Note: Due to the increased demands of SCS, Pivotal Platform Dev allocates more memory than usual.

    Alternatively, you can deploy SCS after start by running:

    cf dev deploy-service scs
    

To undeploy SCS:

  1. Navigate to your workspace.

  2. Stop Pivotal Platform Dev by running:

    cf dev stop
    

Use Spring Cloud Services

To create a service instance of the Config Server using the cook sample app:

  1. Clone the sample app from the cook repository on GitHub to your workspace.

  2. In a terminal window, navigate to the root repository of the cook sample app.

  3. To compile the cook sample app, run one of the following commands:

    • For Mac OS X or Linux:

      ./gradlew build
      
    • For Windows:

      gradlew.bat build
      

      The output on Mac OS X appears as in the example below:

      $ ./gradlew build
      ...
      :compileTestJava
      :processTestResources UP-TO-DATE
      :testClasses
      :test
      2016-08-23 12:02:07.900  INFO 79148 --- [       Thread-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@5c2e9d5e: startup date [Tue Aug 23 12:02:04 EDT 2016]; root of context hierarchy
      2016-08-23 12:02:07.903  INFO 79148 --- [       Thread-5] o.s.w.c.s.GenericWebApplicationContext   : Closing org.springframework.web.context.support.GenericWebApplicationContext@4ef3f6da: startup date [Tue Aug 23 12:02:05 EDT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5c2e9d5e
      :check
      :build

      BUILD SUCCESSFUL

  4. Log in to Pivotal Platform Dev and target your local domain. To avoid SSL validation errors, use the --skip-ssl-validation flag. For more information, see the Why do I receive a “Invalid SSL Cert” error? section of the Frequently Asked Questions topic. Run:

    cf login -a https://api.local.pcfdev.io --skip-ssl-validation
    Email> USER-EMAIL
    Password> PASSWORD
    

    Where:

    • USER-EMAIL is your user email.
    • PASSWORD is your password.
  5. Create a service instance of the config server by running:

    cf create service
    

    Use the -c flag to specify a JSON object containing configuration parameters for the service, as shown in the following example:

    $ cf create-service -c '{ "git": { "uri": "https://github.com/spring-cloud-services-samples/cook-config", "label": "master"  } }' p-config-server standard cook-config-server
    Creating service instance config-server in org pcfdev-org / space pcfdev-space as user...
    OK
    ...
    

  6. To confirm that the service was created, run:

    cf service config-server
    

    When finished, the status of the service instance displays create succeeded.

  7. Push the compiled JAR file by running:

    cf push -p ./build/libs/cook-0.0.1-SNAPSHOT.jar
    
  8. Navigate to http://cookie.local.pcfdev.io/restaurant in your browser to view the cook app.

Note: Pivotal Platform Dev uses an unverified certificate. When a Pivotal Platform Dev SCS service makes use of an unverified certificate, the pushed apps must have the environment variable CF_TARGET set to the API URL of the Pivotal Platform Dev instance: https://api.local.pcfdev.io. Pivotal Platform Dev does this by default for all pushed apps.

Manage Spring Cloud Services

To manage an SCS instance within Pivotal Platform Dev:

  1. Navigate to https://apps.local.pcfdev.io in your browser.

  2. Log in to Apps Manager using the admin credentials, admin/admin.

  3. Navigate to the instances space of the p-spring-cloud-services org to see instances of the SCS services.

For more information, see the Use Apps Manager section of the Using Pivotal Platform Dev topic.

There is a page with a dark blue header and subnav on the left. In the left corner of the header is the text 'Pivotal PCF Dev' in white letters. In the right corner of the header is the word 'admin' in white letters with a white downward-pointing triangle to the right of 'admin', indicating a dropdown. Below 'Pivotal PCF Dev' is a subnav with two main sections labeled 'Org' and 'Spaces', as well as a link below 'Spaces' labeled 'Accounting Report'. Under 'Org' is the text 'p-spring-cloud-se...' with a downward-pointing arrow on a button to the right, indicating a dropdown. Under 'Spaces' is the text 'instances'. To the right of the subnav is the space page, which has a white background. At the top is a header labeled 'Space'. Below 'Space' is the name of the space, 'instances', in large black text. To the right of 'instances' are three small circle icons in a vertical row. The top circle icon is green, with the text '1 Running' to the right. The middle circle icon is gray, with the text '0 Stopped' to the right. The bottom circle icon is red, with the text '0 Crashed' to the right. Below these are three tabs: 'App (1)', 'Services', and 'Settings'. 'App (1)' is in black letters with a green line underneath to indicate it is selected; the other tab labels are in blue letters and are not underlined. Below these tabs is a table labeled 'Apps' in bold text. Below 'Apps' are five column headers labeled 'Name', 'Instances', 'Memory', 'Last Push', and 'Route'. Under 'Name' is the text 'config-155f5ce5-82fb-42ba-adba-d...' in blue letters, denoting a clickable link. Below this text is a small green circle icon, to the right of which is the text 'Running' in green letters. Under 'Instances' is the text '1'. Under 'Memory' is the text '1024MB'. Under 'Last Push' is the text '2 hours ago'. Under 'Route' is the text 'http://config-155f5ce5-82fb-42ba-adba...', to the right of which is a carat icon pointing to the right, indicating an expandable field.