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
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
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:
Open the Modeler, click Run, and select Edit Cloud Foundry Settings:
In the credentials section of the Edit Cloud Foundry Settings configuration window, do the following:
- Enter an API endpoint depending on your location:
- Enter your IBM Bluemix username for the User name
- Enter your IBM Bluemix password for Password
Click Next. You will be logged into the IBM Bluemix Cloud Foundry installation.
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
Click Next. The app will be created in the IBM Bluemix environment.
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
- 5 Add a Database Service to Your App
- 6 Add a FileStore Service to Your App
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
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.
Click Create Service:
Mendix has support for DB2, DashDB, Compose For PostgreSQL, ClearDB MySQL, and ElephantSQL on Bluemix. Select ElephantSQL for this setup:
Select the plan that fits your needs. This example will use the Free option:
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
Click Create to finish the service configuration for ElephantSQL.
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.
Go to the Bluemix environment.
Open your app from the list on the home screen:
Go to the Connections menu item and click Connect new:
Select the Object Storage service from the catalog:
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:
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.
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
- Open the Modeler.
- Open the app you want to deploy to Cloud Foundry.
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.
If you encounter any problems, you should consult the application logs:
- Go to the IBM Bluemix environment.
Open your app from the top menu:
Go to the Logs menu item and view the most recent log lines in real time: