Connecting Cloud Foundry and MindSphere
As part of getting to know Siemens MindSphere we are looking at their offering for developing applications. On MindSphere it is possible to publish applications on a Platform-as-a-Service powered by Cloud Foundry.
Setup Cloud Foundry
To get started with Cloud Foundry Applications on MindSphere you have to be the original administrator of MindSphere or he has to provide the required permission on Cloud Foundry to you. This requires you to be added to the MindSphere tenant. To get the required permissions you have to first login once with the following command:
cf login -a https://api.cf.{region}.{mindsphere-domain} --sso
After that the OrgManager can assign the required roles (SpaceDeveloper) with the command
cf set-org-role {username} {orgname} {role}
cf set-space-role {username} {orgname} {spacename} {role}
Incase there is no space you need to create one with the command
cf create-space {spacename}
If the setup is done you are able to login and select the organization and space
cf target -o {orgname} -s {spacename}
Simple Static Page on Cloud Foundry
- Create a folder with three files inside called
index.html
,manifest.yml
andStaticfile
- Add to the
manifest.yml
the following content
---
applications:
- name: <your_application_name>
instances: 1
random-route: true
path: .
memory: 64M
- Fill the
index.html
with your static content like the following
<head></head>
<body>
<h1>Simple Static Page on MindSphere with Cloud Foundry</h1>
</body>
-
Then inside the folder run the command
cf push
to start the deployment of the static page using the static buildpack. In the output of the command can see your Cloud Foundry url which would we similar to the following<your_application_name>-<random>-<random>.apps.<region>.<mindsphere-domain>
. -
Now login to MindSphere and enter the Developer Cockpit.
-
There create a new application, it should look similar to the one below:
-
Enter as the Cloud Foundry Url the one from above and press the + sign. As the path use
/**
and press add. Then enter a name and a version in the remaining fields and save. -
The last step is to register the just created application. Since we are not using any MindSphere api we do not need to assign any roles.
-
In the created application there should be now a application URL visible to access the static page. It should be similar to the following scheme
https://<tenant_name>-<your_application_name>-<tenant_name>.<region>.<mindsphere_domain>/
-
Navigating to the Url the page should look similar to
MindSphere Developer Cockpit
The Developer Cockpit is used to manage your applications on MindSphere.
To access the Developer Cockpit a subscription to the MindAccess Developer Plan is needed as well as the Developer
or DeveloperAdmin
Role on MindSphere.
Inside the Developer Cockpit there a three interfaces.
The Dashboard which shows all your applications and their current state of development.
Applications in MindSphere follow a lifecycle which is split up into the different plans MindSphere has to offer:
- Developer Plan
- Develop the application locally
- Implement the application in the Developer Cockpit
- Test the application in the development system
- Assign the application to operators
- Send application to Application Repository
- Operator Plan
- Download the application from Application Repository
- Deploy the application to productive system
- Set a route to the tenant
- Publish application to MindSphere Store
- Provision the application in a customer Launchpad
- IoT Value Plan
- Make a subscription from the MindSphere Store
- Access application via Launchpad
Under the Promoted Apps tab are your applications listed which are ready for operation. In the Authorization Management tab you can assign MindSphere Api Roles to your application specific roles and manage the scopes.
Accessing MindSphere Data using Roles and Scopes
To access data from MindSphere an application needs to have the correct MindSphere Api Role.
The required MindSphere Api Role depends on the data the applications wants to use. There are Roles for read and write access. The MindSphere Concept Page has a List of MindSphere Roles.
The MindSphere Api Roles can be assigned to application roles.
An application can have a maximum of 5 roles and requires one role.
If a application is created in the developer cockpit two standart roles, namely admin
and user
are created.
Summary
In this post you learned how to publish an application via Cloud Foundry on MindSphere and got a short introduction to the Developer Cockpit.