SAP Business Technology Platform

Last update: Edit

1 Introduction

As an SAP developer, you want to deploy your Mendix app on the SAP Business Technology Platform (SAP BTP). This document explains how you can create environments, deploy to the SAP BTP, and manage these deployments using the Mendix Developer Portal.

This document describes two ways of managing the SAP BTP:

2 Set Up SAP BTP for the First Time

Before you can manage your SAP BTP using the Developer Portal, you will need to set it up. There are two circumstances under which you will have to set up the SAP BTP for the first time.

  1. You have an existing app which has never been deployed on SAP BTP and you want to change the cloud settings. See Change Cloud Settings.

  2. You are creating a new app from an SAP app template. See New SAP App.

2.1 Change Cloud Settings

In this scenario, you have an existing app which is running in another environment: for instance, on the Mendix Cloud. To change this, go to the Cloud Settings tab of the General Settings in the left-hand menu of the Development Portal.

Click Set up SAP Cloud and you will be taken to the SAP BTP welcome page.

Click Getting Started and then continue with Set Up Region.

2.2 New SAP App

In this scenario, you choose a Mendix app template for SAP SAP Apps tab and give it a name.

Once the app has been created you can continue with Set Up Region.

2.3 Set Up Region

You are now prompted with an SAP BTP login screen. Select the region where your SAP BTP is located.

Make sure that you have enough quota in this region for your organization to run a Mendix app. You will need enough quota to create the following:

  • Database
  • Route
  • Binding to XSUAA

If you have already logged on to SAP and your SAP session has not expired, you will only have to choose the region. If you do not have a current SAP session you will be asked for your SAP credentials as well. Providing your credentials will grant the Deployment Portal access to manage your SAP BTP account.

You may be asked to provide your credentials in one of two ways:

  • You will be taken to the SAP authentication page to enter your credentials – in this case, your SAP user name (email address) must be the same as your Mendix user name
  • The Developer Portal will ask for your credentials, which it will then use to obtain an access token from SAP – the Developer Portal will then use the access token, but it will not store your credentials (please note this method is being deprecated)

You will now be asked to provide the final details for the SAP BTP development environment.

You will be able to choose a Domain, Organization, and Space which is configured for you in this region.

If you do not choose a Custom database, you will still be able to choose from a range of different databases, PostgreSQL and SAP HANA for example. Please ensure that the database you choose is supported by your quota plan for this region and organization. See Databases in SAP BTP, below, for important information on selecting the correct database for your app.

If you select Yes for Custom database?, you will be asked for the Name and the Plan.

After the environment has been created successfully, you will see the following page:

Your development environment is now configured and you can now develop your app.

3 Create a New Environment

You can create several environments for your app. For example, you may have created a development environment, but you may want environments for test, acceptance, production, and so forth. Additionally, when you switch from another cloud you need to create at least one environment for your Mendix application.

This is done from the Environments page of the Developer Portal.

Your Environments page will show you the following:

  • a list of deployment packages for this app
  • a list of environments for this app
  • all the deployment activities which have been performed on this app

To create a new environment, perform the following steps:

  1. Click Add Environment to start the wizard.

  2. Select the region where you want your app to be deployed.

    If no session is active for that region, or the current session does not have access to that region, you will be asked for your SAP credentials for that region.

  3. Select the Domain, Organization, and Space of your app. The URL of the domain will form part of the application’s URL. The URL of the application will be this:

    {appname}-{environment name}.{domain}
    

    This is an example URL:

    https://myapp-development.cfapps.eu10.ondemand.com
    

  4. Click Next.

  5. Enter the name of the environment. This can be anything you choose: for example Test, Acceptance, or Production.

  6. Set the size of the memory that the app needs in order to run. This can also be changed later.

  7. Set Development Mode to Yes if you want the application to run with the Mendix security level of Prototype/demo, or Off (no security). This is not recommended for acceptance or production environments.

  8. Select the database you would like to use. Be aware that even if a specific database is part of the Marketplace it could still be unavailable because of limitations imposed by the quota of your Organization. See Databases in SAP BTP, below, for for important information on selecting the correct database for your app.

    If you choose Custom database you will need to enter a name for the database and the plan.

  9. Select File Store Enabled if your application makes use of FileDocument or Image objects. Other sorts of object do not need File Store to be enabled.

  10. Set a Subscription Secret (required). This secret is associated with your Mendix production license. By entering the subscription secret, your application will run in this environment as production. If the subscription secret is invalid, your app will still run, but will restart every 1-2 hours and have a limitation of six named users.

  11. If you want the user to be redirected to a custom URL after they have logged in using XSUAA then, optionally, add Redirect URLs.

  12. Click Next to create the environment and finish the setup.

An environment is created; with more than one environment it is possible to transport your application between environments (see Transport App Between Environments, below).

4 Preparing Packages for Deployment

There are two ways of getting a package ready to deploy to SAP.

  • Creating a package directly from a version of the app model held in Team Server
  • Uploading a package which has already been created

4.1 Creating Package from Team Server

At any time, you can create a new deployment package from a committed version of the project. If you are working with Mendix Studio Pro, you will first have to commit the project.

  1. Go to the Environments page of the Developer Portal.

  2. Click Create package from Team Server to start the wizard.

  3. Select the branch on the Team server which you want to use.

  4. Select the revision of the branch you want to build.

  5. Add a version number and Tag description as required. The revision number will be added to the version number automatically.

  6. Click Build this revision to build the package.

When the package is ready to be deployed, a green tick will be shown next to the deployment package. To deploy your package, follow the instructions in the Deploy Package section, below.

4.2 Uploading MDA

Alternatively, you can upload an MDA which has already been created from the app model, for example using Create Deployment Package from the App menu in Studio Pro.

  1. Click Upload in the Deployment Package Repository.

  2. Select the package accessible to your local machine.

  3. Click Upload to upload the MDA.

    Upload button and dialog for uploading MDAs

The package will be added to the list of packages in the Deployment Package Repository. To deploy your package, follow the instructions in the Deploy Package section, below.

5 Deploy Package

5.1 Deploy to an Environment

  1. A green tick indicates that the build has finished. Click Deploy to deploy the package to SAP BTP.

  2. Change the deployment environment if required.

  3. The Timeout value indicates how long (in seconds) Cloud Foundry will wait between starting an app and the first healthy response from the app before deciding that the application has failed to start. For some apps, the default (60 seconds) is too short. If your app is failing to start you can try increasing this value using the Change timeout option.

  4. Click Transport to deploy the package to the SAP environment. This will replace any current app deployed to this environment. If the app is already running, you will be asked to stop it so that your new app can be deployed.

5.2 Configure the Application

  1. You will see confirmation of the package which has been transported.

  2. Change any constants in the Constants tab: select the constant you want to edit and then click Edit.

  3. Toggle any scheduled events in the Scheduled Events tab: select the scheduled event you want to enable or disable and click Toggle.

  4. Select any additional services you need for your app. For more information see Binding Services, below.

  5. Click Continue to continue to the Start Application confirmation page.

  6. Click Start Application to start the application on SAP BTP.

  7. When the application has been started you will receive a confirmation message. Click OK and you will be taken to the Environment Details page for the selected environment. See Environment Details, below.

5.3 Unbinding and Deleting Service Instances

If you want to remove a service instance from your environment, you can do it is follows:

  1. Click the three-dot menu for the service and select Unbind Service. This will unbind the service instance from the application and delete the instance.

6 Transport App Between Environments

  1. Click Transport on the source environment you want to transport to another environment. Environments without deployed apps will have the transport button grayed out and cannot be transported.

  2. Change the deployment environment if required by clicking Change environment.

  3. The Timeout value indicates how long (in seconds) Cloud Foundry will wait between starting an app and the first healthy response from the app before deciding that the application has failed to start. For some apps, the default (60 seconds) is too short. If your app is failing to start you can try increasing this value using the Change timeout option.

  4. Click Transport to deploy the package to the SAP environment. This will replace any current app deployed to this environment. If the app is already running, you will be asked to stop it so that your new app can be deployed.

