continuous integration using Mendix

0
How can we achieve continuous integration using Mendix for on-premise deployment after every commit?
asked
5 answers
4

Version 4.3 of the windows service console contains a number of scriptlets that let you automate starting/stopping the runtime in windows powershell. From the readme:

Added support for Powershell with the following cmdlets, Get-MxApp, Start-MxApp, Stop-MxApp, Update-MxApp, Install-MxServer. These cmdlets are located in the Mendix.Service.Commands.dll in the installation folder of the Mendix Windows Service.

 

To install these powershell cmdlets, start powershell and run the command:

Import-Module 'C:\Program Files (x86)\Mendix\Service Console\Mendix.Service.Commands.dll'

Every command comes with help information:

PS C:\Users\ako> Start-MxApp -?

NAME
    Start-MxApp

SYNTAX
    Start-MxApp -InputObject <App[]> [-SynchronizeDatabase]  [<CommonParameters>]

    Start-MxApp [[-Name] <string[]>] [-SynchronizeDatabase]  [<CommonParameters>]

    Start-MxApp -All [-SynchronizeDatabase]  [<CommonParameters>]


ALIASES
    None


REMARKS
    None


List of commands:

  • Start-MxApp
  • Stop-MxApp
  • Update-MxApp
  • Install-MxServer
  • Get-MxApp
answered
2

Hi Pranay,

The MxBlog.eu website has a post on how to automate the process of creating a mda file, and one on continuous deployment for your Mendix App. With tools like Jenkins or Bamboo you can connect a source repository (https://teamserver.sprintr.com/{projectid}, define triggers (such as a commit, or at certain time every day), and define a plan (e.g. code checkout, create mda (use mxbuild tool) and deploy).

I'm trying to set this up on a windows server. I've got bamboo set up for code checkout, you can add the mxbuild tool as a build tool in Bamboo and generate a MDA. But I don't have a script yet for stopping the Mendix service, unpacking MDA, starting service and synching database and such for Windows Server. This is however in raw format available from Linux servers.

However if you run Mendix in the Cloud options offered by Mendix these steps (create mda from commit, select environment and deploy), can easily be done with a few clicks in Sprintr (except triggering automated testing).

I'm curious about your findings on this matter, please keep us updated on your issues/progress/solutions! Since I'm still in experimenting fase with this as well..

With kind regards, Stephan

answered
1

In the windows service console 4.3 Mendix has added the following:

Added support for Powershell with the following cmdlets, Get-MxApp, Start-MxApp, Stop-MxApp, Update-MxApp, Install-MxServer. These cmdlets are located in the Mendix.Service.Commands.dll in the installation folder of the Mendix Windows Service.

Using these cmdlets should hopefully help you build a script to manage the server.

Also you can use these example scripts to help you build and deploy your application to the Mendix cloud:

https://world.mendix.com/display/apidocs/Example%20implementation

It shouldn't be too difficult to implement using these examples.

answered
1

Hi Pranay,

Maybe the following functionalities can be helpful? (partially explained in the mxblog.eu link in the Answer posted by Stephan above)

  • mxbuild.exe has some nice features. you could run mxbuild.exe --help for usage information. As of Mendix 6.4.0 mxbuild.exe has support for consistency error checking. It will return a JSON string when there are Consistency Errors in the project (JSON list of Errors, warnings, deprecations)
  • mxconvert.exe (usage info: run mxconvert.exe --help) As of Mendix 6.4.0 there is a mxconvert.exe bundled. It can automatically convert a (set of) project(s) to this Mendix version.

Both executables are located in C:\Program Files\Mendix\Mendix x.y.z\modeler

answered
1

I've found the best way to create a continuous integration process is to write a script (I used Groovy) that calls the APIs which can check for new commits, build deployment packages, deploy a new build, and run unit tests.

I would imagine Mendix will build this into the platform at some point, but this is a good solution for now. I run this script every five minutes in a cron job.

answered