Skip to content
Permalink
Browse files
Implement kubernetes scripts to deploy identity and rhythm
  • Loading branch information
Anh3h committed Nov 27, 2019
1 parent 01b7215 commit cdbb11808682e8c62a2618ee7a1d5f1e5fe1dcbf
Showing 6 changed files with 189 additions and 19 deletions.
@@ -3,10 +3,10 @@ kind: ConfigMap
metadata:
name: fineract-service-config
data:
bonecp.acquireIncrement: "1"
bonecp.maxConnectionsPerPartition: "4"
bonecp.minConnectionsPerPartition: "1"
bonecp.partitionCount: "1"
bonecp.acquireIncrement: "1" #Might be absent for identity
bonecp.maxConnectionsPerPartition: "4" #Might be absent for identity
bonecp.minConnectionsPerPartition: "1" #Might be absent for identity
bonecp.partitionCount: "1" #Might be absent for identity
cassandra.cl.delete: ONE
cassandra.cl.read: ONE
cassandra.cl.write: ONE
@@ -20,12 +20,11 @@ data:
eureka.instance.leaseRenewalIntervalInSeconds: "20"
eureka.registration.enabled: "true"
feign.hystrix.enabled: "false"
postgresql.database: seshat
postgresql.database: seshat #Might be absent for identity
ribbon.eureka.enabled: "true"
server.max-http-header-size: "16384"
spring.cloud.config.enabled: "false"
spring.cloud.discovery.enabled: "true"
system.initialclientid: service-runner
system.privateKey.exponent: ${PRIVATE_KEY_EXPONENT}
system.privateKey.modulus: ${PRIVATE_KEY_MODULUS}
system.publicKey.exponent: ${PUBLIC_KEY_EXPONENT}
@@ -0,0 +1,80 @@
apiVersion: v1
kind: Service
metadata:
name: identity-service
namespace: default
spec:
selector:
app: identity-ms
ports:
- port: 2021
targetPort: 2021
type: LoadBalancer

---

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: identity-ms-cluster
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: identity-ms
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: identity-ms
spec:
containers:
- name: identity-ms
image: apache/fineract-cn-identity:latest
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: external-tools-config
- configMapRef:
name: fineract-service-config
env:
- name: eureka.instance.hostname
value: identity-ms
- name: server.port
value: "2021"
- name: spring.application.name
value: identity-v1
- name: identity.token.refresh.secureCookie
value: "false"
- name: system.publicKey.modulus
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_MODULUS
name: secret-config
- name: system.publicKey.exponent
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_EXPONENT
name: secret-config
- name: system.publicKey.timestamp
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_TIMESTAMP
name: secret-config
- name: system.privateKey.modulus
valueFrom:
configMapKeyRef:
key: PRIVATE_KEY_MODULUS
name: secret-config
- name: system.privateKey.exponent
valueFrom:
configMapKeyRef:
key: PRIVATE_KEY_EXPONENT
name: secret-config
ports:
- containerPort: 2021
@@ -3,7 +3,7 @@
# kubectl delete -f customer.yml
# kubectl delete -f portfolio.yml
# kubectl delete -f rhythm.yml
# kubectl delete -f identity.yml
kubectl delete -f identity.yml
kubectl delete -f provisioner.yml
kubectl delete configmaps external-tools-config
kubectl delete configmaps fineract-service-config
@@ -12,5 +12,4 @@ kubectl delete configmaps provisioner-datasource-config
kubectl delete -f postgres.yml
kubectl delete -f cassandra.yml
kubectl delete -f eureka.yml
kubectl delete -f activemq.yml
kubectl delete -f ledger.yml
kubectl delete -f activemq.yml
@@ -25,6 +25,9 @@ while [[ ${#cassandra_ip} -eq 0 || ${#postgres_ip} -eq 0 || ${#eureka_ip} -eq 0
| grep -Eo '[0-9.]*')
done


echo ""
echo "Creating default fineract service configuration"
kubectl create configmap external-tools-config \
--from-literal=ribbon.listOfServers=${eureka_ip}:9090 \
--from-literal=eureka.client.serviceUrl.defaultZone=http://${eureka_ip}:8761/eureka \
@@ -35,18 +38,28 @@ kubectl create configmap external-tools-config \
kubectl create configmap provisioner-datasource-config \
--from-literal=spring.datasource.url=jdbc:postgresql://${postgres_ip}:5432/seshat

echo ""
kubectl apply -f config.yml

config_param=$( java -cp ../external_tools/lang-0.1.0-BUILD-SNAPSHOT.jar \
org.apache.fineract.cn.lang.security.RsaKeyPairFactory UNIX | \
sed -e 's/^[ \t]*//' | awk '{print "--from-literal="$1}' )
kubectl create configmap secret-config ${config_param}

echo ""
echo "Starting Provisioner... "
kubectl apply -f provisioner.yml
echo "Done"
# kubectl apply -f identity.yml
# kubectl apply -f rhythm.yml
provisioner_pod=$(kubectl get pods -l app=provisioner-ms --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
echo "Waiting for provisioner to initialize seshat database... "
sleep 5
while ! kubectl logs ${provisioner_pod} | grep -q "Started ProvisionerApplication in"; do
sleep 1
done

echo ""
echo "Start remaining Fineract CN microservices... "
kubectl apply -f identity.yml
kubectl apply -f rhythm.yml
# kubectl apply -f office.yml
# kubectl apply -f customer.yml
# kubectl apply -f ledger.yml
# kubectl apply -f portfolio.yml
# kubectl apply -f ledger.yml
@@ -51,11 +51,8 @@ spec:
value: "2020"
- name: spring.application.name
value: provisioner-v1
- name: system.publicKey.timestamp
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_TIMESTAMP
name: secret-config
- name: system.initialclientid
value: service-runner
- name: system.publicKey.modulus
valueFrom:
configMapKeyRef:
@@ -0,0 +1,82 @@
apiVersion: v1
kind: Service
metadata:
name: rhythm-service
namespace: default
spec:
selector:
app: rhythm-ms
ports:
- port: 2022
targetPort: 2022
type: LoadBalancer

---

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: rhythm-ms-cluster
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: rhythm-ms
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: rhythm-ms
spec:
containers:
- name: rhythm-ms
image: apache/fineract-cn-rhythm:latest
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: external-tools-config
- configMapRef:
name: fineract-service-config
env:
- name: eureka.instance.hostname
value: rhythm-ms
- name: server.port
value: "2022"
- name: spring.application.name
value: rhythm-v1
- name: rhythm.beatCheckRate
value: "600000"
- name: rhythm.user
value: "imhotep"
- name: system.publicKey.modulus
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_MODULUS
name: secret-config
- name: system.publicKey.exponent
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_EXPONENT
name: secret-config
- name: system.publicKey.timestamp
valueFrom:
configMapKeyRef:
key: PUBLIC_KEY_TIMESTAMP
name: secret-config
- name: system.privateKey.modulus
valueFrom:
configMapKeyRef:
key: PRIVATE_KEY_MODULUS
name: secret-config
- name: system.privateKey.exponent
valueFrom:
configMapKeyRef:
key: PRIVATE_KEY_EXPONENT
name: secret-config
ports:
- containerPort: 2022

0 comments on commit cdbb118

Please sign in to comment.