Skip to content
Search

    Deploy using cf push

    As an alternative to MTA-based deployment, you can choose Cloud Foundry-native deployment using cf push, or cf create-service-push respectively.

    Prerequisites

    Install the Create-Service-Push Plugin:

    cf install-plugin Create-Service-Push
    

    This plugin acts the same way as cf push, but extends it such that services are created first. With the plain cf push command, this is not possible.

    Add a manifest.yml

    cds add cf-manifest
    

    This creates two files, a manifest.yml and services-manifest.yml in the project root folder.

    • manifest.yml holds the applications. In the default layout, one application is the actual server holding the service implementations, and the other one is a ‘DB deployer’ application, whose sole purpose is to start the SAP HANA deployment.
    • services-manifest.yml defines which CF services shall be created. The services are derived from the service bindings in package.json using the cds.requires configuration.

    On trial landscapes, if you’re not using SAP HANA Cloud, replace the broker type hana by hanatrial in services-manifest.yml.

    Unlike the files in the gen folders, these manifest files are genuine sources and should be added to the source control system. This way, you can adjust them to your needs as you evolve your application.

    Build the Project

    This prepares everything for deployment, and – by default – writes the build output, that is the deployment artifacts, to folder ./gen in your project root.

    cds build --production
    

    Learn how cds build can be configured.

    The --production parameter ensures that the cloud deployment-related artifacts are created by cds build. See section SAP HANA database deployment for more details.

    The step cds build also generates a manifest.yml file in the build staging folder. This file is redundant and will be removed in a future version.

    Push the Application

    cf create-service-push  # or `cf cspush` in short from 1.3.2 onwards
    

    This creates service instances, pushes the applications and binds the services to the application with a single call.

    During deployment, the plugin reads the services-manifest.yml file and creates the services listed there. It then reads manifest.yml, pushes the applications defined there, and binds these applications to service instances created before. If the service instances already exist, only the cf push operation will be executed.

    You can also apply some shortcuts:

    • Use cf push directly to deploy either all applications, or cf push <app-name> to deploy a single application.
    • Use cf create-service-push --no-push to only create or update service-related data without pushing the applications.

    In the deploy log, find the application URL in the routes line at the end:

    name:              bookshop-srv
    requested state:   started
    routes:            bookshop-srv-....cfapps.sap.hana.ondemand.com
    

    Open this URL in the browser and try out the provided links, for example, .../browse/Books. Application data is fetched from SAP HANA.

    To ensure that SAP HANA deployment was successful, check the deployment logs of the database deployer application (cf logs <app-name>-db-deployer --recent). The application itself is by default in state started after HDI deployment has finished, even if the HDI deployer returned an error. To save resources, you can explicitly stop the deployer application afterwards.

    The SAP Fiori Preview, that you are used to see from local development, is only available for the development profile and not available in this scenario. For productive applications, you should add a proper SAP Fiori application.

    Multitenant applications are not supported yet as multitenancy-related settings are not added to the generated descriptors. The data has to be entered manually.

    Got errors? See the troubleshooting guide.