Skip to content

Commit

Permalink
Merge pull request #5 from one-acre-fund/feature/fineract
Browse files Browse the repository at this point in the history
feature/fineract
  • Loading branch information
Yann-J authored May 6, 2021
2 parents f2391a1 + 2e9cfd7 commit d895334
Show file tree
Hide file tree
Showing 21 changed files with 644 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ helm repo add one-acre-fund https://one-acre-fund.github.io/oaf-public-charts
* [GeoNode](https://geonode.org/)
* [KoboToolbox](https://www.kobotoolbox.org/)
* [Flagsmith](https://flagsmith.com/)
* [Fineract](https://fineract.apache.org/)

## How to contribute

Expand Down
37 changes: 37 additions & 0 deletions charts/fineract/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
34 changes: 34 additions & 0 deletions charts/fineract/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v2
description: "Apache Fineract: A Platform for Microfinance"
name: fineract
version: 0.1.0
home: https://github.com/apache/fineract
icon: https://fineract.apache.org/images/apache-fineract-logo.png
keywords:
- microfinance
sources:
- https://github.com/one-acre-fund/oaf-public-charts/tree/main/charts/fineract
maintainers:
- name: Yann-J
email: yann.jouanique@gmail.com
dependencies:
- name: mysql
version: ~8.4.1
repository: https://charts.bitnami.com/bitnami
condition: mysql.enabled
1 change: 1 addition & 0 deletions charts/fineract/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Thank you for installing Fineract!
61 changes: 61 additions & 0 deletions charts/fineract/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# fineract

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square)

Apache Fineract: A Platform for Microfinance

**Homepage:** <https://github.com/apache/fineract>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Yann-J | yann.jouanique@gmail.com | |

## Source Code

* <https://github.com/one-acre-fund/oaf-public-charts/tree/main/charts/fineract>

## TL;DR;

__NOTE__: Providing values for at least `mysql.auth.password` and `mysql.auth.rootPassword` is mandatory at installation time

```console
$ helm repo add one-acre-fund https://one-acre-fund.github.io/oaf-public-charts
$ helm install --set mysql.auth.password=xxx --set mysql.auth.rootPassword=yyy my-release one-acre-fund/fineract
```

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | mysql | ~8.4.1 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| fineractServer.extraEnv | object | See `values.yaml` | Dictionary of key/value pairs to pass as environment variables to the backend pods They will be evaluated as Helm templates |
| fineractServer.extraSecretEnv | object | `{}` | Same as `extraEnv` but passed as secrets |
| fineractServer.image.name | string | `"apache/fineract"` | Fineract Docker image name |
| fineractServer.image.tag | string | `"latest"` | Fineract Docker image tag |
| fineractServer.replicas | int | `1` | Number of backend pods |
| fineractServer.resources | object | `{"limits":{"cpu":"1000m","memory":"1Gi"}}` | Resource settings for Backend pods |
| fineractUI.image.name | string | `"openmf/community-app"` | Frontend Docker image name |
| fineractUI.image.tag | string | `"latest"` | Frontend Docker image tag |
| fineractUI.replicas | int | `1` | Number of frontend pods |
| fineractUI.resources | object | `{"limits":{"cpu":"100m","memory":"100Mi"}}` | Resource settings for Backend pods |
| global.db.defaultDb | string | `"fineract_default"` | DB name for defaults db |
| global.db.tenantsDb | string | `"fineract_tenants"` | DB name for tenants db |
| ingress.annotations | object | `{}` | Ingress annotations |
| ingress.enabled | bool | `false` | Create Ingress? |
| ingress.hosts | list | `[]` | |
| ingress.tls | list | `[]` | TLS settings |
| mysql | object | see `values.yaml` | MySQL settings - see https://artifacthub.io/packages/helm/bitnami/mysql |
| mysql.auth.password | string | `""` | Please change these... |
| mysql.auth.rootPassword | string | `""` | Please change these... |
| mysql.auth.username | string | `"fineract"` | Fineract db user |
| mysql.enabled | bool | `true` | Install MySQL? |
| mysql.image.tag | string | `"5.7"` | _Warning_: Fineract db driver doesn't support mysql 8 |
| mysql.initdbScripts | object | see `values.yaml` | Dictionary of init scripts to run on initial MySQL setup __WARNING__! These db init scripts will only be executed on a brand new, uninitialized instance! Further changes will be ignored after the first init, unless you wipe the underlying PV/PVC volumes |
| service.type | string | `"ClusterIP"` | Service type for Fineract and UI services |
25 changes: 25 additions & 0 deletions charts/fineract/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

{{ template "chart.maintainersSection" . }}

{{ template "chart.sourcesSection" . }}

## TL;DR;

__NOTE__: Providing values for at least `mysql.auth.password` and `mysql.auth.rootPassword` is mandatory at installation time

```console
$ helm repo add one-acre-fund https://one-acre-fund.github.io/oaf-public-charts
$ helm install --set mysql.auth.password=xxx --set mysql.auth.rootPassword=yyy my-release one-acre-fund/fineract
```

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}
5 changes: 5 additions & 0 deletions charts/fineract/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Values file for CI testing
mysql:
auth:
password: yyyy
rootPassword: xxxx
6 changes: 6 additions & 0 deletions charts/fineract/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 8.4.1
digest: sha256:d020a39cd42a3a78eaa760ebd58527692f1dc81d6b2c2677fc042c901784255e
generated: "2021-02-16T22:32:36.621097+02:00"
42 changes: 42 additions & 0 deletions charts/fineract/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

{{- define "mysql_host" -}}
{{ .Release.Name }}-mysql.{{ .Release.Namespace }}
{{- end -}}

{{- define "mysql_url" -}}
jdbc:mysql:thin://{{ include "mysql_host" . }}:3306/{{ .Values.global.db.tenantsDb }}
{{- end -}}

{{- define "mysql_user" -}}
{{ .Values.mysql.auth.username | default "root" }}
{{- end -}}

{{- define "mysql_password" -}}
{{ coalesce .Values.mysql.auth.password .Values.mysql.auth.rootPassword }}
{{- end -}}

{{- define "secrets" -}}
fineract_tenants_pwd: {{ include "mysql_password" . | b64enc }}
FINERACT_DEFAULT_TENANTDB_PWD: {{ include "mysql_password" . | b64enc }}
{{ if .Values.extraSecretEnv }}
{{- range $key, $value := .Values.extraSecretEnv }}
{{ $key }}: {{ tpl $value $ | b64enc }}
{{- end }}
{{- end }}
{{- end -}}
38 changes: 38 additions & 0 deletions charts/fineract/templates/fineract-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.ingress.enabled -}}
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: /fineract-provider
pathType: Prefix
backend:
serviceName: {{ .Release.Name }}-backend
servicePort: http
- path: /
pathType: Prefix
backend:
serviceName: {{ .Release.Name }}-ui
servicePort: 80
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- end -}}
26 changes: 26 additions & 0 deletions charts/fineract/templates/fineract-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- $unused := required "You must set a MySQL root password in mysql.auth.rootPassword" .Values.mysql.auth.rootPassword }}
{{- $unused := required "You must set a MySQL user password in mysql.auth.password" .Values.mysql.auth.password }}

