Skip to content

Commit f94c0e7

Browse files
FINERACT-2421: Fix kubernetes minikube example configuration
1 parent 630f41f commit f94c0e7

File tree

6 files changed

+157
-52
lines changed

6 files changed

+157
-52
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,49 @@ git clone https://github.com/apache/fineract.git
203203
cd fineract/kubernetes
204204
minikube start
205205
./kubectl-startup.sh
206+
```
207+
208+
Wait for all pods to be ready:
209+
```bash
210+
kubectl get pods -w
211+
```
212+
213+
Once all pods are running, access the Mifos web application:
214+
```bash
215+
minikube service mifos-community
216+
```
217+
218+
This opens the Mifos X web application in your browser. The nginx reverse proxy in the mifos-community pod forwards API requests to the fineract-server backend.
219+
220+
**Default credentials:**
221+
- Username: `mifos`
222+
- Password: `password`
223+
224+
You can also access the Fineract API directly:
225+
```bash
206226
minikube service fineract-server --url --https
207227
```
208228

209229
Fineract is now running at the printed URL, which you can check e.g. using:
210230
```bash
211231
http --verify=no --timeout 240 --check-status get $(minikube service fineract-server --url --https)/fineract-provider/actuator/health
212232
```
233+
213234
To check the status of your containers on your local minikube Kubernetes cluster, run:
214235
```bash
215236
minikube dashboard
216237
```
238+
217239
You can check Fineract logs using:
218240
```bash
219241
kubectl logs deployment/fineract-server
220242
```
243+
244+
You can check Mifos web app logs using:
245+
```bash
246+
kubectl logs deployment/mifos-community
247+
```
248+
221249
To shutdown and reset your cluster, run:
222250
```bash
223251
./kubectl-shutdown.sh

kubernetes/fineract-mifoscommunity-deployment.yml

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,45 @@
1717
#
1818

1919

20+
apiVersion: v1
21+
kind: ConfigMap
22+
metadata:
23+
name: web-app-config
24+
data:
25+
environment.json: |
26+
{
27+
"fineractApiUrls": ["/fineract-provider"],
28+
"oauth": {
29+
"enabled": false
30+
},
31+
"defaultLanguage": "en-US",
32+
"supportedLanguages": ["en-US", "es-MX"],
33+
"preloadClients": true
34+
}
35+
nginx.conf: |
36+
server {
37+
listen 80;
38+
server_name localhost;
39+
root /usr/share/nginx/html;
40+
index index.html;
41+
42+
location / {
43+
try_files $uri $uri/ /index.html;
44+
}
45+
46+
location /fineract-provider/ {
47+
proxy_pass https://fineract-server:8443/fineract-provider/;
48+
proxy_ssl_verify off;
49+
proxy_set_header Host $host;
50+
proxy_set_header X-Real-IP $remote_addr;
51+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
52+
proxy_set_header X-Forwarded-Proto https;
53+
proxy_redirect https:// http://;
54+
}
55+
}
56+
57+
---
58+
2059
apiVersion: v1
2160
kind: Service
2261
metadata:
@@ -60,26 +99,43 @@ spec:
6099
command: ['sh', '-c', 'echo -e "Checking for the availability of Fineract server deployment"; while ! nc -z "fineract-server" 8443; do sleep 1; printf "-"; done; echo -e " >> Fineract server has started";']
61100
containers:
62101
- name: mifos-community
63-
image: openmf/community-app:latest
102+
image: openmf/web-app:master
64103
resources:
65104
limits:
66105
cpu: "1000m"
67106
memory: "1Gi"
68107
requests:
69108
cpu: "200m"
70109
memory: "0.5Gi"
110+
volumeMounts:
111+
- name: web-app-config
112+
mountPath: /usr/share/nginx/html/assets/configuration
113+
readOnly: true
114+
- name: nginx-config
115+
mountPath: /etc/nginx/conf.d/default.conf
116+
subPath: nginx.conf
117+
readOnly: true
71118
livenessProbe:
72119
httpGet:
73120
path: /
74121
port: 80
75-
initialDelaySeconds: 90
76-
periodSeconds: 1
122+
initialDelaySeconds: 10
123+
periodSeconds: 10
124+
failureThreshold: 3
77125
readinessProbe:
78126
httpGet:
79127
path: /
80128
port: 80
81-
initialDelaySeconds: 90
82-
periodSeconds: 1
129+
initialDelaySeconds: 5
130+
periodSeconds: 10
131+
failureThreshold: 3
83132
ports:
84133
- containerPort: 80
85134
name: mifos-community
135+
volumes:
136+
- name: web-app-config
137+
configMap:
138+
name: web-app-config
139+
- name: nginx-config
140+
configMap:
141+
name: web-app-config

