Mendix On AWS

Provisioning a Mendix server instance on AWS EC2 we will use the base Amazon AMI image (flavor of CentOS).

Launch AWS EC2 Instance

$ sudo yum update

Installing Mendix Server/Tools on CentOS

Add additional repo location mendix.repo

$ sudo vi /etc/yum.repos.d/example.repo

[mendix]
name=Mendix
baseurl=”https://packages.mendix.com/platform/rpm/”
gpgcheck=0

$ sudo yum install m2ee-tools

Oracle Java JRE 8

JRE 8 is required for Mendix 6 and above. Below is the commands to grab linux-x64. Reference the link below to the Oracle downloads page for latest version.

sudo su

$ cd ~/

$ wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” \ “http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jre-8u151-linux-x64.rpm”

Perform localinstall

$ sudo yum localinstall jre-8u151-linux-x64.rpm

Citation: https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Python Requirements

Check version

$ sudo su

# python --version
# pip install httplib2
Confirm
# pip list

Examples of m2ee config files are located at: /usr/share/doc/m2ee-tools-0.5.11.4/examples

Deployment Location

It’s highly recommended to create a separate user per mendix application you want to run on the application server. adduser example on m2ee-tools documentation does not have the same flags. –disabled-password and –gecos citation: https://github.com/mendix/m2ee-tools/blob/develop/doc/install-2.md

$ sudo adduser myfirstappz

Create filesystem location for the Mendix app

$ sudo mkdir -p /srv/mendix/myfirstappz
$ cd /srv/mendix/myfirstappz
$ sudo mkdir runtimes/ web/ model/ data/ data/database/ data/files/ data/model-upload/ data/tmp/
$ sudo chown myfirstappz:myfirstappz * -R
$ sudo chmod 700 model/ data/
$ sudo tree

AWS issue, this file structure methodology will not scale, need to consider other options on how to redeploy this in a stateless matter.

Configuring The Application

Going through the documentation on m2ee-tools, notes below. Note: might have to login as the app user (myapp) or root due to permissions https://github.com/mendix/m2ee-tools/blob/develop/doc/configure.md

Copy & Configure m2ee.yaml

$ cd /usr/share/doc/m2ee-tools-0.5.11.4/examples
$ mkdir ~/.m2ee
$ cp user-specific-m2ee.yaml ~/.m2ee/m2ee.yaml
$ sudo vi ~/.m2ee/m2ee.yaml

Config for m2ee goes in: ~/.m2ee/m2ee.yaml

Configuring NGINX

example config provided, lacks setting up nginix for this scenario.
https://github.com/mendix/m2ee-tools/blob/develop/doc/nginx.md

aws ubuntu example:
https://www.nginx.com/blog/setting-up-nginx/

$ sudo yum update
$ sudo yum install -y nginx
$ sudo service nginx start

example: http://ec2-34-212-160-182.us-west-2.compute.amazonaws.com/

configure nginx for myfirstappz

$ sudo vi /etc/nginx/nginx.conf

Set the Server->root to /srv/mendix/myfirstappz/web/

$ sudo nginx -s reload

Deploy Mendix App

Example MDA file on s3: https://s3-us-west-2.amazonaws.com/agents.exprealty.com/mda/mendixtest.mda

project location:

$ su myfirstappz myfirstappz@ip $ cd /srv/mendix/myfirstappz/data/model-upload
myfirstappz@ip $ wget https://s3-us-west-2.amazonaws.com/agents.exprealty.com/mda/mendixtest.mda

Launch m2ee and unpack the mda file

myfirstappz@ip $ m2ee
unpack mendixtext.mda

Run Mendix App For First Time

$ su myfirstappz
myfirstappz@ip $ m2ee
download_runtime
start

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax