Performing the Deployment Process in SAP BTP, Cloud Foundry Runtime

Objective

After completing this lesson, you will be able to perform the deployment process in SAP BTP, Cloud Foundry runtime.

The Deployment Process in SAP BTP, Cloud Foundry Runtime

As your organization grows and the demand for its flagship application intensifies, the need for efficient and smooth deployment processes becomes critical. Leveraging SAP BTP, Cloud Foundry runtime, you aim to harness a variety of deployment tools and strategies to streamline updates and manage applications more effectively.

The Deployment Process

SAP BTP, Cloud Foundry runtime exemplifies simplicity in its design philosophy, streamlining the deployment process by transforming your local code into active applications hosted in isolated containers. This automation is achieved through buildpacks that automatically configure the necessary runtime and dependencies, reducing the steps from code to deployment to a single command – cf push. This not only minimizes manual effort but also rapidly shortens the development cycle, enabling you to focus more on development and less on operational logistics, and easing the transition from development to production.

Deployment Process Overview

Using the renowned cf push command, you can deploy your application with minimal setup. This includes:

  • Source upload: Your application’s source code and configurations are uploaded to SAP BTP, Cloud Foundry runtime.

  • Buildpack selection: SAP BTP, Cloud Foundry runtime (automatically or based on your choice) selects a suitable buildpack for your application type (for example Node.js, Python).

    Note

    Alternatively, if your application requires specific customization not supported by buildpacks, you can deploy it using a Docker image. More details are explained later in this lesson.

  • Staging: The application is compiled or built. SAP BTP, Cloud Foundry runtime executes the chosen buildpack, which processes the application source code to create a runnable artifact known as a droplet, including the application code, runtime, libraries, and any other dependencies.

  • Startup: SAP BTP, Cloud Foundry runtime allocates resources, for example, memory, disk, and starts the application, using the created droplet, in a container.

Post-Deployment Management

After deployment, SAP BTP, Cloud Foundry runtime handles the ongoing management of the application:

  • Routing: A URL is automatically assigned based on your application name and domain, with options to specify custom routes. Cloud Foundry's router efficiently directs traffic to your container.
  • Lifecycle management: Regular health checks are performed, and the application is automatically restarted if it crashes or doesn't respond to the health check for any reason.

Deployment Options in SAP BTP, Cloud Foundry Runtime

At SAP, you can use Cloud Foundry’s community-provided Command Line Interface (CLI) or SAP BTP cockpit, our web-based administration user interface to deploy an application.

1. Cloud Foundry CLI

Overview

The Cloud Foundry CLI is a popular tool among developers due to its simplicity, control, and direct feedback mechanisms.

The cf push command is your gateway to deploying apps. You have two main approaches:

  • Push with defaults: Let SAP BTP, Cloud Foundry runtime handle configuration automatically.
  • Push with custom settings: Specify configurations such as routes, environment variables, service bindings, and so on, either through command-line flags or a manifest.yml file.

Deployment Process

Step 1: Log In to your SAP BTP, Cloud Foundry Runtime

Open your terminal, and log in to your SAP BTP, Cloud Foundry runtime, using the CF CLI: cf login -a API_ENDPOINT

Replace API_ENDPOINT with the API endpoint of your Cloud Foundry environment, which can be found in the SAP BTP cockpit of your subaccount.

SAP BTP cockpit Overview page with the Subaccount Cloud Foundry Environment page and the API Endpoint field highlighted.

Then, enter your credentials when prompted.

Step 2: Target the Correct Org and Space

After logging in, configure the target organization and space: cf target -o YOUR_ORG -s YOUR_SPACE. Replace YOUR_ORG and YOUR_SPACE with the appropriate names.

Step 3: Deploy the Application

Navigate to your application directory containing the manifest.yml file (if required custom settings), and run: cf push

Alternatively, you can deploy with custom settings using command-line flags when in the application directory. For example, run the following command to deploy an app named myapp with two instances, allocating 512 MB of memory each, and a custom route myapp-custom-host.mydomain.com: cf push myapp -i 2 -m 512M -n myapp-custom-host -d mydomain.com

Step 4: Verify the Deployment

After deployment, check the status of your application: cf app YOUR_APP_NAME Replace YOUR_APP_NAME with the name of your application. This provides details about the running instances, URL, memory usage, and more.

Use Cases

Ideal for rapid development, testing, and automation, especially for straightforward, single-component applications.

Documentation

2. SAP BTP Cockpit

Overview

The SAP BTP cockpit offers a user-friendly, graphical interface for managing and deploying applications.

Deployment Process

Step 1: Access SAP BTP Cockpit

Log in to your SAP BTP account, and navigate to the Cloud Foundry subaccount where you want to deploy your application.

Step 2: Upload your Application

  • Navigate to the Applications page in SAP BTP cockpit.
  • Select Deploy Application.SAP BTP cockpit – Applications tab selected and Deploy Application button highlighted.
  • A wizard labeled Deploy Application displays, prompting you to upload your source code.The Deploy Application pop-up window with File Location field and Use Manifest check-box and manifest Location field.
  • Choose the location of the file that contains your application. Select the location of the file containing your application. This can be a compiled binary like a JAR or WAR file or a source code archive.
  • (Optional) manifest.yml file: If you want to use a manifest.yml file to specify application attributes, select the location of this file.
  • (Optional) If you don't want to use a manifest.yml file, untick the Use Manifest box, and manually enter the application details, for example, application name, routes, and so on.