kubernetes/fineract-server-deployment.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,26 @@ spec:
6464
resources:
6565
limits:
6666
cpu: "1000m"
67-
memory: "1Gi"
67+
memory: "2Gi"
6868
requests:
6969
cpu: "200m"
70-
memory: "0.5Gi"
70+
memory: "1Gi"
7171
livenessProbe:
7272
httpGet:
7373
path: /fineract-provider/actuator/health/liveness
74-
port: 8080
75-
initialDelaySeconds: 180
76-
periodSeconds: 1
74+
port: 8443
75+
scheme: HTTPS
76+
initialDelaySeconds: 90
77+
periodSeconds: 10
78+
failureThreshold: 3
7779
readinessProbe:
7880
httpGet:
7981
path: /fineract-provider/actuator/health/readiness
80-
port: 8080
81-
initialDelaySeconds: 180
82-
periodSeconds: 1
82+
port: 8443
83+
scheme: HTTPS
84+
initialDelaySeconds: 60
85+
periodSeconds: 10
86+
failureThreshold: 3
8387
env:
8488
- name: FINERACT_NODE_ID
8589
value: '1'
@@ -113,8 +117,10 @@ spec:
113117
key: password
114118
- name: FINERACT_DEFAULT_TENANTDB_CONN_PARAMS
115119
value: ''
120+
- name: FINERACT_SERVER_PORT
121+
value: "8443"
116122
- name: JAVA_TOOL_OPTIONS
117-
value: '-Xmx1G'
123+
value: '-Xmx1G -XX:MaxMetaspaceSize=256m'
118124
ports:
119125
- containerPort: 8443
120126
name: fineract-server

kubernetes/fineractmysql-deployment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ spec:
103103
key: password
104104
livenessProbe:
105105
exec:
106-
command: ["sh","-c","mysqladmin ping -h localhost -uroot -p${MARIADB_ROOT_PASSWORD}"]
106+
command: ["sh","-c","mariadb -uroot -p${MARIADB_ROOT_PASSWORD} -e 'SELECT 1'"]
107107
failureThreshold: 10
108108
timeoutSeconds: 10
109109
readinessProbe:
110110
exec:
111111
command:
112112
- sh
113113
- -c
114-
- mysqladmin ping -uroot -p${MARIADB_ROOT_PASSWORD}
114+
- mariadb -uroot -p${MARIADB_ROOT_PASSWORD} -e 'SELECT 1'
115115
failureThreshold: 10
116116
initialDelaySeconds: 5
117117
periodSeconds: 5

kubernetes/kubectl-shutdown.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,20 @@
1818
# under the License.
1919
#
2020

21-
kubectl delete secret fineract-tenants-db-secret
22-
kubectl delete -f fineractmysql-configmap.yml
23-
kubectl delete -f fineractmysql-deployment.yml
24-
kubectl delete -f fineract-server-deployment.yml
25-
kubectl delete -f fineract-mifoscommunity-deployment.yml
21+
echo "Shutting down Fineract Kubernetes deployment..."
22+
23+
echo "Deleting mifos-community..."
24+
kubectl delete -f fineract-mifoscommunity-deployment.yml --ignore-not-found=true
25+
26+
echo "Deleting fineract-server..."
27+
kubectl delete -f fineract-server-deployment.yml --ignore-not-found=true
28+
29+
echo "Deleting fineractmysql..."
30+
kubectl delete -f fineractmysql-deployment.yml --ignore-not-found=true
31+
kubectl delete -f fineractmysql-configmap.yml --ignore-not-found=true
32+
33+
echo "Deleting secrets..."
34+
kubectl delete secret fineract-tenants-db-secret --ignore-not-found=true
35+
36+
echo
37+
echo "Fineract Kubernetes deployment has been shut down."

kubernetes/kubectl-startup.sh

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,53 +18,56 @@
1818
# under the License.
1919
#
2020

