This section explains how to deploy the application to your SAP BTP subaccount.
First, the Cloud-Foundry-native deployment using cf-push
is shown. Then the MTA-based deployment is explained. Please ensure to log on to the Cloud Foundry environment using the Cloud Foundry CLI using this guide.
- You have access to an SAP BTP, Cloud Foundry environment and have the necessary permissions to deploy applications into a Cloud Foundry space.
- You have installed the following tools:
- Clone the sample application from the GitHub repository.
Clone the sample application from the GitHub repository using the following command:
git clone https://github.com/SAP-samples/cloud-foundry-runtime-learning-journey
- Open the cloned project in your preferred IDE.
- Build the project
This reference applications already comes with all neccessary files for the deployment. However, you have to build the application for production first:
cds build --production
The --production
parameter ensures that the cloud deployment-related artifacts are created by cds build.
- Login to your Cloud Foundry instance and target an organization and space
Use the following command to login to your Cloud Foundry instance:
cf login
Provide the API endpoint, which you can find in the SAP BTP cockpit, and your credentials. Once authenticated, target an organization and space by choosing the respective values from the list.
Alternatively, you can also use the following command to target an organization and space:
cf target -o <organization> -s <space>
- Push the application to Cloud Foundry
Use the following command to deploy the application to Cloud Foundry:
cf push
Read more about the deployment via cf-push in the official [CAP documentation].
- Access the application
In your Terminal, you will see the URL of the deployed application. Open the URL in your browser to access the application. Alternatively, you can also navigate into your application that is now deployed inside your Cloud Foundry space on the SAP BTP cockpit and access the application from there.
- Build the project This reference applications already comes with all neccessary files for the deployment. However, you have to build the application for production first:
mbt build -t gen --mtar mta.tar
This will create a mta.tar
file in the gen
folder. This file contains the deployment artifacts for the MTA deployment.
- Deploy the application
Use the following command to deploy the application to Cloud Foundry:
cf deploy gen/mta.tar
Wait until the process is finished. You can check the status of the deployment in the terminal. Once the deployment is finished, you should see something like this:
[…] Application "hello-cloud-foundry-srv" started and available at "[org]-[space]-hello-cloud-foundry-srv.landscape-domain.com" […]
- Getting Started with CAP
- Deploy to Cloud Foundry Guide
- https://developers.sap.com/tutorials/deploy-to-cf.html
If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.
Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.