Skip to content

Cloud Foundry How Tos

This section describes common activities for managing your Cloud Foundry environment. This collection does only cover some aspects of Cloud Foundry and are not intended to replace the official documentation.

Add a New User

After the initial account registration the Tenant Owner will be assigned the Org Manager role within his tenants Cloud Foundry Org. He can then assign roles to new users via the Cloud Foundry CLI.

Attention

Prerequisites for adding a new user:

Info

The tenant role and the Cloud Foundry role are not the same and need to be assigned separately.

Change a User's Permissions

Users can have one or more roles. The combination of these roles defines the user's overall permissions in the Org and within specific app spaces in that Org.

Use the following commands for managing users on an Org level.

Function Command Example
View the organizations belonging to an account cf orgs cf orgs
View all users in an organization by role cf org-users {orgName} cf org-users my-mindsphere-org
Assign an Org role to a user cf set-org-role {userName} {orgName} {role} cf set-org-role Alice my-mindsphere-org OrgManager
Remove an Org role from a user cf unset-org-role {userName} {orgName} {role} cf unset-org-role Alice my-mindsphere-org OrgManager

And these for only assigning access to specific spaces.

Function Command Example
View the spaces in an Org cf spaces cf spaces
View all users in a space by role cf space-users {orgName} {spaceName} cf space-users my-mindsphere-org development
Assign a space role to a user cf set-space-role {userName} {orgName} {spaceName} {role} cf set-space-role Alice my-example-org development SpaceAuditor
Remove a space role from a user cf unset-space-role {userName} {orgName} {spaceName} {role} cf unset-space-role Alice my-mindsphere-org development SpaceAuditor

Create a New Space

Use cf create-space {spaceName} to create a new space within your Org. Next, you can proceed and assign one of your developers the SpaceManager or SpaceDeveloper role by using cf set-space-role {userName} {orgName} {spaceName} {role}. You can list all users of an space with cf space-users.

Assign a User to a Space

Use cf set-space-role {userName} {orgName} {spaceName} {role} to add a user to a space.

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).

Service instances are always tied to a specific space and cannot be used across multiple spaces. This is a design choice of Cloud Foundry to ensure isolated sub-environments. 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 {serviceName} {plan} {serviceInstanceName}. As a next step you can bind this service to one of your apps.

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

Bind a Service Instance

Bind the service with cf bind-service {appName} {serviceInstanceName} 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.

Background Tasks / Processes

Cloud Foundry supports running background processes, for example data crunching. Those background processes are normal Cloud Foundry apps, but without a route. Therefore, it is necessary to use the --no-route parameter for pushing applications or set this as an attribute in your manifest.yml.

Warning

If you forget to disable the route, Cloud Foundry is going to perform periodically health checks that will fail. Due to this failing health checks the Cloud Controller is going to stop your application.

Refer to the official documentation for further details:

How Can I Find my Current Usage of my Org

Use the cf org {orgName} command to get information about your Org.

Which IP does my App Use for Accessing the Internet

MindSphere applications running on Cloud Foundry access the internet via a NAT gateway, which uses the following IP addresses:

1
2
3
35.156.223.10
18.194.162.141
18.194.195.179

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!

How Can I Find the Stack my App is using

Stacks are prebuilt root file systems that support specific operating systems. Linux-based systems need /usr and /bin directories at their root.

The following Cloud Foundry Stacks are currently available:

  • cflinuxfs3: Based on Ubuntu Bionic 18.04
  • cflinuxfs2: Deprecated and based on Ubuntu Trusty 14.04

We advise to always use the latest available stack. You can find out the stack which your application is using with the following command:

1
cf app APP_NAME

The command line will list a summary of the application including the used stack:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Showing health and status for app APP_NAME in org ORG_NAME / space SPACE_NAME as john.doe@mindsphere.io...

name:              APP_NAME
requested state:   started
instances:         1/1
usage:             500M x 1 instances
routes:            APP_NAME-posthumeral-streptomycin.apps.eu1.mindsphere.io
last uploaded:     Thu 21 Feb 12:37:11 CET 2019
stack:             cflinuxfs3
buildpack:         staticfile_buildpack

    state     since                  cpu    memory         disk         details
#0  running   2019-02-25T14:13:14Z   0.0%   1.5M of 500M   6M of 512M

How can I update the Stack of my App

To change the stack to cflinuxfs3, either add the stack attribute in your Single Manifest file or use the following command:

1
cf push APP_NAME -s cflinuxfs3

The push command causes a restaging of the application and ensures that all statically linked dependencies are updated.

Any questions left?

Ask the community


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