21-
echo "Setting Up Fineract service configuration..."
22-
kubectl create secret generic fineract-tenants-db-secret --from-literal=username=root --from-literal=password=$(head /dev/urandom | LC_CTYPE=C tr -dc A-Za-z0-9 | head -c 16)
21+
set -e
22+
23+
echo "Setting up Fineract service configuration..."
24+
kubectl create secret generic fineract-tenants-db-secret --from-literal=username=root --from-literal=password=$(head /dev/urandom | LC_CTYPE=C tr -dc A-Za-z0-9 | head -c 16) 2>/dev/null || echo "Secret already exists, skipping..."
2325
kubectl apply -f fineractmysql-configmap.yml
2426

2527
echo
2628
echo "Starting fineractmysql..."
2729
kubectl apply -f fineractmysql-deployment.yml
2830

29-
fineractmysql_pod=""
30-
while [[ ${#fineractmysql_pod} -eq 0 ]]; do
31-
fineractmysql_pod=$(kubectl get pods -l tier=fineractmysql --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
32-
done
33-
34-
fineractmysql_status=$(kubectl get pods ${fineractmysql_pod} --no-headers -o custom-columns=":status.phase")
35-
while [[ ${fineractmysql_status} -ne 'Running' ]]; do
36-
sleep 1
37-
fineractmysql_status=$(kubectl get pods ${fineractmysql_pod} --no-headers -o custom-columns=":status.phase")
38-
done
31+
echo "Waiting for fineractmysql to be ready..."
32+
kubectl wait --for=condition=ready pod -l tier=fineractmysql --timeout=300s
3933

4034
echo
4135
echo "Starting fineract server..."
4236
kubectl apply -f fineract-server-deployment.yml
4337

44-
fineract_server_pod=""
45-
while [[ ${#fineract_server_pod} -eq 0 ]]; do
46-
fineract_server_pod=$(kubectl get pods -l tier=backend --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
47-
done
48-
49-
fineract_server_status=$(kubectl get pods ${fineract_server_pod} --no-headers -o custom-columns=":status.phase")
50-
while [[ ${fineract_server_status} -ne 'Running' ]]; do
51-
sleep 1
52-
fineract_server_status=$(kubectl get pods ${fineract_server_pod} --no-headers -o custom-columns=":status.phase")
53-
done
38+
echo "Waiting for fineract-server to be ready..."
39+
kubectl wait --for=condition=ready pod -l app=fineract-server --timeout=300s
5440

5541
echo "Fineract server is up and running"
5642

43+
echo
5744
echo "Starting Mifos Community UI..."
5845
kubectl apply -f fineract-mifoscommunity-deployment.yml
5946

60-
fineract_mifoscommunity_pod=""
61-
while [[ ${#fineract_mifoscommunity_pod} -eq 0 ]]; do
62-
fineract_mifoscommunity_pod=$(kubectl get pods -l tier=backend --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
63-
done
47+
echo "Waiting for mifos-community to be ready..."
48+
kubectl wait --for=condition=ready pod -l app=mifos-community --timeout=300s
6449

65-
fineract_mifoscommunity_status=$(kubectl get pods ${fineract_mifoscommunity_pod} --no-headers -o custom-columns=":status.phase")
66-
while [[ ${fineract_mifoscommunity_status} -ne 'Running' ]]; do
67-
sleep 1
68-
fineract_mifoscommunity_status=$(kubectl get pods ${fineract_mifoscommunity_pod} --no-headers -o custom-columns=":status.phase")
69-
done
7050
echo "Mifos Community UI is up and running"
51+
52+
echo
53+
echo "============================================"
54+
echo "Fineract Kubernetes deployment is ready!"
55+
echo "============================================"
56+
echo
57+
echo "To access the Mifos web application:"
58+
echo " minikube service mifos-community"
59+
echo
60+
echo "To access the Fineract API directly:"
61+
echo " minikube service fineract-server --url --https"
62+
echo
63+
echo "Default credentials:"
64+
echo " Username: mifos"
65+
echo " Password: password"
66+
echo
67+
echo "To check pod status:"
68+
echo " kubectl get pods"
69+
echo
70+
echo "To view logs:"
71+
echo " kubectl logs deployment/fineract-server"
72+
echo " kubectl logs deployment/mifos-community"
73+
echo

0 commit comments

Comments
 (0)