Mendix on AKS — A Missing Documentation

This is a missing document that i would like to share. There are around 6 steps to make Mendix application to be on AKS.

The architecture would look like this

Image for post
Image for post

In this scope i do not authenticate with azure active directory, cause in Mendix application we can have a ldap module in order to login to Mendix application via ldap users.

This article is using Azure Database for Postgres

Install azure cli:

cmd: brew update && brew install azure-cli

result:

Image for post
Image for post

verify azure cli version:

Image for post
Image for post

verify kubectl at client:

Image for post
Image for post

Let’s start with these steps below

Method 1: using az cli command

Create resource group

az group create — name myResourceGroup — location eastus

Create aks service

az aks create — resource-group myResourceGroup — name myAKSCluster — node-count 1 — enable-addons monitoring — generate-ssh-keys

Create resource group

Image for post
Image for post

Create Kubernetes service

Image for post
Image for post
Press Add to create new Kubernetes Service
Image for post
Image for post
Select the resource group which created in the step above, using standard DS1 v2 for free account
Image for post
Image for post
scale option for whole vm sets
Image for post
Image for post
Image for post
Image for post
select advance option
Image for post
Image for post
Image for post
Image for post
final, press create

Step 2- Create azure container registry, build Mendix to ACR, and Create Azure SQL for Postgres

Create ACR

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Registry name: myMendixRegistry

Login server: mymendixregistry.azurecr.io

Adminuser: myMendixRegistry

Password: Rx67wvUMa95R/LqVW8sB9Vbv4OoikPp2

Password2: RBRy+HJB6vPB5B1=RA64DkXT=xQVNwRw

Download this https://github.com/mendix/docker-mendix-buildpack

// Note: need dot at the end

// You need to copy all mendix project under buildpack, otherwise it wont able to find the path

Image for post
Image for post

docker build — build-arg BUILD_PATH=./DashboardUImain -t dbv002 .

// to see what have been build

docker images

Image for post
Image for post

// login

docker login -u myMendixRegistry mymendixregistry.azurecr.io

Image for post
Image for post

// tag the image

docker tag dbv002 mymendixregistry.azurecr.io/v002:v02

docker images

Image for post
Image for post

docker push mymendixregistry.azurecr.io/v002:v02

Image for post
Image for post

Make a new resource group

Image for post
Image for post

Create a new DB under the new resource group

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Virtual Network and subnet should be added into DB Rule

Image for post
Image for post

Test Client DB Connection

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Create a db instance for Mendix App

Image for post
Image for post
Image for post
Image for post

So now, you can connect to azure postgres via pgadmin client and create a new database for mendix application, we will need to use this name to add into mendix secret yaml file.

You have prepare these manifest below:

Image for post
Image for post

I will explore it later, now we need to convert some parameters to base 64.

I mostly used this web site to encode the string to based 64.

postgres endpoint:

postgres://mendix@mymendixdb:Admin123@mymendixdb.postgres.database.azure.com:5432/dashboarddb

postgres endpoint base64:

cG9zdGdyZXM6Ly9tZW5kaXhAbXltZW5kaXhkYjpBZG1pbjEyM0BteW1lbmRpeGRiLnBvc3RncmVzLmRhdGFiYXNlLmF6dXJlLmNvbTo1NDMyL2Rhc2hib2FyZGRi

password Mendix admin(MxAdmin):

Admin@123

password Mendix admin base64:

QWRtaW5AMTIz

So now we take a look of each yaml file

mendix-app-secrets.yaml

Image for post
Image for post

mendix-app-service.yaml

Image for post
Image for post

mendix-app.yaml

Image for post
Image for post
Note: declare image registry, and the secret

helm-rbac.yaml

Image for post
Image for post

mendix-ingress.yaml

Image for post
Image for post
Note: you need to have public hostname. and your service name should be same as mendix-app-service.yaml name

I think we’re almost done, let connect to aks then do the deployment

// login

az login

Image for post
Image for post

// connect to AKS (Please be careful of copy and paste, there are 2 dash, take a look a picture for every steps)

az aks get-credentials — name myAKSCluster — resource-group myResourceGroup

Image for post
Image for post

// open Kubernetes dashboard

az aks browse — resource-group myResourceGroup — name myAKSCluster

Image for post
Image for post
Image for post
Image for post

Done now you can open the kubernetes dashboard, however the purpose is not looking at this. We haven’t deploy anything yet. Now let’s start doing some secret files first.

Create Docker Registry Secret for Mendix

docker-secret.yaml

kubectl create secret docker-registry — dry-run=true docker-secret \
— docker-server=mymendixregistry.azurecr.io \
— docker-username=myMendixRegistry \
— docker-password=Rx67wvUMa95R/LqVW8sB9Vbv4OoikPp2 \
docker-email=qntbkk@gmail.com -o yaml > docker-secret.yaml

Image for post
Image for post
Image for post
Image for post

First of all, let’s check the working node, before applying the manifest.

kubectl get nodes

Image for post
Image for post
Image for post
Image for post

helm install stable/nginx-ingress

Image for post
Image for post

all look great

Image for post
Image for post

get pods status

Image for post
Image for post

apply ingress

Image for post
Image for post

checking mendix app runtime

Image for post
Image for post

When you have a kubernetes public ip then you can able to create a dns name

Image for post
Image for post

Then can launch an app with the url below:

http://apptest-mendix.eastus.cloudapp.azure.com/login.html

Done App is running

Image for post
Image for post

Note: You may using a postgress container in another pods with pv and pvc.

good luck ^^

Programmer, Technical @ TBN Software

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store