When the app has been transported you will be on the page Configure the Application. This has the same options as the Deploy pages which are described above in the Configure the Application section.

7 Environment Details

The environment details page contains the following four tabs:

  • General – how the application is deployed on SAP Cloud Platform
  • Model Options – application constants and scheduled events
  • Services – Cloud Foundry service management
  • Runtime – custom environment variables which define “User-Provided Variables” in SAP cloud foundry environment — pre-defined variables can be used to control the behavior of the Mendix Runtime

Open the environment details by clicking Details on an environment on the Environments page of the Development Portal. You will also be taken to this page when you successfully deploy or transport your app.

7.1 General Tab

This tab contains information on how the application is deployed on SAP BTP.

Most of this page shows information about the app, but there are several options which allow you to change the app.

7.1.1 Start/Stop Application

If the application is running, click Stop Application and confirm when asked to stop the application.

The button will change to Start Application which you can click to (re)start the application.

If you receive an error trying to start the app, please refer to the App Will Not Start section under Issues, below.

7.1.2 Change Admin Password

Click Change Admin Password to change the password for the administrator account (by default, MxAdmin) in your Mendix app.

7.1.3 View Recent Log

Click View Recent Log to see recent events written to the log.

7.1.4 Delete Environment

Delete Environment enables you to delete the environment and, optionally, all its resources: including the app.

You will be asked to confirm that this environment should be removed. You will also be asked to confirm that the resources associated with the environment should also be removed. Note that the default is NOT to remove the resources.

7.1.5 Change Development Mode

Click Change to change the Development Mode toggle. Set it to Yes if you want the application to run with only prototype security, or completely without security. This is not recommended for acceptance or production environments.

7.1.6 Scaling

If the app is started or stopped (that is, the environment has been created successfully and the app has been deployed without errors) then options to scale the app are available.

Use the Instances slider to change the number of instances of the app which can run. This allows you to scale the app horizontally to support a large numbers of users, or to improve the app’s resilience by allowing it to continue to run if there are any issues with one of the instances.

Use the Memory per instance slider to change the amount of memory allocated to each instance of the app (“user’s current memory”).

Click Scale Now to apply the new settings. If the application is running, it will be stopped and restarted to apply the settings. If it is stopped it will not be started automatically; the new settings will be used the next time the application is started.

Click Reset to return the values to what they were before the sliders were moved.

7.1.7 Change License Subscription ID

Click Change to change the subscription secret which is the code which registers your production Mendix license to this environment.

7.2 Model Options Tab

This tab displays the application constants and allows you to edit them. It also lets you enable or disable scheduled events.

7.2.1 Scheduled Events

You can see the status of each scheduled event. CURRENTLY ENABLED shows the status in the running app. ENABLED shows that status that will be applied the next time the app is restarted.

To change the state of a scheduled event, select it, then click Toggle to change the ENABLED flag.

7.2.2 Constants

You can see the value of all the constants used by the app. CURRENT VALUE is the value in the running app. NEW VALUE is the value which will be used the next time the app is restarted.

To change a value, select the constant you want to change and click Edit.

7.3 Services Tab

This tab displays Cloud Foundry services which are bound to the app, waiting to be bound to the app, or available to be bound to the app. These are the services which are available to you in SAP BTP and are the same services that you can see in the SAP BTP marketplace.

7.3.1 Connecting Services

To connect a service in the section Available Services

  1. Select one or more services (you can search for them by name).
  2. Select a Plan for each service. This must be a plan which is part of your quota for this space.
  3. Select a JSON File to upload if you need to add extra configuration.
  4. Click Connect Services.

    The services you have selected will be added as Services To Be Bound. Now, you can upload JSON File with a configuration that will be applied to the service binding.

To upload the JSON File for service binding, follow these steps:

  1. Select the service in the Service To Be Bound section.
  2. Click the ellipsis () next to the service for which you want to upload the file.
  3. Select Add Binding Configuration.
  4. Select the JSON File to upload.
  5. Click Save.

