16. Installing on Cloud Foundry

This section contains an example YAML file that configures two Cloud Foundry accounts, named cf-dev and cf-qa. This is useful on Cloud Foundry if you use the Spring Cloud Config Server to manage Skipper’s configuration properties.

16.1 Cloud Foundry Configuration

You can modify the following sample YML snippet to fit your needs:

spring:
  cloud:
    skipper:
      server:
        enableLocalPlatform: false
        platform:
          cloudfoundry:
            accounts:
              cf-dev:
                connection:
                  url: https://api.run.pivotal.io
                  org: myOrg
                  space: mySpace
                  domain: cfapps.io
                  username: [email protected]
                  password: drowssap
                  skipSslValidation: false
                deployment:
                  memory: 2048m
                  disk: 2048m
                  services: rabbit
                  deleteRoutes: false
              cf-qa:
                connection:
                  url: https://api.run.pivotal.io
                  org: myOrgQA
                  space: mySpaceQA
                  domain: cfapps.io
                  username: [email protected]
                  password: drowssap
                  skipSslValidation: true
                deployment:
                  memory: 1024m
                  disk: 1024m
                  services: rabbitQA
                  deleteRoutes: false
[Note]Note

You must set enableLocalPlatform to false so that the local platform deployer is never used.

[Note]Note

The deleteRoutes deployment setting is false so that “v2” of an application has the same route as “v1”. Otherwise, undeploying “v1” removes the route.

You can also run the Skipper server locally and deploy to Cloud Foundry. In this case, it is more convenient to specify the configuration in a skipper.yml file and start the server with the --spring.config.location=skipper.yml option.

If you use cf push to deploy Skipper, a Cloud Foundry manifest is more appropriate to use. You can modify the following sample manifest.yml to fit your needs:

applications:
- name: mlp-skipper
  host: mlp-skipper
  memory: 1G
  disk_quota: 1G
  timeout: 180
  instances: 1
  buildpack: java_buildpack
  path: spring-cloud-skipper-server.jar
env:
    SPRING_APPLICATION_NAME: mlp-skipper
    SPRING_CLOUD_SKIPPER_SERVER_ENABLE_LOCAL_PLATFORM: false
    SPRING_CLOUD_SKIPPER_SERVER_STRATEGIES_HEALTHCHECK.TIMEOUTINMILLIS: 300000
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_URL: https://api.run.pivotal.io
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_ORG: myOrgQA
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_SPACE: mySpaceQA
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_DOMAIN: cfapps.io
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_USERNAME: [email protected]
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_PASSWORD: drowssap
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_CONNECTION_SKIP_SSL_VALIDATION: false
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_DEPLOYMENT_DELETE_ROUTES: false
    SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_DEPLOYMENT_SERVICES: rabbitmq
services:
- mysqlboost
[Note]Note

In the preceding manifest, we bound the application to the mysqlboost service. If you do not specify a service, the server uses an embedded database.

[Note]Note

You must set SPRING_CLOUD_SKIPPER_SERVER_ENABLE_LOCAL_PLATFORM to false so that the local platform deployer is never used.

[Note]Note

You must set SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[pws]_DEPLOYMENT_DELETE_ROUTES: false so that “v2” of an application has the same route as “v1”. Otherwise, undeploying “v1” removes the route.

You can find information on the deployment properties that you can configure in CloudFoundryDeploymentProperties.

When starting the Skipper shell on your local machine, it tries to connect to the Server at the default location of localhost:7577/api. Use the shell’s --spring.cloud.skipper.client.serverUri command line option to specify the location of the server. You can alternatively use the config interactive shell command to set the server location, as follows:

server-unknown:>skipper config --uri https://mlp-skipper.cfapps.io/api
Successfully targeted https://mlp-skipper.cfapps.io/api
skipper:>