MxBlog

Continuous deployment for your Mendix App

I got some questions recently from on-premises Mendix users how to handle continuous deployment for Mendix applications, mostly using Jenkins.

On linux you can use the m2ee tool in a shell script to automatically deploy a .mda file. The following bash script illustrates the basic workflow:

#!/bin/bash
MDA_PATH=$(dirname $1)
MDA_FILE=$(basename $1)
echo Deploying $MDA_FILE from $MDA_PATH
#
# stop application
#
m2ee stop
#
# unpack application
#
cp $MDA_PATH/$MDA_FILE /home/mendix/app/data/model-upload
m2ee unpack $MDA_FILE <<EOS
y
EOS
#
# start application, update database
#
m2ee start <<EOS
e
EOS

The basic steps are:

This script expects the .mda file to be available on the filesystem, but you could also download it from an ftp server or something like Nexus using wget or curl.

Another step you should add to this script if you care about your data is a database backup step.

Regarding the automated build of your .mda file; as of Mendix 5 a build tool is included with the Mendix Modeler: mxbuild.exe. You can use it to create .mda files from your project. It is written in .Net, build should run on Mone, so you can even automate your build on Linux.