본문 바로가기
IT/kuberntes

쿠버네티스 환경에서 Mendix app 적용하기 ( 성공!!!)

by 가능성1g 2024. 7. 29.
반응형

2024-08-01

드디어 성공했습니다!!!

오류는 모두 멘딕스 설정관련이었네요.

1. MendixAdmin 암호가 base64 인코딩이 안되었었다.

2. MendixAdmin 암호에 대문자가 안들어갔다!

좀 허무하지만 이런것들 이었습니다.

 

정상으로 설정된걸 확인하고, 접속하기 위해 서비스 노드포트를 추가로 선언했습니다.

kubectl expose deployment mendixkoreancommunity-master --type=NodePort --name=mendixkoreancommunity-nodeport -n bsa-dev

 

그리고 접속할 수 있는 주소를 확인하는 미니쿠베 명령어 입니다. ( localhost로 접속이 되는게 아니더군요... ㅡㅜ )

minikube service mendixkoreancommunity-nodeport  --url -n bsa-dev

 

성공!!

 

멘딕스 앱이 떠있는 로그를 보니 라이센스도 잘 적용 되어 있습니다!

 

실제 외부 접속 가능하게 하기 위해서는 포트포워딩 또는 minikube 명령어를 이용하면 됩니다.

kubectl port-forward service/mendixkoreancommunity-nodeport 7080:8080 -n bsa-dev

 

 

2024-07-31 

이것 저것 시도하다가 minikube 자체가 start 가 안되었습니다.

되살리려고 했는데 결국은 안되서 삭제 후 재설치를 해서 처음부터 다시 시도 해봤습니다.

 

!참고! 미니쿠베 삭제 하기

minikube delete --all

 

1. minikube 재설치 ( 아래 참고 )

 

2. namespace 생성 

# minikube 설치전에 설치한 docker 의 kubernetes 가 남아 있어서 버전 불일치가 있는거 같아, minikube kubectl 로 실행을 했습니다. 

minikube kubectl create namespace bsa-dev

 

3. mendix-operator 구성

저번에 받아 두었던 mxpc-cli 을 재활용 해서 진행 했습니다.

mxpc-cli.exe installer -n bsa-dev

 

 

1) Base Installation 선택

 

 

설치 완료 ( 관리자 권한으로 파워쉘로 실행함 - cmd로 오류 한번 발생했음.. )

 

재실행 후, 2) Configuration Namespace 실행

DataBase Plan 선택

정보 입력 ( postgres 셋팅 )

postgres 셋팅할때 해당 유저에 createdb 와 create_role 권한이 있어야함!

 

Storage Plan 선택

기본값으로 하고 이름 정의 만 함 완료!

 

Ingress 

service-only 로 변경 

 

Registry

docker hub 이용

 

Review and Apply

Evaluate Configuration -> Write YAML -> Apply Configuration 순으로 처리 완료

 

이제 라이센스 주입을 하고! 

커맨드를 실행합니다.

minikube kubectl 로 똑같이 했는데 옵션오류가 나서.. 여기선 그냥 kubectl 로 실행했습니다.. (차이가 있는건지... )

$license_key="LICENSE!!!"
kubectl -n bsa-dev create secret generic mendix-operator-license --from-literal=licensekey=$license_key
kubectl -n bsa-dev patch operatorconfiguration mendix-operator-configuration --type=merge -p '{\"spec\": {\"licenseKeySecretName\": \"mendix-operator-license\"}}'
kubectl -n bsa-dev scale deployment mendix-operator --replicas=0
kubectl -n bsa-dev scale deployment mendix-operator --replicas=1

 

이제 실제 프로그램을 다시 실행을 해봤습니다!

kubectl apply -f mendixkoreancommunity.yaml

 

계속되는 검색과 질문을 통해, mendix-operator 파드의 로그를 보면 진행사항을 알수 있는걸 찾아 냈습니다.

 

 

----------------------------------------------------------

 

로컬에 쿠버네티스 환경을 구성하고, Mendix app 을 적용하고자 했으나 실패한 사례를 기록합니다. (실패 라기 보다는 app 을 실행한거 같은데 확인이 안되네요.. ;; )

 

 

1. 쿠버네티스 설치

