Deploy a Mendix App to IBM Bluemix

5 minutes to read Download PDF Edit

1 Introduction

This how-to will focus on deploying to the IBM Bluemix platform.

This how-to will teach you how to do the following:

  • Configure Cloud Foundry in the Modeler and the IBM Bluemix environment
  • Add services to the app
  • Deploy your app to Cloud Foundry
  • Troubleshoot

2 Prerequisites

Before starting this how-to, make sure you have completed the following prerequisites:

  • Download the latest version of the Mendix Modeler from the Mendix App Store
  • Have access to an IBM Bluemix account with the rights to create new applications and services (if you’re not a current IBM Bluemix customer, you can sign up for a free 30-day trial)
  • Set up a strong administrator password within your model

3 Configure Cloud Foundry in the Modeler

To push a Mendix app to Cloud Foundry, you have to configure the settings in the Modeler.

To configure Cloud Foundry in the Modeler, follow these steps:

  1. Open the Modeler, click Run, and select Edit Cloud Foundry Settings:

  2. In the credentials section of the Edit Cloud Foundry Settings configuration window, do the following:

  3. Click Next. You will be logged into the IBM Bluemix Cloud Foundry installation.

  4. In the app selection section of the Edit Cloud Foundry Settings configuration window, do the following:

    • Select the organization you want to use (for example, Mendix) for Organization
    • Select the space you want to deploy your app to (for example, staging) for Space
    • Select Create new app
    • Enter a name for your new app (for example, company-expenses) for App name

  5. Click Next. The app will be created in the IBM Bluemix environment.

  6. In the final section of the Edit Cloud Foundry Settings configuration window, do NOT click Finish until you have completed the configuration steps in the following sections:

4 Configure the IBM Bluemix Environment

To configure the IBM Bluemix environment, go to IBM Bluemix and log in with your IBM Bluemix credentials:

After logging in, you will see the Bluemix home screen. The following details on this screen are important:

  • This view is per region, and you can select a different region in the personal menu in the top-right corner of the screen
  • You can see that you are logged in at the top-right corner of the screen
  • You can see the organization you have access to and the spaces within that organization at the top-right side of the screen

5 Add a Database Service to Your App

Apps make use of services (for example, databases, load balancers, and memory tools). In this step, you will add a database service that your app will use to store data. A Database is mandatory for a mendix app to run.

  1. Click Create Service:

  2. Mendix has support for DB2, DashDB, Compose For PostgreSQL, ClearDB MySQL, and ElephantSQL on Bluemix. Select ElephantSQL for this setup:

  3. Select the plan that fits your needs. This example will use the Free option:

  4. In the Add Service section of the screen, do the following:

    • Select the app to which you want to bind the database instance (for example, company-expenses) for App
    • Enter the name of the ElephantSQL Database (for example, ElephantSQL_7k) for Service name
  5. Click Create to finish the service configuration for ElephantSQL.

6 Add a FileStore Service to Your App

To enable persistent file storage, you need to configure the IBM Swift Object Storage service (which was introduced in Mendix 6.8). To make sure the FileDocuments in your application persist, you need to attach this service to your application.

  1. Go to the Bluemix environment.

  2. Open your app from the list on the home screen:

  3. Go to the Connections menu item and click Connect new:

  4. Select the Object Storage service from the catalog:

  5. Create the service:

    This can take a few seconds. After the service is created, you can check if it is connected.

    After deploying an app from the Modeler, two variables will be added automatically: DEVELOPEMENT_MODE and ADMIN_PASSWORD. The development mode is true by default; change this to false to run the app in production. The admin password is the password of the default admin of your Mendix app.

  6. You can now go back and click Finish in the final section of the the Edit Cloud Foundry Settings configuration window (see step #6 of 3 Configure Cloud Foundry in the Modeler).

7 Deploy Your App to Cloud Foundry

  1. Open the Modeler.
  2. Open the app you want to deploy to Cloud Foundry.
  3. Click the arrow for the Run options and select Run on Cloud Foundry:

    The Mendix app will now be deployed to the configured Cloud Foundry installation and started automatically.

8 Troubleshooting

If you encounter any problems, you should consult the application logs:

  1. Go to the IBM Bluemix environment.
  2. Open your app from the top menu:

  3. Go to the Logs menu item and view the most recent log lines in real time: