SAP-samples/cloud-foundry-runtime-learning-journey
The companion repository for SAP's Cloud Foundry runtime learning journey, walking through both native cf push and MTA-based deployment of a CAP application to SAP BTP.
Deploying to Cloud Foundry can go two ways, and this repository — the material behind the SAP BTP, Cloud Foundry runtime learning journey on learning.sap.com — covers both, back to back. The first path builds the project for production with cds build --production, whose --production flag is what makes cds build create the cloud deployment files, then pushes it directly with cf push. The second builds an mta.tar with the Cloud MTA Build Tool and deploys it with cf deploy instead. It stops at these two paths; further examples live in the repository's own examples folder rather than in the main walkthrough.
Facts
Where it sits
Who is behind it
In the atlas: maintains 222@SAP-samplesmaintainerArsalan KhanContributes to this
In the atlas: contributes to 3@asalan316Markus HaugContributes to this
In the atlas: contributes to 2@markushaugVarun ShanbhagContributes to this
In the atlas: contributes to 1@VarunS20023 contributors
What it declares
Every artifact
- Type
- Sample
- Origin
- By SAP
As a sample
- Form
- A tutorial's companion code
Connections
Getting an application onto a runtime and keeping it there
Download
README
quoted from SAP-samples/cloud-foundry-runtime-learning-journey under Apache-2.0, readGetting Started
How to install
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.
Prerequisites
- 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:
Task 1: Clone the sample application
- 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.
Task 2: Deploy the application using native Cloud Foundry deployment
- 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.
Task 2: Deploy the application using Multi-Target Application (MTA) deployment
- 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" […]
Examples
For additional examples and sample applications, check out the examples folder.
Learn More
- Getting Started with CAP
- Deploy to Cloud Foundry Guide
- https://developers.sap.com/tutorials/deploy-to-cf.html
Contributing
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.
License
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.
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:sap-samples-cloud-foundry-runtime-learning-journey- JSON
- /artifacts/sap-samples-cloud-foundry-runtime-learning-journey.json
- MCP
- Connecting an agent