Mendix 가 지원하는 쿠버네티스 리스트 입니다.

Supported Providers | Mendix Documentation

 

Supported Providers

Describes which providers are supported by Mendix for Private Cloud

docs.mendix.com

저는 미니쿠베로 설치 했습니다. 

https://minikube.sigs.k8s.io/docs/start

 

minikube start

minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes. All you need is Docker (or similarly compatible) container or a Virtual Machine environment, and Kubernetes is a single command away: minikube start What you’ll

minikube.sigs.k8s.io

파워쉘 관리자 권한으로 실행해서 자동설치로 진행했습니다. 

쉽게 설치 됩니다. ( 너무 편안.. )

 

2. Mendix operator stand-alone 구성

Mendix app 을 쿠버네티스에 적용하기 위한 중간다리 역할 정도 하는 녀석입니다. 

 

Running the Mendix Operator in Standard Mode | Mendix Documentation

 

Running the Mendix Operator in Standard Mode

Describes the processes of installing and configuring the Mendix Operator in the Private Cloud in Standard mode

docs.mendix.com

 

안내에 따라, mendix 에 private cloud 를 등록 했습니다.

 

그런데 세부정보를 보면, 아무런 역할을 안해서 앞으로 관리를 안한다고 경고가 뜹니다.

어쨌뜬 가이드 데로 mendix operator agent 파일을 받고 실행을 해봤습니다.

 

 

1) Base Installation 을 정상으로 끝내고, 

2) 도 길긴 하지만 나름 설정해서 완료 했습니다.

 

3. 프로그램 배포

Using Command Line to Deploy a Mendix App to a Private Cloud Cluster | Mendix Documentation

 

Using Command Line to Deploy a Mendix App to a Private Cloud Cluster

Describes the processes for using the Mendix Operator directly to deploy a Mendix app in the Private Cloud

docs.mendix.com

이를 참조로 해서,  필요한 파일만 작성 후, yaml 파일을 만들고 실행을 했는데,

apiVersion: privatecloud.mendix.com/v1alpha1
kind: MendixApp
metadata:
  name: mendixkoreancommunity
spec:
  database: # Specification of Database CR
    servicePlan: dev
  storage: # Specification of Storage CR
    servicePlan: dev
  mendixRuntimeVersion: 10.12.1.39914 # Studio Pro version of the Mendix app
  sourceURL: http://배포/download/MendixKoreanCommunity_0.1.0.c99036cf.mda # URL of App's source MDA or prebuilt OCI image
  appURL: 접속주소 # URL to access the app
  replicas: 1 # Number of replicas, set to 0 to stop all replicas
  runtime: # Configuration of the Mendix Runtime
    logAutosubscribeLevel: INFO # Default logging level
    mxAdminPassword: 암호 # base64 encoded password for MendixAdmin user. In this example, 'Welc0me!'; can be left empty keep password unchanged
    debuggerPassword: 암호 # base64 encoded password for debuggerPassword. In this example, 'Welc0me!';
    dtapMode: P # Security & runtime mode: P for production, D for development
    myScheduledEvents: # List which scheduled events should be enabled; should only be used if scheduledEventExecution is set to SPECIFIED
      - MyFirstModule.MyScheduledEvent
    # Mendix Runtime Jetty options, in JSON format; validated and applied by the mx-m2ee-sidecar container
    jettyOptions: |-
      {
        "max_form_content_size": 10485760,
        "use_blocking_connector": false
      }
    # All custom Mendix Runtime parameters go here, in JSON format; validated and applied by the mx-m2ee-sidecar container
    customConfiguration: |-
      {
        "ApplicationRootUrl": "https://myapp1-dev.mendix.example.com"
      }

 

가이드에 나온데로 커맨드를 실행 했지만!

 kubectl apply -f .\mendixkoreancommunity.yaml -n bsa-dev

반응이 없음 ㅜㅜ

 

좀더 고민해보고 공유 하도록 하겠습니다!

 

---- 2024-07-29 추가

빌드 되어서 docker hub 에 등록된거는 확인했습니다! 

( mendix operator 설치시, 리포지터리를 설정하는데 docker hub 로 설정해 놨습니다. 그래서 빌드 한 이미지가 도커 허브에 등록되었네요! )

 

 

반응형