Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add merchant registry helm charts #598

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

`<ip-of-k8s-node-ingress> 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`
`<ip-of-k8s-node-ingress> 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

Expand Down
44 changes: 44 additions & 0 deletions merchant-registry-svc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v2
name: helms
tw-sithumyo marked this conversation as resolved.
Show resolved Hide resolved
description: A Helm chart for Kubernetes
tw-sithumyo marked this conversation as resolved.
Show resolved Hide resolved

dependencies:
- name: chart-acquirer-backend
version: 0.1.0
repository: file://./chart-acquirer-backend
- name: chart-acquirer-frontend
version: 0.1.0
repository: file://./chart-acquirer-frontend
- name: chart-merchant-db
version: 0.1.0
tw-sithumyo marked this conversation as resolved.
Show resolved Hide resolved
repository: file://./chart-merchant-db
- name: chart-minio
version: 0.1.0
repository: file://./chart-minio
- name: chart-rabbitmq
version: 0.1.0
repository: file://./chart-rabbitmq
- name: chart-registry-oracle
version: 0.1.0
repository: file://./chart-registry-oracle

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
tw-sithumyo marked this conversation as resolved.
Show resolved Hide resolved
40 changes: 40 additions & 0 deletions merchant-registry-svc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Merchant Registry Helm Charts Deployment

### Default Ingress DNS (add following records to the `/etc/hosts` file)

- `<ip-of-k8s-node-ingress> 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

1. Build Dependency Chart

```bash
helm dep up ./
```

2. Install the Helm chart:

```bash
helm install merchant ./ --namespace mojaloop
```

### 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.
24 changes: 24 additions & 0 deletions merchant-registry-svc/chart-acquirer-backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: chart-acquirer-backend
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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:
containers:
- name: acquirer-backend
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
image: "{{ .Values.acquirerBackend.image.repository }}:{{ .Values.acquirerBackend.image.tag }}"
ports:
- containerPort: {{ .Values.acquirerBackend.service.port }}
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 }}"
Original file line number Diff line number Diff line change
@@ -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 }}
30 changes: 30 additions & 0 deletions merchant-registry-svc/chart-acquirer-backend/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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: 0.1.3
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: "[email protected]"
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"

24 changes: 24 additions & 0 deletions merchant-registry-svc/chart-acquirer-frontend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: chart-acquirer-frontend
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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:
containers:
- name: acquirer-frontend
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
image: "{{ .Values.acquirerFrontend.image.repository }}:{{ .Values.acquirerFrontend.image.tag }}"
ports:
- containerPort: {{ .Values.acquirerFrontend.service.port }}
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 }}

Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 15 additions & 0 deletions merchant-registry-svc/chart-acquirer-frontend/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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: 0.1.3
service:
type: ClusterIP
port: 5173
env:
apiURL: "http://www.acquirer-merchant.local/api/v1"
recaptchaFrontendSiteKey: "6LcEfT4pAAAAAAONtUPIQYSoYvNSbvKiexaZLo4R"
24 changes: 24 additions & 0 deletions merchant-registry-svc/chart-merchant-db/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: chart-merchant-db
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Original file line number Diff line number Diff line change
@@ -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 }}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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:
containers:
- name: merchant-db
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed

Check warning

Code scanning / SonarCloud

Storage limits should be enforced Medium

Specify a storage limit for this container. See more on SonarCloud
image: "{{ .Values.merchantDb.image.repository }}:{{ .Values.merchantDb.image.tag }}"
args: ["--default-authentication-plugin=mysql_native_password"]
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 }}

11 changes: 11 additions & 0 deletions merchant-registry-svc/chart-merchant-db/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

Original file line number Diff line number Diff line change
@@ -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 }}

Loading