Skip to content

Latest commit

 

History

History

ex11

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

solution

Exercise 11 - Deploy Your App to SAP BTP, Cloud Foundry runtime

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.

Exercise 11.1 - Create Space in Cloud Foundry

First of all, you need to create the space in your Cloud Foundry environment to host your newly created UI5 application.

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



  2. You're redirected to your personal SAP BTP Cockpit where your subaccounts are listed. Click on the prefered subaccount, e.g. trial.



  3. Click the menu item Cloud Foundry and then Spaces. Until now, no space was created by you. Click Create Space.



  4. In the popup, enter the space name, e.g. ui5-apps. Click Create.



  5. The newly created space is displayed.



Exercise 11.2 - Subscribe to Launchpad Service

To be able to display deployed UI5 applications we need the Launchpad Service in our trial account.

  1. To subscribe to it, click on Service Marketplace and search the Launchpad Service.

  2. Click on the Launchpad Service tile and then on Create on the right hand side



  3. Leave the selected values as they are and click Create



If you now click on Instance and Subscriptions you'll see that you have subscribed to the Launchpad Servcice.

Exercise 11.3 - Login to Cloud Foundry

Now you can login to your Cloud Foundry environment directly from SAP Business Application Studio.

  1. Open SAP Business Application Studio. Click in the header toolbar on View and then select Find Command.... Enter CF: Login to cloud foundry.



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



  3. Enter the email address you have used for registering your SAP BTP account.



  4. 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!



  5. After a few seconds a small window appears in the lower right corner notifying you that the login was successful.



Exercise 11.4 - Set Organization and Space

After logging in you're asked to specify your desired Cloud Foundry organization and space.

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



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



  3. Select your newly created space, e.g. ui5-apps.



  4. After a few seconds a small window appears in the lower right corner notifying you that your organization and space have been set successfully.



Exercise 11.5 - Configure Your UI5 Application

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.

  1. Open sensormanager/ui5-deploy.yaml.

  2. Remove the "/localService/**" entry for the builder section.

sensormanager/ui5-deploy.yaml

builder:
  resources:
    excludes:
      - "/test/**"

Exercise 11.6 - Build Your Application

Now it's time to build your application. Yeah!

  1. Right-click the mta.yaml file in the root folder.

  2. Select Build MTA Project. The build starts.



  3. Once the build has finished the terminal will display messages that the MTA archive has been generated and temporary files are cleaned up:



Exercise 11.7 - Deploy Your Application

The build step has created a file named TechEd2020_0.0.1.mtar located under mta_archives. This file contains your build.

  1. Right-click mta_archives/TechEd2020_0.0.1.mtar and select Deploy MTA Archive. Deployment starts.



  2. You are asked for the organisation and space again. Choose your trial account as organisation and the ui5-apps space you just created.

  3. Deployment takes some time but should have finished after a few minutes, of which you'll be notified by in the terminal.



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



  5. Congratulations! You've deployed your UI5 application to the SAP BTP, Cloud Foundry runtime.



Summary

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.