Mendix application in the Openshift private cloud solution (part 1) registration cluster

 

Lead

Mendix for Private Cloud extends the company's cloud-native architecture to any privatized configuration or data center. Mendix for Private Cloud running on Kubernetes can meet the specific security, compatibility or data integration requirements of enterprise private clouds or hybrid clouds. Developers can collaborate, test, monitor, and deploy applications to Mendix for Private Cloud or any other cloud target. You can specify Kubernetes and Openshift private cloud clusters in the Developer Portal to deploy, manage, and monitor Mendix applications.

 

01. Introduction

Mendix For Private Cloud officially supports the following platforms: Red Hat Openshift, Amazon Elastic Kubernetes Service (AWS-EKS), Azure Kubernetes Service (AKS). This solution is different from the traditional deployment in K8S and Openshift, which is mainly reflected in the complete devops closed loop of app packaging, construction, environment selection, deployment, elastic scaling, monitoring, and management through Developer Portal deployment. It mainly introduces solutions based on the Openshift platform, and also briefly introduces the corresponding operations of other platforms.

Achieving this goal requires two steps, as shown below.

Registering Your Cluster

The first step is to register the private cloud cluster in the developer portal. For details, see Registering a private cloud cluster.

Deploying Your App

The second step is to deploy the application. You have two options:

  • You can deploy the application from the developer portal. For more information, see Deploying Mendix applications to a private cloud cluster from the developer portal.

  • You can create a CI/CD pipeline and deploy applications in the cluster. For more information, see Deploying Mendix applications to a private cloud cluster using the command line.

We are mainly introducing the first way, deploying applications from the developer portal.

 

02. Register a private cloud cluster

To allow you to manage the deployment of applications to Red Hat OpenShift and Kubernetes, you first need to register the cluster in the Mendix Developer Portal. This will provide you with the information needed to deploy Mendix operator and Mendix gateway agent in the context of OpenShift, and create a link to the Mendix application environment page through Interactior.

Prerequisites for registering a cluster

  • Kubernetes platform or OpenShift 3.11 or higher

  • Private mirror warehouse registry that supports https authentication

Register the cluster

Get script

1. Select Cluster Manager from the Apps menu of the developer portal

 2. Click to register cluster

3. Enter the following information

  1. Name – The name to be provided for the cluster being registered.
  2. Namespace-This is the namespace in your platform.
  3. Type – Choose the correct type for the cluster.
  4. Installation type-If you want to create an environment and deploy an application from the Mendix developer portal, please select "Connected", but if you only want to use the CLI to control the deployment through Mendix operators, please select "Standalone".

4. Click Done

openshift type

 

kubernetes type

 

Run the installed script

You need to have administrator rights to the private cloud platform, which means you must log in before running the installation script.

1. Signing in to OpenShift

These instructions apply to the OpenShift platform; other platforms require similar procedures.

To run the installation script on OpenShift, you must log in to OpenShift using the OpenShift CLI before running the script in Bash.

You can do the following:

  • Log in to the OpenShift console.

  • Click "Copy Login Command" in the "User" drop-down list

 

  • Paste the command into Bash and press Enter

 

2. Executing the Installation Script

To execute the installation script:

  • Copy the mounting foot created for you by clicking "Copy to Clipboard"

  • Paste the script into the Bash console and press Enter to run the script

 The response to the script should look like the image below. You can see that the script installed the following

a.mendix-agent

b.mendix-operator

If the response ends with Installation Successful., the installation is successful.

Mendix operator and Mendix agent are now installed on your platform. If you view the project resources in the OpenShift console, you can see the mendix operator and mendix agent resources.

The installation script can always be found again in the "Installation" tab of the cluster in the Cluster Administrator.

 

3. Running the Reconfiguration Script

Before deploying the application to the namespace, many services need to be configured, namely:

  • database

  • file storage

  • proxy

  • registry

  • ingress (network)

Mendix provides you with a script that will configure these scripts initially, and you can rerun these scripts anytime you wish to change the configuration.

  • Copy the reconfiguration script created for you by clicking "Copy to Clipboard".

  • Press Enter to start the script.

You will be asked a series of questions. Type the number corresponding to your choice, or enter the desired value.

 

(1) What do you want to do?

If this is the initial configuration, please select 1, and the system will guide you through all the items that need to be configured.

If there are already configurations, but you want to reconfigure part of them, please select 2. If you select this option, you can navigate directly to the object you want to configure, which is one of the following objects:

  • Database

  • Storage

  • Ingress

  • Registry

  • Proxy

When a cluster is reconfigured using a database or storage, in addition to any services that have been set up, new services will be added. These plans will then be added to the developer portal and can be used when creating an environment for the application, unless you specifically deactivate them.

You can return to the original question from any other question by selecting "Return to available starting position".

 

(2)  Pick a database type

Postgres will allow you to enter values ​​to configure the PostgreSQL database. You need to provide all the information about the PostgreSQL database, such as plan name, host, port, database, user, and password.

If the plan already exists, you will receive an error that it cannot be created. This is not a problem, you can continue to use the plan, and it will now have a new configuration.

For example: a postgers database can be created by the following command

docker run --name postgres-private-mendix -e POSTGRES_PASSWORD=123456 -e POSTGRES_USER=mendix -e POSTGRES_PASSWORD=mendix  -p 5432:5432 -d postgres 

