Using Spring Cloud Services in PCF Dev

Page last updated:

This topic describes how to deploy and use the Spring Cloud® Services (SCS) suite within PCF Dev.

When configured to use SCS, PCF 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 PCF Dev is launched with SCS enabled.

Launch Spring Cloud Services

To launch PCF Dev using SCS, run cf dev start using the -s scs flag:

$ cf dev start -s scs
Downloading VM...
Progress: |====================>| 100%
Allocating 8192 MB out of 32768 MB total system memory (14387 MB free).
Importing VM...
Starting VM...
Provisioning VM...
Waiting for services to start...

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

Alternatively, you can deploy SCS after start by running the following command:

$ cf dev deploy-service scs
Deploying scs...

To undeploy SCS, stop PCF Dev:

$ cf dev stop

Use Spring Cloud Services

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

  1. Clone the cook sample app 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:

    • Mac OS X or Linux: ./gradlew build
    • Windows: gradlew.bat build

    For example, the output on Mac OS X appears as follows:

    $ ./gradlew build
    :processTestResources UP-TO-DATE
    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 startup date [Tue Aug 23 12:02:05 EDT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5c2e9d5e
  4. Run cf login to log in to PCF Dev and target your local domain using user/pass as the credentials. To avoid SSL validation errors, use the --skip-ssl-validation flag. See SSL Validation Errors.

    $ cf login -a --skip-ssl-validation
    Email> user
  5. Run cf create service to create a service instance of the config server. Use the -c flag to specify a JSON object containing configuration parameters for the service as show in the following example:

    $ cf create-service -c '{ "git": { "uri": "", "label": "master"  } }' p-config-server standard cook-config-server
    Creating service instance config-server in org pcfdev-org / space pcfdev-space as user...
  6. Run cf service config-server to confirm that the service was created:

    $ cf service config-server
    Service instance: config-server
    Service: p-config-server
    Bound apps:
    Plan: standard
    Description: Config Server for Spring Cloud Applications
    Documentation url:
    Last Operation
    Status: create succeeded
    Started: 2016-08-23T16:19:29Z
    Updated: 2016-08-23T16:20:31Z

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

  7. Push the compiled JAR file:

    $ cf push -p ./build/libs/cook-0.0.1-SNAPSHOT.jar

  8. Navigate to to view the cook app.

Note: PCF Dev uses an unverified certificate. When a PCF 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 PCF Dev instance: PCF Dev does this by default for all pushed apps.

Manage Spring Cloud Services

To manage an SCS instance within PCF Dev, navigate to Apps Manager and log in using the admin credentials, admin/admin. Instances of the SCS services are displayed in the instances space of the p-spring-cloud-services org. See the Use Apps Manager topic for more information.

SCS Apps Manager