kind: Secret
apiVersion: v1
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
data:
{{- include "secrets" . | nindent 2 }}
type: Opaque
92 changes: 92 additions & 0 deletions charts/fineract/templates/fineract-server-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-backend
namespace: {{ .Release.Namespace }}
labels:
app: fineract
tier: backend
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: fineract-backend
tier: backend
instance: {{ .Release.Name }}
template:
metadata:
labels:
app: fineract-backend
tier: backend
instance: {{ .Release.Name }}
annotations:
# Force a pod restart if secret values change
checksum/secrets: {{ include "secrets" . | sha256sum }}
spec:
initContainers:
- name: wait-db
image: jwilder/dockerize
# We don't care about having the latest...
imagePullPolicy: IfNotPresent
args:
- -wait
- tcp://{{ include "mysql_host" . }}:3306
- -timeout
- 300s
containers:
- name: fineract-backend
image: "{{ .Values.fineractServer.image.name }}:{{ .Values.fineractServer.image.tag }}"
envFrom:
- secretRef:
name: {{ .Release.Name | quote }}
env:
- name: FINERACT_DEFAULT_TENANTDB_HOSTNAME
value: {{ include "mysql_host" . }}
- name: fineract_tenants_url
value: {{ include "mysql_url" . }}
- name: fineract_tenants_uid
value: {{ include "mysql_user" . }}
- name: FINERACT_DEFAULT_TENANTDB_UID
value: {{ include "mysql_user" . }}
{{- if .Values.fineractServer.extraEnv }}
{{- range $key, $value := .Values.fineractServer.extraEnv }}
- name: {{ $key | quote}}
value: |-
{{- tpl $value $ | nindent 16 }}
{{- end }}
{{- end }}
ports:
- containerPort: 8080
name: http
readinessProbe:
httpGet:
path: /fineract-provider/actuator/health/readiness
port: 8080
initialDelaySeconds: 90
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /fineract-provider/actuator/health/liveness
port: 8080
initialDelaySeconds: 90
timeoutSeconds: 10
resources:
{{- .Values.fineractServer.resources | toYaml | nindent 12 }}
Loading

0 comments on commit d895334

Please sign in to comment.