Setup configMap and startup and shutdown scripts
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
472f5b6280
commit
a9c2140463
@@ -107,33 +107,40 @@ _(Note that in previous versions, the `mysqlserver` environment variable used at
|
|||||||
and the `mysqlserver` environment variable is now no longer supported.)_
|
and the `mysqlserver` environment variable is now no longer supported.)_
|
||||||
|
|
||||||
|
|
||||||
Instructions to run using minikube and kubectl
|
Instructions to run on kubernetes
|
||||||
===================================================
|
=================================
|
||||||
|
|
||||||
You can also run Fineract using containers on a kubernetes cluster.
|
You can also run Fineract using containers on a kubernetes cluster.
|
||||||
|
Make sure you set up and connect to your Kubernetes cluster.
|
||||||
|
You can follow [this](https://cwiki.apache.org/confluence/display/FINERACT/Install+and+configure+kubectl+and+Google+Cloud+SDK+on+ubuntu+16.04) guide to set up a Kubernetes cluster on GKE. Make sure to replace `apache-fineract-cn` with `apache-fineract`
|
||||||
|
|
||||||
|
Now from your cloud shell, run the following commands:
|
||||||
|
|
||||||
|
1. `git clone https://github.com/apache/fineract.git ; cd fineract/kubernetes`
|
||||||
|
1. `sh kubectl-startup.sh`
|
||||||
|
|
||||||
|
To shutdown and reset your cluster, run:
|
||||||
|
`sh kubectl-shutdown.sh`
|
||||||
|
|
||||||
|
Alternatively, you can run fineract on a local kubernetes cluster(minikube).
|
||||||
As Prerequisites, you must have `minikube` and `kubectl` installed on your machine; see
|
As Prerequisites, you must have `minikube` and `kubectl` installed on your machine; see
|
||||||
[Minikube & Kubectl install](https://kubernetes.io/docs/tasks/tools/install-minikube/).
|
[Minikube & Kubectl install](https://kubernetes.io/docs/tasks/tools/install-minikube/).
|
||||||
|
|
||||||
Now to run a new Fineract instance on minikube you can simply:
|
Now to run a new Fineract instance on minikube you can simply:
|
||||||
|
|
||||||
1. `git clone https://github.com/apache/fineract.git ; cd fineract`
|
1. `git clone https://github.com/apache/fineract.git ; cd fineract/kubernetes`
|
||||||
1. `minikube start --mount-string="./fineract-db/docker:/fineract-db" --mount`
|
1. `minikube start`
|
||||||
1. `kubectl apply -f kubernetes/secrets.yml`
|
1. `sh kubectl-startup.sh`
|
||||||
1. `kubectl apply -f kubernetes/fineractmysql-deployment.yml`
|
|
||||||
1. `kubectl apply -f kubernetes/fineract-server-deployment.yml`
|
|
||||||
1. `minikube service fineract-server --url`
|
1. `minikube service fineract-server --url`
|
||||||
1. Fineract will run at the provided url
|
1. Fineract will run at the provided url
|
||||||
|
|
||||||
NB : Change protocol from `http` to `https`
|
NB : Change protocol from `http` to `https`
|
||||||
=======================================
|
|
||||||
|
|
||||||
To check the status of your containers on your local kubernetes cluster, run:
|
To check the status of your containers on your local kubernetes cluster, run:
|
||||||
`minikube dashboard`
|
`minikube dashboard`
|
||||||
|
|
||||||
Having difficulties setting up minikube locally, you can try out the deployment
|
To shutdown and reset your cluster, run:
|
||||||
using katacoda(https://www.katacoda.com/courses/kubernetes/launch-single-node-cluster)
|
`sh kubectl-shutdown.sh`
|
||||||
From there start the scenario and follow the instructions as indicated above.
|
|
||||||
|
|
||||||
|
|
||||||
Checkstyle
|
Checkstyle
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
@@ -31,7 +32,9 @@ spec:
|
|||||||
app: fineract-server
|
app: fineract-server
|
||||||
tier: backend
|
tier: backend
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# 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: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: fineractmysql-initdb
|
||||||
|
labels:
|
||||||
|
app: fineract-server
|
||||||
|
data:
|
||||||
|
init.sql: |
|
||||||
|
# create databases
|
||||||
|
CREATE DATABASE IF NOT EXISTS `fineract_tenants`;
|
||||||
|
CREATE DATABASE IF NOT EXISTS `fineract_default`;
|
||||||
|
|
||||||
|
# create root user and grant rights
|
||||||
|
GRANT ALL ON *.* TO 'root'@'%';
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolume
|
kind: PersistentVolume
|
||||||
metadata:
|
metadata:
|
||||||
@@ -30,7 +31,9 @@ spec:
|
|||||||
- ReadWriteMany
|
- ReadWriteMany
|
||||||
hostPath:
|
hostPath:
|
||||||
path: "/mnt/data"
|
path: "/mnt/data"
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
@@ -42,7 +45,9 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 5Gi
|
storage: 5Gi
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
@@ -58,7 +63,9 @@ spec:
|
|||||||
app: fineract-server
|
app: fineract-server
|
||||||
tier: fineractmysql
|
tier: fineractmysql
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -102,12 +109,12 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: fineractmysql-persistent-storage
|
- name: fineractmysql-persistent-storage
|
||||||
mountPath: /var/lib/mysql/
|
mountPath: /var/lib/mysql/
|
||||||
- name: fineractmysql-host-path
|
- name: fineractmysql-initdb
|
||||||
mountPath: /docker-entrypoint-initdb.d/
|
mountPath: /docker-entrypoint-initdb.d/
|
||||||
volumes:
|
volumes:
|
||||||
- name: fineractmysql-persistent-storage
|
- name: fineractmysql-persistent-storage
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: fineractmysql-pv-claim
|
claimName: fineractmysql-pv-claim
|
||||||
- name: fineractmysql-host-path
|
- name: fineractmysql-initdb
|
||||||
hostPath:
|
configMap:
|
||||||
path: /fineract-db
|
name: fineractmysql-initdb
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
kubectl delete -f secrets.yml
|
||||||
|
kubectl delete -f fineractmysql-configmap.yml
|
||||||
|
kubectl delete -f fineractmysql-deployment.yml
|
||||||
|
kubectl delete -f fineract-server-deployment.yml
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
echo "Setting Up Fineract service configuration..."
|
||||||
|
kubectl apply -f secrets.yml
|
||||||
|
kubectl apply -f fineractmysql-configmap.yml
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Starting fineractmysql..."
|
||||||
|
kubectl apply -f fineractmysql-deployment.yml
|
||||||
|
|
||||||
|
fineractmysql_pod=""
|
||||||
|
while [[ ${#fineractmysql_pod} -eq 0 ]]; do
|
||||||
|
fineractmysql_pod=$(kubectl get pods -l tier=fineractmysql --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
|
||||||
|
done
|
||||||
|
#sleep 5
|
||||||
|
fineractmysql_status=$(kubectl get pods ${fineractmysql_pod} --no-headers -o custom-columns=":status.phase")
|
||||||
|
while [[ ${fineractmysql_status} -ne 'Running' ]]; do
|
||||||
|
sleep 1
|
||||||
|
fineractmysql_status=$(kubectl get pods ${fineractmysql_pod} --no-headers -o custom-columns=":status.phase")
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Starting fineract server..."
|
||||||
|
kubectl apply -f fineract-server-deployment.yml
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
|||||||
Reference in New Issue
Block a user