In the las blog we´ve build up an little app on top of SAP Cloud Platform Application now we continue:
|1||Create your virtual twin with SAP Cloud Platform Application Enablement|
|2||Build up an IoT App on top of SAP Cloud Platform Application Enablement|
|3||Deploy your SAP Cloud Platform IoT Application Enablement App to the Cloud Foundry Environment (this blog)|
|4||Technical aspects and configuration for SAP CP IoT Enablement|
In this blog we want now cover step 4 where we deploy now our app from the previous blog to the “SAP Cloud Platform Cloud Foundry Environment”:
SAP Web IDE IoT App – Install the Builder
The first thing before we can build our application:
Is now to define the following properties in the “Project Settings” of our IoT app.:
- The API Endpoint
- The Organization of your CF Account (pls check this link for more details about the SAP CP CF Environment)
- The Space where your app will be deployed
- Install the Builder
Install the Builder
SAP Cloud Platform (CF) space right before the installation of the builder:
And after the successfully installation:
Adjust the MTA deployment descriptor
To run our application successfully on the SAP CP “Cloud Foundry” Environment we need to adapt the “mta.yaml” of our app.
Prerequisite pls verify that the “Cloud Foundry Command Line Interface” is installed on your device, if not you can found it here: https://github.com/cloudfoundry/cli#downloads
We need now to create an “User Administration and Authentification” (UAA) service instance and a file called “xs-security.json” which defines/match the local scope to the foreign scope from SAP Cloud Platform Application Enablement!
On your console/cmd we need now to login to the API endpoint of the “SAP CP CF environment”, the organization and the space:
>cf api https://api.cf.eu10.hana.ondemand.com Setting api endpoint to https://api.cf.eu10.hana.ondemand.com... OK api endpoint: https://api.cf.eu10.hana.ondemand.com api version: 2.99.0 Not logged in. Use 'cf login' to log in. >cf login API endpoint: https://api.cf.eu10.hana.ondemand.com Email> firstname.lastname@example.org Password> Authenticating... OK Select an org (or press enter to skip): 1. S0009xxxxtrial_trial 2. SAP_CP_CF_SYC Org> 2 Targeted org SAP_CP_CF_SYC Targeted space iot_spc API endpoint: https://api.cf.eu10.hana.ondemand.com (API version: 2.99.0) User: email@example.com Org: SAP_CP_CF_SYC Space: iot_spc
Create an new service instance:
>cf create-service xsuaa application syc-approuter-uaa -c xs-security.json
An example for the uses xs-security.json can be still found here: https://github.com/fableh/sap-scp-iot-config-files
if we now check if the service is successfully created u can execute the following command:
>cf services Getting services in org SAP_CP_CF_SYC / space iot_spc as firstname.lastname@example.org... OK name service plan bound apps last operation syc-approuter-uaa xsuaa application update succeeded
Now we need to adapt the deployment descriptor of our mta.yaml file in the following way:
Adding the follwing new “Resource”:
Switch back to the Modules Tab:
Tip: close first the mta.yaml file and reopen it, sometimes in my case the (graphical) editor do not notice the change.
In the “Require” section, create the reference to the formerly create resoure.
Important: To get access to SAP CP IoT Application Enablement foreign scopesyou need to raise an OSS Ticket. For details pls check the offical documentation
The following informations must be provide:
Title: Please enable the trust for foreign Scopes from IoT AE to <appname>
Provide the <clientid> and <identityzonid> values from the UAA service instance. You can find this information by going to the Cloud Foundry command line and running the following command:
cf env <appname>
Build an Deploy to Cloud Foundry
Noow after w´ve done all chages we can now first build your project:
After the build is successfully finished you can deploy the created “mtar” file to the SAP CP CF Environment:
As result we can now (hopefully) see a running app:
Some investigations (optional)
As we have seen before we´ve created an service instance. If we now execute the follwing command to list all service instances:
>cf services Getting services in org SAP_CP_CF_SYC / space iot_spc as email@example.com... OK name service plan bound apps last operation syc-approuter-uaa xsuaa application syc.blogs.iot.notebooks update succeeded
The “application” is now bound based on our chaneges in the deployment descriptor to our service instance.
It´s also possible to check this via SAP CP CF cockpit:
Execute the app
The last step is now to enter the SAP CP CF cockpit and running the app by entering the “Application Routes URL”
It works as aspected……
Hopefully this blog shows how u can deploy the IoT app on top of SAP Application Enablement via SAP Web IDE Full Stack to the “SAP Cloud Foundry Environment”. And which steps are requiered to get the app successfully running on your SAP CP CF environment.
I think only step which should be optimzed is the handling with the foreign scope and the manual action to create first an OSS ticket to get access.
If u have further question, pls feel free to ask or write a comment.