Skip to content

Cloud Foundry How Tos - Service Instances

Create a Service Instance

MindSphere provides multiple backing services out of the box that can be used for application development and operation. These services are managed and will be provisioned on a dedicated VM. Depending on your Org quota and settings you can create multiple service instances. Each instance is related to a backing service plan that describes the hardware, capabilities and the number of instances (e.g. clustered instances).

Use cf marketplace or cf m to list all available Backing Services and their associated plans. Choose your desired service and create a new instance with cf create-service {service_name} {plan} {service_instance}. As a next step you can bind this service to one of your apps.

Use cf service {service_instance} to get detailed information about your service instance.

Update a Service Instance to a bigger Service plan_name

You can update a service instance to a bigger service plan with cf update-service {service_instance} -p {a-bigger-plan}.

The following are the possibilities for updating to a bigger plan:

  • It is possible to update from a service plan to another if the new service plan has a bigger disk size than the old one.
  • It is possible to update from a non clustered service plan to a clustered service plan (except LogMe, MongoDB 3.2 and PostgreSQL 9.4).
  • It is not possible to update from a clustered service plan with smaller disk size to a non clustered service plan with a bigger disk size.

Info

Downgrading a service instance to a smaller service plan is not possible. This can only be done by creating a backup, downloading the backup and restoring it into another smaller service instance.

Bind a Service Instance

Bind the service with cf bind-service {app_name} {service_instance} to one of your apps running in the same space as the service. After the binding the service credentials are available as environment variables and can be used within your application.

Backup & Restore Service Instances

You can use the service URL to visit the Backing Service Dashboard and start backups and restore an older one.

Enable Sharing of a Service Instance

  1. Navigate into the Cloud Foundry space where your service instance was created.
  2. Share the service with {another_space} using cf share-service {service_instance} -s {another_space}.

Info

  • For sharing service instances among spaces you need the Space Developer role in both spaces.
  • You cannot share a service instance with a space where a service instance with the same name already exists.

Attention

Avoid overload of service instances when binding them to multiple apps. Refer to the respective service plan specification.

Disable Sharing of a Service Instance

  1. Navigate into the Cloud Foundry space where your service instance was created.
  2. Disable sharing of the service with {another_space} using cf unshare-service {service_instance} -s {another_space}.

Info

  • You need the Space Developer role in the space where the service instance is running to disable its sharing.
  • You cannot delete a service instance while it is being shared with other spaces.

Attention

Unsharing a service instance removes all bindings to apps in the space it was shared with. This may cause apps to fail. Run the cf service {service_instance} command to see if bindings exist in the spaces the service instance is shared with before unsharing it.

Sharing a Backing Service in MindSphere Operator Cockpit

  1. Log into Cloud Foundry: cf login -a https://api.cf.{region}.{mindsphere-domain} --sso
  2. Select your Cloud Foundry org: cf target -o {org_name}
  3. Create a new space: cf create-space {space_name}

Info

To use Auto deployment feature of the Operator Cockpit, the {space_name} should be equal the name of the app to be registered.

  1. Switch to the space with the service instance to be shared:
    cf target -s {service_instance_space_name}
  2. Share the service instance with the new space:
    cf share-service {service_instance} -s {space_name}
    The name of the service instance is the same in all spaces. Make sure it is set correctly in your manifest file.
  3. Deploy your app in the new space and bind the service instance to it.

Attention

It is prohibited to share service instances across multiple organizations and might be blocked in the future.

Create a User-Provided-Service

Refer to the official Cloud Foundry documentation on how to create and use these:

Warning

Heads up! Only use this feature if you are aware about the security and operational consequences of this feature. Consider using restrictive firewall settings or set up a peering connection!

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.