In this exercise, you will create the app's deployment artifacts, deploy the app to Cloud Foundry, and test run the app on Cloud Foundry.
After completing these steps, you will know how to prepare the app for deployment to the Cloud Foundry runtime, and use the Cloud Foundry command line tools as well as SAP BTP Cockpit.
-
Open a new terminal using [CTRL] + ~ keyboard shortcut or Terminal | New Terminal from the menu bar.
Tip: You can toggle maximize the view, in this case the terminal, by double-clicking its tab header.
-
Change directory to the
productsinventory
folder:cd productsinventory
Tip: You can use auto-complete to enhance your productivity, e.g. in the terminal, type cd pro and press [TAB] to auto-complete.
-
Prepare the app for deployment to Cloud Foundry. The preparation includes two steps: a) Generating the deployment artifacts and turning the app into a multi target application (MTA). b) Generating the SAP Fiori launchpad. Both parts are executed using the following command:
npx fiori add deploy-config
-
For the Adding deploy-config to the project. step, select the following:
Step Parameter Value A Please choose the target Cloud Foundry B Generate project artifacts in root folder: /home/user/projects/products-inventory? Yes (default) C Enter MTA ID products-inventory (default) D Enter MTA Description SAP Fiori Freestyle Demo E Enter MTA Version 0.0.1 (default) F Destination name Northwind (case sensitive) -
As a result of executing the
npx
command, you'll see that the project structure was updated accordingly.
To build the app for deployment, right-click the mta.yaml
file, and select Build MTA.
When the build task is complete, additional artifacts are added to the project. The artifact that is used for deployment is the MTA archive (MTAR)
product-inventory_0.0.1.mtar
.
-
Before deploying the app to Cloud Foundry, take a look at what your Cloud Foundry space looks like. Log in to your trial account and enter your Cloud Foundry organization (your subaccount in SAP BTP, Cloud Foundry environment) and the space to which you'll deploy the app. A new Cloud Foundry space should look as follows:
-
Log in to the Cloud Foundry space to which you'll deploy the app. From the menu bar, select View | Find Command to open the command palette.
You can also log in to Cloud Foundry by clicking the Home icon at the left-hand side of the status bar or, in the terminal, execute the cf login command and follow the same steps.
-
Select the command CF: Login to cloud foundry.
Type cf to filter commands.
-
When prompted, provide your credentials, select the API endpoint, organization, and space for your project.
The Cloud Foundry organization and space appear in the status line at the bottom left part of the screen.
-
To deploy the app to Cloud Foundry, right-click the
products-inventory_0.0.1.mtar
file, and select Deploy MTA Archive.The task is re-using the Task: Build MTA tab and changes its title to Task: Deploy MTA Archive.
You can follow the deployment progress both in the Task: Deploy MTA Archive tab and in the SAP BTP Cockpit.
-
To see the results of the deployment to Cloud Foundry, go to the Cloud Foundry tab. Your Cloud Foundry space should look as follows:
-
To run the application on Cloud Foundry, in the SAP BTP Cockpit, go to the Cloud Foundry space to which you deployed the app, and click the Applications tab. Click products-inventory-router, and then click the link in the Application Routes section.
To run the application on Cloud Foundry without accessing SAP BTP Cockpit, copy the link to the application from the deployment task (without the commas), paste it in a browser tab, and click [ENTER].
Congratulations, you completed the Run the app on Cloud Foundry exercise!
With this, you have successfully completed the deployment of your SAP Fiori app to SAP BTP, Cloud Foundry runtime using SAP Business Application Studio.
In this exercise, you used high productivity tools that are available out-of-the-box in SAP Business Applications Studio that make it easy to build and deploy applications as well as work in the Cloud Foundry environment.
You reached a major milestone of this session, the full app lifecycle: creation, enhancement, connection to a backend system, testing with mock data and real data, build, deployment to Cloud Foundry, and running the app on Cloud Foundry.
You're awesome!
Continue to Connect Your Project to SAP Continuous Integration and Delivery - Github Setup.