Ephemeral will enable you to quickly set up the environment and deploy applications, but when you restart the environment, any data stored in the database will be lost.

 

(3) Pick a storage type

Minio will connect to Minio S3 compatible object storage. You need to provide all the information about your MinIO storage, such as endpoints, access keys, and secret keys. The MinIO server needs to be a fully functional MinIO server, not a MinIO gateway. (Minio is an object storage server released under Apache License v2.0. It is compatible with Amazon S3 cloud storage service. It is best suited for storing unstructured data such as photos, videos, log files, backups, and container/VM images. Objects The size can be from a few KB to a maximum of 5TB).

##server端安装wget https://dl.minio.io/server/minio/release/linux-amd64/miniochmod +x minio./minio server /data

Note that the appkey secretkey displayed at startup is the default login account and password

Browser access: http://ip:9000

Amazon S3 will connect to the AWS account to create an S3 bucket and associated IAM account. Each application will receive a dedicated S3 bucket and an IAM account, which can only access specific S3 buckets. You need to provide all the information about Amazon S3 storage, such as plan name, region, access key, and secret key. The associated IAM account needs to have the following IAM policy (replace <account_id> with your AWS account number):

{
   
   "Version": "2020-4-17","Statement": [{
   
   "Sid": "bucketPermissions","Effect": "Allow","Action": ["s3:CreateBucket","s3:DeleteBucket"],"Resource": "arn:aws:s3:::mendix-*"},{
   
   "Sid": "iamPermissions","Effect": "Allow","Action": ["iam:DeleteAccessKey","iam:PutUserPolicy","iam:DeleteUserPolicy","iam:DeleteUser","iam:CreateUser","iam:CreateAccessKey"],"Resource": ["arn:aws:iam::<account_id>:user/mendix-*"]}]}

Ephemeral will enable you to quickly set up the environment and deploy applications, but when you restart the environment, any data objects you have stored will be lost.

 

(4)Pick an ingress type

OpenShift Route will set OpenShift Route. This can only be used for OpenShift clusters.

Ingress will configure the entrance according to the other domain names you provide.

Both forms of entry can enable or disable TLS.

 

(5)Pick a registry type

You can choose one of the following registry types. The OpenShift registry can only be used for clusters on the OpenShift platform. AWS ECR can only be used in AWS EKS clusters. For some of these registries, you may need to provide other information, such as pull URL, push URL, name, and secret.

  • OpenShift 3 Registry

  • OpenShift 4 Registry

  • Amazon Elastic Container Registry (AWS ECR)

  • Generic registry with authentication (this should either be Public or should have image pull secrets enabled).

  • Generic registry without authentication

pull_url:

service+port地址:docker-registry.default.svc.cluster.local:5000

The above address needs to be added in /etc/docker/daemon.json

"insecure-registries":["docker-registry.default.svc.cluster.local:5000"]

 

If it is the registry of Alibaba Cloud, then pushing will report an unsupported error

 

(6)Do you want to configure the proxy

If you need a proxy to access the public internet from the cluster, select "Yes"; you will be asked to provide proxy configuration details.

  • Select one of the apps on the developer portal, and then click Cloud Settings on the Settings page of the Mendix app.

 

  • Click Mendix for Private Cloud

  • Click Set up Mendix for Private Cloud

 

Confirming Cluster Configuration

After the cluster is properly configured, its status will change to Connected . If the screen does not update automatically, you may need to click the refresh button.

 

03. Current restrictions

Storage provisioning

If the operator fails to set or unset the storage (database or file storage), the operation will not be retried. If there is a failed *-database or *-file, you need to perform the following operations:

  • Check the failed pod log for error messages.

  • Troubleshoot and fix the cause of this error.

  •  Delete the failed pod to retry the process again.

 

04. Troubleshooting

This section covers issues that may arise when Mendix cannot recover automatically and manual intervention may be required.

Status Reporting

In some cases, changes in the state of the cluster and its environment are not automatically updated. To ensure that you see the current status, you may need to click the refresh button on the screen (instead of the browser page refresh button).

 

Agent Connection Status Not up to Date

The cluster status may show as waiting for connection even though the agent is actually connected to the cluster. The agent needs to be restarted to force it to reconnect.

Run the following command in the namespace where the Mendix operator is deployed:

  • OpenShift type

oc scale deployment mendix-agent --replicas=0 && \sleep 200 && \oc scale deployment mendix-agent --replicas=1
  • Kubernetes type

kubectl scale deployment mendix-agent --replicas=0 && \sleep 200 && \kubectl scale deployment mendix-agent --replicas=1

 

05. Containerized Mendix Application Architecture

In a cluster, you can run one or more Mendix applications. Every application runs in a namespace. You can see the relationship between the Mendix environment and the Kubernetes namespace in the figure below.

Because you can run multiple Mendix applications in the same cluster, each application must have a unique name. In addition, the application cannot have the same name as the Mendix Operator used to deploy the application.


For more information, please visit the following link:

Mendix official website: https://www.mendix.com/zh/

Mendix industry solutions: https://solutions.mendix.com/

Mendix platform guide: https://www.mendix.com/evaluation-guide/

Mendix animation display: https://www.mendix.com/demos/

Mendix public account

 

thanks for reading!

Guess you like

Origin blog.csdn.net/Mendix/article/details/115251816