The service bindings will be created with the provided configurations when you restart the application.

If you receive an error trying to restart the app, please refer to the App Will Not Start section under Issues, below.

7.3.2 Unbinding and Removing Services

If you no longer require a service you can unbind it or remove it from your app.

Unbinding a Service

  1. Click the ellipsis () next to the service you want to unbind in the Bound Services section.
  2. Select Unbind Service.

  3. Confirm by clicking Unbind & Restart App – if you want to unbind more services or do not want the change to happen immediately, then you can choose Unbind. However, this may leave the app in an unstable state.

    Once the service is unbound, it is deleted from the app environment and returned to the list of Available Services.

Removing an Unbound Service

  1. Click the ellipsis next to the service you want to remove in the Services To Be Bound section.

  2. Select Remove Service.

  3. Confirm by clicking Remove

    The service is deleted from the app environment and returned to the list of Available Services.

7.3.3 Service Names

The services which are created by the Mendix Developer Portal will be named automatically. You will see these names in the SAP BTP cockpit. The name of the service will normally be App name + _ + Environment Name + _ + a random 6-character suffix. All spaces will be removed from the app and environment names. For example, MyApp_Development_c7sd9q.

However, the maximum length for the service name is 50 characters. If this limit would be exceeded by the name created above, an alternative service name will be used. The format of this is Environment Name + _ + a random 6-character suffix. If the Environment name is longer than 43 characters, only the first 43 characters are used.

7.4 Runtime Tab

Use the Custom Environment Variables to add, Edit, or Delete an environment variable.

7.4.1 Supported Environment Variables

You can choose to add supported variables by selecting them from a drop-down list.

  • DT_PAAS_TOKEN – the token for integrating your Dynatrace environment with Cloud Foundry
  • DT_SAAS_URL – the monitoring endpoint URL of the Dynatrace service
  • DT_TENANT – the unique identifier of your Dynatrace environment

List of custom environment variables

The variables beginning DT_ set up Dynatrace. Setting these variables means that the Dynatrace OneAgent is loaded into your environment. You will then receive all J2EE-related metrics from your app. See Dynatrace OneAgent for more information.

7.4.2 Unsupported Environment Variables

You can also enter other environment variables which can be used to support Mendix features which are in Beta. In this case, click No for Supported and enter the name of the variable as well as its value.

List of custom environment variables

8 Databases in SAP BTP

Mendix needs access to a relational database backend and can run using different types of database. For deployment to SAP BTP, you have the choice of PostgreSQL or SAP HANA.

8.1 Running Mendix on PostgreSQL

When you create your environment on SAP BTP, you can still select a PostgreSQL database. You can use either the PostgreSQL on SAP BTP database or the AWS RDS PostgreSQL database.

8.1.1 Running Mendix on PostgreSQL on SAP BTP

One option is to use the PostgreSQL on SAP BTP database.

You will need to upload a file which contains the configuration for this database – click Browse… to select your configuration file. You can use the SAP Hyperscaler PostgreSQL Configurator to help you create the configuration file and find more information in the Parameters section of PostgreSQL on SAP Business Technology Platform, Hyperscaler Option in the SAP Help Portal.

During the creation of the environment, the selected PostgreSQL service will be added to your space and, when you deploy your app, the app will be bound to the PostgreSQL service.

This database service should not be unbound from your environment: see Services Tab, above, for more information on required services.

8.1.1.1 SAP Hyperscaler PostgreSQL Configurator

To get help to create the configuration file, click the Configurator button.

On the new page which is displayed you can set the required values for your SAP Hyperscaler PostgreSQL database. Tooltips describe the values which you need to provide.

Click Generate Configuration File to create the file which you can then use on the Services tab to configure your PostgreSQL database.

8.1.2 Running Mendix on AWS RDS PostgreSQL

It is also possible to set up a PostgreSQL database on Amazon Web Services (AWS) to hold the data for your app. Instructions for doing this to support an app deployed to SAP BTP are available on the SAP Help Portal here: PostgreSQL on Amazon.

