In this exercise you'll learn how easy it is to deploy your application directly from SAP Business Application Studio to the SAP BTP, Cloud Foundry runtime.
First of all, you need to create the space in your Cloud Foundry environment to host your newly created UI5 application.
-
Open the SAP BTP Trial by opening https://cockpit.hanatrial.ondemand.com/cockpit/#/home/trial in a new browser tab and click Go To Your Trial Account.
-
You're redirected to your personal SAP BTP Cockpit where your subaccounts are listed. Click on the prefered subaccount, e.g. trial.
-
Click the menu item Cloud Foundry and then Spaces. Until now, no space was created by you. Click Create Space.
-
In the popup, enter the space name, e.g. ui5-apps. Click Create.
To be able to display deployed UI5 applications we need the Launchpad Service in our trial account.
-
To subscribe to it, click on Service Marketplace and search the Launchpad Service.
-
Click on the Launchpad Service tile and then on Create on the right hand side
If you now click on Instance and Subscriptions you'll see that you have subscribed to the Launchpad Servcice.
Now you can login to your Cloud Foundry environment directly from SAP Business Application Studio.
-
Open SAP Business Application Studio. Click in the header toolbar on View and then select Find Command.... Enter CF: Login to cloud foundry.
-
Enter the Cloud Foundry API endpoint you'd like to use. If your environment runs in the EU10 region, this is
https://api.cf.eu10.hana.ondemand.com
. If you wanna host your application in another region, please check this site to get an overview about all available regions and respective API endpoints. -
Enter the email address you have used for registering your SAP BTP account.
-
Enter the password for your SAP BTP account. Remember that you have to enter your password followed by your 2FA code in case you have set up 2-Factor-Authentication!
-
After a few seconds a small window appears in the lower right corner notifying you that the login was successful.
After logging in you're asked to specify your desired Cloud Foundry organization and space.
-
If you are not asked right away to select the organization, then click in the header toolbar on View and then select Find Command.... Enter CF: Set Org and Space.
-
Enter your Cloud Foundry organization name e.g. ui5-cloud-foundry - or select the ID of your trial account (the first part of the Business Application Studio URL)
-
After a few seconds a small window appears in the lower right corner notifying you that your organization and space have been set successfully.
Since you created your app using one of the application templates available in SAP Business Application Studio, all files which are located under sensormanager/test/
and sensormanager/localService/
are excluded from any build, because in a productive application these files are usually not needed. In our case the sensor data is placed in a local JSON file, so the sensors.json
file needs to be included in the build.
-
Open
sensormanager/ui5-deploy.yaml
. -
Remove the
"/localService/**"
entry for thebuilder
section.
sensormanager/ui5-deploy.yaml
builder:
resources:
excludes:
- "/test/**"
Now it's time to build your application. Yeah!
-
Right-click the
mta.yaml
file in the root folder. -
Once the build has finished the terminal will display messages that the MTA archive has been generated and temporary files are cleaned up:
The build step has created a file named TechEd2020_0.0.1.mtar
located under mta_archives
. This file contains your build.
-
Right-click
mta_archives/TechEd2020_0.0.1.mtar
and select Deploy MTA Archive. Deployment starts. -
You are asked for the organisation and space again. Choose your trial account as organisation and the ui5-apps space you just created.
-
Deployment takes some time but should have finished after a few minutes, of which you'll be notified by in the terminal.
-
The deployed application can be started from the SAP BTP Cockpit. Go to your trial subaccount and click on the HTML5 Applications section at tjhe left hand side. The application is listed there as 'keepcoolsensormanager'. Click on it to start it.
-
Congratulations! You've deployed your UI5 application to the SAP BTP, Cloud Foundry runtime.
Hooray! You've completed successfully Exercise 11 - Deployment to SAP BTP, Cloud Foundry runtime. But this is not the end yet:
Continue to Exercise 12 - Develop your own Control.