diff --git a/README.md b/README.md index 6360bc9e2..4b17a11ce 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,7 @@ Mojaloop Helm deployments currently include the following provisioning (`setup`) 1. Add the following to your hosts file and ensure you have installed Ingress Controller on your Kubernetes Cluster: - ` ml-api-adapter.local central-ledger.local account-lookup-service.local quoting-service.local central-settlement.local moja-simulator.local testing-toolkit.local testing-toolkit-specapi.local` + ` ml-api-adapter.local central-ledger.local account-lookup-service.local quoting-service.local central-settlement.local moja-simulator.local testing-toolkit.local testing-toolkit-specapi.local www.acquirer-merchant.local` 2. Curl Health End-points for ML-API-Adapter diff --git a/lint-charts.sh b/lint-charts.sh index 9bcd479da..59a6195fc 100755 --- a/lint-charts.sh +++ b/lint-charts.sh @@ -49,6 +49,7 @@ else mojaloop-bulk/ mojaloop-simulator mojaloop + merchant-registry-svc # kube-system/ntpd/ # Deprecated - No longer supported ml-operator thirdparty/chart-auth-svc diff --git a/merchant-registry-svc/Chart.yaml b/merchant-registry-svc/Chart.yaml new file mode 100644 index 000000000..3eaa9ad2a --- /dev/null +++ b/merchant-registry-svc/Chart.yaml @@ -0,0 +1,26 @@ +apiVersion: v2 +name: merchant-registry +type: application +version: 1.0.1 +appVersion: "1.0.1" +description: Merchant Registry Helm chart for Kubernetes + +dependencies: + - name: chart-acquirer-backend + version: ">= 1.0.0" + repository: file://./chart-acquirer-backend + - name: chart-acquirer-frontend + version: ">= 1.0.0" + repository: file://./chart-acquirer-frontend + - name: chart-merchant-db + version: ">= 1.0.0" + repository: file://./chart-merchant-db + - name: chart-minio + version: ">= 1.0.0" + repository: file://./chart-minio + - name: chart-rabbitmq + version: ">= 1.0.0" + repository: file://./chart-rabbitmq + - name: chart-registry-oracle + version: ">= 1.0.0" + repository: file://./chart-registry-oracle diff --git a/merchant-registry-svc/README.md b/merchant-registry-svc/README.md new file mode 100644 index 000000000..2141d7bf8 --- /dev/null +++ b/merchant-registry-svc/README.md @@ -0,0 +1,96 @@ +## Merchant Registry Helm Charts Deployment + +### Default Ingress DNS (add following records to the `/etc/hosts` file) + +- ` www.acquirer-merchant.local` + +### Prerequisites + +- Kubernetes cluster +- Helm 3 +- SendGrid API Key (for sending verification emails) + + - Update the `sendgridApiKey` in the `./chart-acquirer-backend/values.yaml` + - Update the `senderEmail` in the `./chart-acquirer-backend/values.yaml` + +- Register for Google reCAPTCHA v2 and Add Ingress Domain + - https://www.google.com/recaptcha/admin/create + - Update the `./chart-acquirer-backend/values.yaml` file with the following values: + - `recaptchaBackendSiteKey` + - Update the `./chart-acquirer-frontend/values.yaml` file with the following values: + - `recaptchaFrontendSiteKey` + +### Deploying the Helm Charts + +Note For Production: Recommended to use external Third Party S3 Services (like Amazon S3, Digital Ocean Space etc.) for storing the documents and QR Images instead of the MinIO S3 instance service. +See the [`./chart-acquirer-backend/values.yaml`](./chart-acquirer-backend/values.yaml) for the configuration. + +1. Build Dependency Chart + +```bash +helm dep up ./ +``` + +2. Install the Helm chart: + +```bash +helm install merchant ./ --namespace mojaloop +``` + +### Registering Merchant Oracle in Account Lookup Service + +1. Make sure the `account-lookup-service-admin` is running and accessible. +2. Make sure the `merchant-registry-oracle-clusterip-service` is accessible from the `account-lookup-service-admin` pod. +3. Run the following command to register the merchant oracle with `ALIAS` type: + +Replace `` and `` with the Cluster IP Addresses. +`kubectl get svc -n mojaloop` can be used to get the Cluster IP Addresses. + + +```bash +curl -X POST "http:///oracles" \ + -H "accept: application/json" -H "Content-Type: application/json" \ + -d '{ + "oracleIdType": "ALIAS", + "endpoint": { + "value": ":8888", + "endpointType": "URL" + }, + "currency": "USD", + "isDefault": true + }' +``` + +4. Verify the registration by running the following command: + +```bash +curl -X GET "http:///oracles" \ + -H "accept: application/json" \ + -H "Content-Type: application/json" \ + -H "date: $(date -Ru)" +``` + +should return the registered oracle. +```json +[ + { + "oracleId":1, + "oracleIdType":"ALIAS", + "endpoint":{ + "value":"10.43.83.251:8888", + "endpointType":"URL" + }, + "currency":"USD", + "isDefault":1 + } +] +``` + +### IMPORTANT NOTES: + +When updating ingress's host make sure to update the `apiUrl` of `./chart-acquirer-frontend/values.yaml` file too. +Otherwise frontend will not be able to communicate with backend. + +The system utilize RabbitMQ for message queuing between services and SendGrid for email verification. +Adopters can substitute these services with their preferred choices for a customized integration. + diff --git a/merchant-registry-svc/chart-acquirer-backend/.helmignore b/merchant-registry-svc/chart-acquirer-backend/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-backend/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/merchant-registry-svc/chart-acquirer-backend/Chart.yaml b/merchant-registry-svc/chart-acquirer-backend/Chart.yaml new file mode 100644 index 000000000..81b319286 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-backend/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chart-acquirer-backend +description: A Helm chart for Kubernetes +type: application +version: 1.0.0 +appVersion: "1.0.1" diff --git a/merchant-registry-svc/chart-acquirer-backend/templates/deployment.yaml b/merchant-registry-svc/chart-acquirer-backend/templates/deployment.yaml new file mode 100644 index 000000000..fe8ca932a --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-backend/templates/deployment.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-acquirer-backend-deployment +spec: + replicas: {{ .Values.acquirerBackend.replicaCount }} + selector: + matchLabels: + component: acquirer-backend + template: + metadata: + labels: + component: acquirer-backend + spec: + automountServiceAccountToken: false + containers: + - name: acquirer-backend + image: "{{ .Values.acquirerBackend.image.repository }}:{{ .Values.acquirerBackend.image.tag }}" + ports: + - containerPort: {{ .Values.acquirerBackend.service.port }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: APP_URL # for email redirect verification + value: "{{ .Values.acquirerBackend.env.appURL }}" + - name: FRONTEND_SET_PASSWORD_URL + value: "{{ .Values.acquirerBackend.env.frontendSetPasswordRedirectURL }}" + - name: RECAPTCHA_SECRET_KEY + value: "{{ .Values.acquirerBackend.env.recaptchaBackendSiteKey }}" + - name: DB_HOST + value: "{{ .Release.Name }}-{{ .Values.acquirerBackend.env.dbHost }}" + - name: DB_PORT + value: "{{ .Values.acquirerBackend.env.dbPort }}" + - name: DB_DATABASE + value: "{{ .Values.acquirerBackend.env.database }}" + - name: DB_USERNAME + value: "{{ .Values.acquirerBackend.env.dbUsername }}" + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-merchant-db-secret + key: mysql-root-password + - name: SENDGRID_API_KEY + value: "{{ .Values.acquirerBackend.env.sendgridApiKey }}" + - name: SENDER_EMAIL + value: "{{ .Values.acquirerBackend.env.senderEmail }}" + + - name: S3_ENDPOINT + value: "{{ .Release.Name }}-{{ .Values.acquirerBackend.env.s3Endpoint }}" + + - name: RABBITMQ_HOST + value: "{{ .Release.Name }}-{{ .Values.acquirerBackend.env.rabbitmqHost }}" + - name: RABBITMQ_PORT + value: "{{ .Values.acquirerBackend.env.rabbitmqPort }}" + - name: RABBITMQ_USERNAME + value: "{{ .Values.acquirerBackend.env.rabbitmqUsername }}" + - name: RABBITMQ_PASSWORD + value: "{{ .Values.acquirerBackend.env.rabbitmqPassword }}" diff --git a/merchant-registry-svc/chart-acquirer-backend/templates/service.yaml b/merchant-registry-svc/chart-acquirer-backend/templates/service.yaml new file mode 100644 index 000000000..265fe0447 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-backend/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name}}-acquirer-backend-clusterip-service +spec: + type: {{ .Values.acquirerBackend.service.type }} + selector: + component: acquirer-backend + ports: + - port: {{ .Values.acquirerBackend.service.port }} + targetPort: {{ .Values.acquirerBackend.service.port }} diff --git a/merchant-registry-svc/chart-acquirer-backend/values.yaml b/merchant-registry-svc/chart-acquirer-backend/values.yaml new file mode 100644 index 000000000..e304c4b30 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-backend/values.yaml @@ -0,0 +1,37 @@ +# Default values for acquirer-backend. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +acquirerBackend: + replicaCount: 1 + image: + repository: mojaloop/merchant-acquirer-backend + tag: 1.0.1 + service: + type: ClusterIP + port: 5555 + env: + dbHost: merchant-db-clusterip-service + dbPort: "3306" + database: acquirer_db + dbUsername: root + # db password will be fetched from k8s secret object + + rabbitmqHost: rabbitmq-clusterip-service + rabbitmqPort: "5672" + rabbitmqUsername: guest + rabbitmqPassword: guest + sendgridApiKey: "YOUR_SENDGIRD_API_KEY" # 3rd Party Email Service + senderEmail: "test@example.com" + s3Endpoint: minio-clusterip-service + appURL: "http://www.acquirer-merchant.local" # for email verification backend link + frontendSetPasswordRedirectURL: "http://www.acquirer-merchant.local/set-password" # reset password link after email verification + recaptchaBackendSiteKey: "6LcEfT4pAAAAAF9a9PgebViC87aRPsd10JQDalNy" + +resources: + requests: + cpu: "200m" + memory: "256Mi" + limits: + cpu: "1000m" + memory: "512Mi" diff --git a/merchant-registry-svc/chart-acquirer-frontend/.helmignore b/merchant-registry-svc/chart-acquirer-frontend/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-frontend/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/merchant-registry-svc/chart-acquirer-frontend/Chart.yaml b/merchant-registry-svc/chart-acquirer-frontend/Chart.yaml new file mode 100644 index 000000000..76139a71a --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-frontend/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chart-acquirer-frontend +description: A Helm chart for Kubernetes +type: application +version: 1.0.0 +appVersion: "1.0.1" diff --git a/merchant-registry-svc/chart-acquirer-frontend/templates/deployment.yaml b/merchant-registry-svc/chart-acquirer-frontend/templates/deployment.yaml new file mode 100644 index 000000000..566ea4329 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-frontend/templates/deployment.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-acquirer-frontend-deployment +spec: + replicas: {{ .Values.acquirerFrontend.replicaCount }} + selector: + matchLabels: + component: acquirer-frontend + template: + metadata: + labels: + component: acquirer-frontend + spec: + automountServiceAccountToken: false + containers: + - name: acquirer-frontend + image: "{{ .Values.acquirerFrontend.image.repository }}:{{ .Values.acquirerFrontend.image.tag }}" + ports: + - containerPort: {{ .Values.acquirerFrontend.service.port }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: VITE_API_URL + value: "{{ .Values.acquirerFrontend.env.apiURL }}" + - name: VITE_PORT + value: "{{ .Values.acquirerFrontend.service.port }}" + - name: VITE_RECAPTCHA_SITE_KEY + value: {{ .Values.acquirerFrontend.env.recaptchaFrontendSiteKey }} + diff --git a/merchant-registry-svc/chart-acquirer-frontend/templates/service.yaml b/merchant-registry-svc/chart-acquirer-frontend/templates/service.yaml new file mode 100644 index 000000000..9d0016b84 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-frontend/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-acquirer-frontend-clusterip-service +spec: + type: {{ .Values.acquirerFrontend.service.type }} + selector: + component: acquirer-frontend + ports: + - port: {{ .Values.acquirerFrontend.service.port }} + targetPort: {{ .Values.acquirerFrontend.service.port }} diff --git a/merchant-registry-svc/chart-acquirer-frontend/values.yaml b/merchant-registry-svc/chart-acquirer-frontend/values.yaml new file mode 100644 index 000000000..a1da83371 --- /dev/null +++ b/merchant-registry-svc/chart-acquirer-frontend/values.yaml @@ -0,0 +1,24 @@ +# Default values for acquirer-frontend. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +acquirerFrontend: + replicaCount: 1 + image: + repository: mojaloop/merchant-acquirer-frontend + tag: 1.0.1 + service: + type: ClusterIP + port: 5173 + env: + apiURL: "http://www.acquirer-merchant.local/api/v1" + recaptchaFrontendSiteKey: "6LcEfT4pAAAAAAONtUPIQYSoYvNSbvKiexaZLo4R" + +resources: + requests: + cpu: "50m" + memory: "128Mi" + limits: + cpu: "200m" + memory: "256Mi" + diff --git a/merchant-registry-svc/chart-merchant-db/.helmignore b/merchant-registry-svc/chart-merchant-db/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/merchant-registry-svc/chart-merchant-db/Chart.yaml b/merchant-registry-svc/chart-merchant-db/Chart.yaml new file mode 100644 index 000000000..3616c3f7a --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chart-merchant-db +description: MySQL database for Merchant Registry +type: application +version: 1.0.0 +appVersion: "1.16.0" diff --git a/merchant-registry-svc/chart-merchant-db/templates/configmap.yaml b/merchant-registry-svc/chart-merchant-db/templates/configmap.yaml new file mode 100644 index 000000000..bfcdb56a8 --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/templates/configmap.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-merchant-db-init-script +data: + init-db.sql: | + {{- range .Values.merchantDb.databases }} + CREATE DATABASE IF NOT EXISTS {{ .name }}; + {{- end }} + diff --git a/merchant-registry-svc/chart-merchant-db/templates/deployment.yaml b/merchant-registry-svc/chart-merchant-db/templates/deployment.yaml new file mode 100644 index 000000000..30502c210 --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/templates/deployment.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-merchant-db-deployment +spec: + replicas: {{ .Values.merchantDb.replicaCount }} + selector: + matchLabels: + component: merchant-db + template: + metadata: + labels: + component: merchant-db + spec: + automountServiceAccountToken: false + containers: + - name: merchant-db + image: "{{ .Values.merchantDb.image.repository }}:{{ .Values.merchantDb.image.tag }}" + args: ["--default-authentication-plugin=mysql_native_password"] + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-{{ .Values.merchantDb.secret.name }} + key: mysql-root-password + ports: + - containerPort: {{ .Values.merchantDb.service.port }} + volumeMounts: + - name: merchant-db-vol + mountPath: /var/lib/mysql + - name: init-script + mountPath: /docker-entrypoint-initdb.d + volumes: + - name: merchant-db-vol + persistentVolumeClaim: + claimName: {{ .Release.Name }}-merchant-db-pvc + - name: init-script + configMap: + name: {{ .Release.Name }}-{{ .Values.merchantDb.initScript.name }} + diff --git a/merchant-registry-svc/chart-merchant-db/templates/pvc.yaml b/merchant-registry-svc/chart-merchant-db/templates/pvc.yaml new file mode 100644 index 000000000..a0f339d7b --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/templates/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-merchant-db-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.merchantDb.pvc.size }} + diff --git a/merchant-registry-svc/chart-merchant-db/templates/secret.yaml b/merchant-registry-svc/chart-merchant-db/templates/secret.yaml new file mode 100644 index 000000000..5bbb971ed --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/templates/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-merchant-db-secret +type: Opaque +data: + mysql-root-password: {{ .Values.merchantDb.secret.mysqlRootPassword }} + diff --git a/merchant-registry-svc/chart-merchant-db/templates/service.yaml b/merchant-registry-svc/chart-merchant-db/templates/service.yaml new file mode 100644 index 000000000..c053a3742 --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-merchant-db-clusterip-service +spec: + type: {{ .Values.merchantDb.service.type }} + selector: + component: merchant-db + ports: + - protocol: TCP + port: {{ .Values.merchantDb.service.port }} + targetPort: {{ .Values.merchantDb.service.port }} diff --git a/merchant-registry-svc/chart-merchant-db/values.yaml b/merchant-registry-svc/chart-merchant-db/values.yaml new file mode 100644 index 000000000..3e897160d --- /dev/null +++ b/merchant-registry-svc/chart-merchant-db/values.yaml @@ -0,0 +1,32 @@ +# Default values for merchant-db. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +merchantDb: + replicaCount: 1 + image: + repository: mysql + tag: 8.0.33 + service: + type: ClusterIP + port: 3306 + pvc: + size: 2Gi + secret: + name: merchant-db-secret + mysqlRootPassword: "cGFzc3dvcmQ=" # make sure to base64 encode the password + databases: + - name: acquirer_db + - name: registry_db + initScript: + name: merchant-db-init-script + +resources: + requests: + cpu: "200m" + memory: "256Mi" + limits: + cpu: "1000m" + memory: "512Mi" + ephemeral-storage: "2Gi" + diff --git a/merchant-registry-svc/chart-minio/.helmignore b/merchant-registry-svc/chart-minio/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/merchant-registry-svc/chart-minio/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/merchant-registry-svc/chart-minio/Chart.yaml b/merchant-registry-svc/chart-minio/Chart.yaml new file mode 100644 index 000000000..390c804c5 --- /dev/null +++ b/merchant-registry-svc/chart-minio/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chart-minio +description: MinIO chart for Merchant Registry +type: application +version: 1.0.0 +appVersion: "1.16.0" diff --git a/merchant-registry-svc/chart-minio/templates/deployment.yaml b/merchant-registry-svc/chart-minio/templates/deployment.yaml new file mode 100644 index 000000000..fb3360813 --- /dev/null +++ b/merchant-registry-svc/chart-minio/templates/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-minio-deployment +spec: + selector: + matchLabels: + component: minio + replicas: {{ .Values.minio.replicaCount }} + template: + metadata: + labels: + component: minio + spec: + automountServiceAccountToken: false + containers: + - name: minio + image: "{{ .Values.minio.image.repository }}:{{ .Values.minio.image.tag }}" + args: + - server + - /data + env: + - name: MINIO_ROOT_USER + value: "{{ .Values.minio.env.rootUser }}" + - name: MINIO_ROOT_PASSWORD + value: "{{ .Values.minio.env.rootPassword }}" + - name: MINIO_SERVER_URL + value: "{{ .Values.minio.env.serverUrl }}" + ports: + - containerPort: {{ .Values.minio.service.port }} + volumeMounts: + - name: storage + mountPath: "/data" + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: storage + persistentVolumeClaim: + claimName: {{ .Release.Name }}-minio-s3-pvc diff --git a/merchant-registry-svc/chart-minio/templates/pvc.yaml b/merchant-registry-svc/chart-minio/templates/pvc.yaml new file mode 100644 index 000000000..37f56d1a3 --- /dev/null +++ b/merchant-registry-svc/chart-minio/templates/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-minio-s3-pvc +spec: + accessModes: + - {{ .Values.minio.pvc.accessMode }} + resources: + requests: + storage: {{ .Values.minio.pvc.size }} + diff --git a/merchant-registry-svc/chart-minio/templates/service.yaml b/merchant-registry-svc/chart-minio/templates/service.yaml new file mode 100644 index 000000000..e1bf62e16 --- /dev/null +++ b/merchant-registry-svc/chart-minio/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-minio-clusterip-service +spec: + type: {{ .Values.minio.service.type }} + ports: + - port: {{ .Values.minio.service.port }} + targetPort: {{ .Values.minio.service.port }} + selector: + component: minio + diff --git a/merchant-registry-svc/chart-minio/values.yaml b/merchant-registry-svc/chart-minio/values.yaml new file mode 100644 index 000000000..2b1f7a255 --- /dev/null +++ b/merchant-registry-svc/chart-minio/values.yaml @@ -0,0 +1,30 @@ +# Default values for chart-minio. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +minio: + replicaCount: 1 + image: + repository: minio/minio + tag: RELEASE.2023-07-21T21-12-44Z + service: + type: ClusterIP + port: 9000 + pvc: + name: minio-s3-pvc + accessMode: ReadWriteOnce + size: 2Gi + env: + rootUser: "minioadmin" + rootPassword: "minioadmin" + serverUrl: "http://s3.acquirer-merchant.local" + +resources: + requests: + cpu: "200m" + memory: "256Mi" + limits: + cpu: "1000m" + memory: "512Mi" + ephemeral-storage: "2Gi" + diff --git a/merchant-registry-svc/chart-rabbitmq/.helmignore b/merchant-registry-svc/chart-rabbitmq/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/merchant-registry-svc/chart-rabbitmq/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/merchant-registry-svc/chart-rabbitmq/Chart.yaml b/merchant-registry-svc/chart-rabbitmq/Chart.yaml new file mode 100644 index 000000000..d28ed205b --- /dev/null +++ b/merchant-registry-svc/chart-rabbitmq/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chart-rabbitmq +description: RabbitMQ chart for Merchant Registry +type: application +version: 1.0.0 +appVersion: "1.16.0" diff --git a/merchant-registry-svc/chart-rabbitmq/templates/deployment.yaml b/merchant-registry-svc/chart-rabbitmq/templates/deployment.yaml new file mode 100644 index 000000000..da24e23a0 --- /dev/null +++ b/merchant-registry-svc/chart-rabbitmq/templates/deployment.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-rabbitmq-deployment +spec: + replicas: {{ .Values.rabbitmq.replicaCount }} + selector: + matchLabels: + component: rabbitmq + template: + metadata: + labels: + component: rabbitmq + spec: + automountServiceAccountToken: false + containers: + - name: rabbitmq + image: "{{ .Values.rabbitmq.image.repository }}:{{ .Values.rabbitmq.image.tag }}" + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: RABBITMQ_DEFAULT_USER + value: "{{ .Values.rabbitmq.env.defaultUser }}" + - name: RABBITMQ_DEFAULT_PASS + value: "{{ .Values.rabbitmq.env.defaultPass }}" + ports: + {{- range .Values.rabbitmq.service.ports }} + - containerPort: {{ .port }} + {{- end }} + diff --git a/merchant-registry-svc/chart-rabbitmq/templates/service.yaml b/merchant-registry-svc/chart-rabbitmq/templates/service.yaml new file mode 100644 index 000000000..c427a884e --- /dev/null +++ b/merchant-registry-svc/chart-rabbitmq/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-rabbitmq-clusterip-service +spec: + type: {{ .Values.rabbitmq.service.type }} + ports: + {{- range .Values.rabbitmq.service.ports }} + - name: {{ .name }} + port: {{ .port }} + targetPort: {{ .targetPort }} + {{- end }} + selector: + component: rabbitmq diff --git a/merchant-registry-svc/chart-rabbitmq/values.yaml b/merchant-registry-svc/chart-rabbitmq/values.yaml new file mode 100644 index 000000000..87325c8d7 --- /dev/null +++ b/merchant-registry-svc/chart-rabbitmq/values.yaml @@ -0,0 +1,27 @@ +# Default values for chart-rabbitmq. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +rabbitmq: + replicaCount: 1 + image: + repository: rabbitmq + tag: 3.12.4-management-alpine + service: + type: ClusterIP + ports: + - name: amqp + port: 5672 + - name: management + port: 15672 + env: + defaultUser: "guest" + defaultPass: "guest" + +resources: + requests: + cpu: "200m" + memory: "256Mi" + limits: + cpu: "1000m" + memory: "512Mi" diff --git a/merchant-registry-svc/chart-registry-oracle/.helmignore b/merchant-registry-svc/chart-registry-oracle/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/merchant-registry-svc/chart-registry-oracle/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/merchant-registry-svc/chart-registry-oracle/Chart.yaml b/merchant-registry-svc/chart-registry-oracle/Chart.yaml new file mode 100644 index 000000000..cec50e6e4 --- /dev/null +++ b/merchant-registry-svc/chart-registry-oracle/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: chart-registry-oracle +description: A Helm chart for Kubernetes +type: application +version: 1.0.0 +appVersion: "1.0.1" diff --git a/merchant-registry-svc/chart-registry-oracle/templates/deployment.yaml b/merchant-registry-svc/chart-registry-oracle/templates/deployment.yaml new file mode 100644 index 000000000..a3e487945 --- /dev/null +++ b/merchant-registry-svc/chart-registry-oracle/templates/deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-registry-oracle-deployment +spec: + replicas: {{ .Values.registryOracle.replicaCount }} + selector: + matchLabels: + component: registry-oracle + template: + metadata: + labels: + component: registry-oracle + spec: + automountServiceAccountToken: false + containers: + - name: registry-oracle + image: "{{ .Values.registryOracle.image.repository }}:{{ .Values.registryOracle.image.tag }}" + resources: + {{- toYaml .Values.resources | nindent 12 }} + ports: + - containerPort: {{ .Values.registryOracle.service.port }} + env: + - name: DB_HOST + value: "{{ .Release.Name }}-{{ .Values.registryOracle.env.dbHost }}" + - name: DB_PORT + value: "{{ .Values.registryOracle.env.dbPort }}" + - name: DB_DATABASE + value: "{{ .Values.registryOracle.env.database }}" + - name: DB_USERNAME + value: "{{ .Values.registryOracle.env.dbUsername }}" + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Release.Name }}-{{ .Values.registryOracle.env.dbPasswordSecret.name }} + key: {{ .Values.registryOracle.env.dbPasswordSecret.key }} + - name: RABBITMQ_HOST + value: "{{ .Release.Name }}-{{ .Values.registryOracle.env.rabbitmqHost }}" + - name: RABBITMQ_PORT + value: "{{ .Values.registryOracle.env.rabbitmqPort }}" + - name: RABBITMQ_USERNAME + value: "{{ .Values.registryOracle.env.rabbitmqUsername }}" + - name: RABBITMQ_PASSWORD + value: "{{ .Values.registryOracle.env.rabbitmqPassword }}" + diff --git a/merchant-registry-svc/chart-registry-oracle/templates/service.yaml b/merchant-registry-svc/chart-registry-oracle/templates/service.yaml new file mode 100644 index 000000000..75d817a8f --- /dev/null +++ b/merchant-registry-svc/chart-registry-oracle/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-registry-oracle-clusterip-service +spec: + type: {{ .Values.registryOracle.service.type }} + selector: + component: registry-oracle + ports: + - port: {{ .Values.registryOracle.service.port }} + targetPort: {{ .Values.registryOracle.service.port }} + diff --git a/merchant-registry-svc/chart-registry-oracle/values.yaml b/merchant-registry-svc/chart-registry-oracle/values.yaml new file mode 100644 index 000000000..648d5430d --- /dev/null +++ b/merchant-registry-svc/chart-registry-oracle/values.yaml @@ -0,0 +1,28 @@ +registryOracle: + replicaCount: 1 + image: + repository: mojaloop/merchant-registry-oracle + tag: 1.0.1 + service: + type: ClusterIP + port: 8888 + env: + dbHost: merchant-db-clusterip-service + dbPort: "3306" + database: registry_db + dbUsername: root + dbPasswordSecret: + name: merchant-db-secret + key: mysql-root-password + rabbitmqHost: rabbitmq-clusterip-service + rabbitmqPort: "5672" + rabbitmqUsername: guest + rabbitmqPassword: guest + +resources: + requests: + cpu: "200m" + memory: "256Mi" + limits: + cpu: "1000m" + memory: "512Mi" diff --git a/merchant-registry-svc/templates/ingress.yaml b/merchant-registry-svc/templates/ingress.yaml new file mode 100644 index 000000000..71521b106 --- /dev/null +++ b/merchant-registry-svc/templates/ingress.yaml @@ -0,0 +1,25 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-merchant-ingress + annotations: +{{ toYaml .Values.ingress.annotations | nindent 4 }} +spec: + rules: + {{- $releaseName := .Release.Name }} + {{- range .Values.ingress.hosts }} + - host: "{{ .host }}" + http: + paths: + {{- range .paths }} + - path: "{{ .path }}" + pathType: {{ .pathType }} + backend: + service: + name: "{{ $releaseName }}-{{ .serviceName }}" + port: + number: {{ .servicePort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/merchant-registry-svc/values.yaml b/merchant-registry-svc/values.yaml new file mode 100644 index 000000000..1276b0770 --- /dev/null +++ b/merchant-registry-svc/values.yaml @@ -0,0 +1,107 @@ +# Default values for helms. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 + +ingress: + enabled: true + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: "100m" + # nginx.ingress.kubernetes.io/ssl-redirect: "true" + hosts: + - host: "www.acquirer-merchant.local" + paths: + - path: /api/v1 + pathType: Prefix + serviceName: acquirer-backend-clusterip-service + servicePort: 5555 + - path: /participants + pathType: Prefix + serviceName: registry-oracle-clusterip-service + servicePort: 8888 + - path: / + pathType: Prefix + serviceName: acquirer-frontend-clusterip-service + servicePort: 5173 + - host: "s3.acquirer-merchant.local" + paths: + - path: / + pathType: Prefix + serviceName: minio-clusterip-service + servicePort: 5173 +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +# ingress: +# enabled: false +# className: "" +# annotations: {} +# # kubernetes.io/ingress.class: nginx +# # kubernetes.io/tls-acme: "true" +# hosts: +# - host: chart-example.local +# paths: +# - path: / +# pathType: ImplementationSpecific +# tls: [] +# # - secretName: chart-example-tls +# # hosts: +# # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/package.sh b/package.sh index c597977a8..24824ef6d 100755 --- a/package.sh +++ b/package.sh @@ -55,6 +55,7 @@ else thirdparty/chart-tp-api-svc thirdparty mojaloop + merchant-registry-svc kube-system/ntpd/ ml-operator ) diff --git a/update-charts-dep.sh b/update-charts-dep.sh index 1f6bc0bf7..434975cae 100755 --- a/update-charts-dep.sh +++ b/update-charts-dep.sh @@ -49,6 +49,7 @@ declare -a charts=( thirdparty/chart-consent-oracle thirdparty/chart-tp-api-svc thirdparty + merchant-registry-svc mojaloop )