To use this database for your Mendix app, you will need to choose AWS RDS PostgreSQL when specifying your environment on SAP BTP.

You will also have to provide Configuration JSON to enable your app to find the database. The configuration file will be similar to the example shown below:

{
   "adminPassword": "AdminPassword",
   "adminUsername": "AdminUsername",
   "backupRetentionPeriod": 14,
   "dbEngineMajorVersion": "9.6",
   "dbInstanceType": "db.t2.micro",
   "dbName": "mynewdb",
   "multiAz": true,
   "resourceTechnicalName": "aws_account_name",
   "storageEncrypted": false,
   "storageGb": 20
}

8.2 Running Mendix on SAP HANA

8.2.1 SAP HANA Configuration for Full Accounts

To run a Mendix application on SAP BTP using SAP HANA as the database, there are two options. Both these options need to be set up in the SAP BTP cockpit. The two options are:

  • provision the SAP HANA DB Service and make it available in your application space

  • provision SAP HANA Cloud and make this service available to your application space

Once one of these services is available, you can use the SAP Cloud deployment functions of the Mendix SAP Developer Portal to deploy your app and use the HANA_SCHEMA service to bind your application to the provisioned service. The HANA_SCHEMA will create a separate schema on the SAP HANA Database which isolates your application’s data from other applications. In this way the SAP HANA DB/Cloud Service will be shared across applications.

If you have issues with your app running on SAP HANA, you will need to use the SAP BTP cockpit to investigate. The Mendix Developer Portal does not have information on the status or configuration of the SAP HANA service.

8.2.2 SAP HANA Configuration for Trial Accounts

For trial accounts which have the SAP HANA Schemas & HDI Containers (Trial) services, you can bind your Mendix app to a trial SAP HANA database. Just choose hanatrial-schema from the drop-down of supported databases.

If your trial account does not include the hanatrial schema, you will get an error when you try to deploy your Mendix app saying that provisioning has failed because service hanatrial with plan schema is not found.

9 Issues

9.1 Environment is not Created

If you add an environment and it fails to be created it will be shown with a red symbol next to it on the Environments page:

This could be caused by exceeding your organization quota limit for a service which you are trying to create, or for some other reason. To find the exact cause, do the following:

  1. Click Details next to the failed environment.

  2. Click Details on the error message at the top of the page.

A more detailed description of the reason why the environment creation failed will be displayed.

9.2 Deleting an App

Note that if you are the last person to leave a Mendix app you can delete the app. However, this will not delete the app or resources on SAP BTP. You can leave the app by going to the General Settings page of the Developer Portal and clicking Leave app.

If you are the last member of the app development team, you will be asked if you want to delete the app.

You can still delete the app and its resources from the SAP BTP cockpit, but you will then have to remove all the resources individually.

9.3 App Will Not Start

Under some circumstances an app with a service in the Services To Be Bound status will not restart. You will get an error with Could not bind service… in the details.

This indicates that SAP Cloud Portal is not able to bind the service, even though it has been instantiated correctly. If you remove the service from the app, then the app should restart successfully.

If you are trying to bind more than one new service, it is not possible to identify within the Developer Portal which service is causing the issue. If the culprit is not obvious, you will have to remove all the services or go to SAP Cloud Portal where you can use the service name in the error message to find which service is causing the error.

9.4 An Error Occurs While Deploying App From Studio Pro

If an app is deployed to SAP using the Studio Pro Run or Publish button before it has been started from the Developer Portal, the deployment will fail. This is because the marketplace services have not been bound.

If you use the Developer Portal to look at the details of the environment to which you are deploying, you will see that the services are still waiting to be bound.

Start the app from the Developer Portal to bind the services. Once they are bound, you can deploy your app from Studio Pro, as usual.

10 Status of SAP BTP Deployment

The Mendix status page (https://status.mendix.com/) shows the current status of Mendix services. If you have issues with deploying to SAP BTP via the Developer Portal, you can check the Mendix status page to see if SAP BTP deployment is operational (under Mendix Services) or if there are other Mendix issues which may be affecting your deployment.

11 Read More