Step 3: Deploy the Application

  • Choose Deploy to initiate the deployment process. Then, the platform will handle the build and deployment of the application into the designated space.
  • The SAP BTP cockpit will display the progress and status of your deployment in the list of applications. Once the application starts without a problem, the application’s status will turn green.The application’s status, Started, is presented in green.

Use Cases

  • Suitable for users who prefer a visual approach for application management.
  • Optimal for quick deployments of uncomplicated applications.

Tutorials and Documentation

Advanced Deployment Strategies in SAP BTP, Cloud Foundry Runtime

Watch the following video to discover the advanced deployment strategies.

1. Multitarget Application (MTA)

Overview

MTAs facilitate the deployment of complex applications involving multiple components across various technologies on the SAP BTP, Cloud Foundry runtime. You can choose from several methods based on your development environment and tool preferences.

MTA Deployment Options

Prerequisite: Access to an SAP BTP account with Cloud Foundry runtime enabled.

All these methods ultimately aim to package your MTA into a deployable format (.mtar file) and install it on the SAP BTP, Cloud Foundry runtime. They all require the descriptor file (mta.yaml), which specifies all necessary details about the application components, their dependencies, and the required services.

  • Guided deployment with Business Application Studio (BAS) or SAP Web IDE Full-Stack: Automated deployment directly from the development environment. For more information, please check:

  • Flexible deployment with Cloud MTA Build Tool (MBT): A command-line tool that builds and deploys based on your configuration, easily integrated into any IDE or CI/CD pipeline. Check out the following documentations for more support:

    Developing MTAs with MBT

  • Custom deployment with manual configuration: Directly working with Cloud Foundry CLI and manually creating all necessary deployment artifacts to achieve maximum flexibility and granular control over the deployment process. Here are some documentations to walk you through this option:

    MTA Commands for the Cloud Foundry

Choosing Your Path

Deciding on the right deployment methods depend on your specific circumstances:

ScenarioRecommended Method
First-time MTA deploymentBAS or Web IDE Full-Stack
Need for customization beyond IDE optionsMBT
Highly specialized deployment requirementsManual configuration with CF CLI

Use Cases

  • Large-scale enterprise applications with multiple integrated components.
  • Microservices architectures needing seamless interaction.

Tutorials and Documentation

2. Docker Deployment

Overview

Docker images encapsulate your entire application runtime environment, including the operating system, libraries, and dependencies. Deploying applications using Docker images on the Cloud Foundry runtime within SAP BTP offers granular control over the runtime environment compared to buildpacks, enabling you to tailor configurations to meet your application's specific requirements. On the other hand, this approach requires you to assume full responsibility for managing the Docker image, such as applying security patches, updating dependencies, and so on.

Deployment Process

Prerequisite: Access to an SAP BTP account with Cloud Foundry runtime enabled.

Use the cf push command with the --docker-image parameter to deploy your Docker-based application. For example:

cf push <APP-NAME> --docker-image <REPO>/<IMAGE>:<TAG>

Replace <APP-NAME> with your desired application name, <REPO>/<IMAGE>:<TAG> with the location and tag of your Docker image in the registry.

Use Cases

Applications requiring specific environments not supported by standard buildpacks.

Documentation

3. Continuous Integration and Delivery

Overview

Continuous integration and delivery form a cornerstone methodology for automating software development and deployment processes, ensuring a systematic and error-minimized release pipeline.

  • Continuous integration (CI): This practice involves developers frequently merging their code changes back to the main branch in a shared repository. Each merge triggers automated builds and tests, which helps to detect errors early and maintain code quality. It ensures that the main branch is always in a deployable state.
  • Continuous delivery (CD): Extending CI, Continuous Delivery automates the release process so that the software can be deployed at any time with by choosing a button. It typically involves an automated testing phase that validates if the changes can be released into production, followed by an automated or manual release process.

SAP provides two primary solutions for implementing CI/CD on the SAP BTP, Cloud Foundry runtime:

  • SAP Continuous Integration and Delivery (CI/CD): A managed service that facilitates straightforward setup and execution of predefined CI/CD pipelines, ideal for standard deployment processes. Refer to the Help Portal of SAP Continuous Integration and Delivery for more information.
  • Project "Piper": An open-source initiative offering customizable Jenkins pipelines and Docker images, suitable for complex workflows requiring specific configuration adjustments. Check out the official documentation of Project Piper for more support.

Deployment Process

Prerequisite: Access to an SAP BTP account with Cloud Foundry runtime enabled.

  • Step 1: Code integration Developers push changes to a version-controlled system like Git, which are then automatically integrated into the main line through a CI server.

  • Step 2: Automated testing Each integration triggers an automated test suite encompassing unit, integration, and, sometimes, acceptance tests to ensure functionality and performance.

  • Step 3: Preproduction staging Successful builds are deployed to a staging environment that mirrors production to test real-world behavior and performance under load.

  • Step 4: Production deployment Upon successful staging tests and final approval, changes are deployed to production. This step can be automated or require manual intervention, depending on the organization’s deployment policies.

Use Cases

  • Effective for large-scale enterprise applications requiring robust architectures with frequent updates and multiple developers.
  • Useful in regulated environments where traceability and audit trails of changes are required.

Tutorials

Summary

This lesson provided a comprehensive exploration of application deployment within SAP BTP Cloud Foundry runtime, highlighting the versatility of CF CLI and SAP BTP cockpit. It delved into advanced deployment strategies including multitarget applications, Continuous Integration/Continuous Delivery pipelines, and Docker images, which facilitate the management and deployment of complex applications. By mastering these tools and techniques, you can optimize the deployment processes, ensuring you can keep pace with growing operational demands.

Log in to track your progress & complete quizzes