Skip to content

Commit

Permalink
Oracle SOA Suite 22.3.2 EDG scripts - preview (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashageetha authored Aug 29, 2022
1 parent 22657c2 commit 73cbcc8
Show file tree
Hide file tree
Showing 3 changed files with 385 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Set up Oracle SOA Suite on a Kubernetes cluster

Scripts to deploy Oracle SOA Suite on a Kubernetes cluster.

## Prerequisites

- The passwordless `ssh` access to the master node from where the script is run.
- The `user` with the passwordless sudo access.
- The `user` with access to the Kubernetes cluster from the master node.

## Set up the code repository

- Create a working directory to set up the source code:
```bash
$ mkdir $HOME/soa_edg
$ cd $HOME/soa_edg
```

- Download the deployment scripts from the `fmw-kubernetes` repository. Required scripts are available at `FMWKubernetesMAA/OracleEnterpriseDeploymentAutomation/OracleSOASuite`:

```bash
$ cd ${HOME}/soa_edg
$ git clone https://github.com/oracle/fmw-kubernetes.git
$ export EDG_WORKDIR=$HOME/soa_edg/fmw-kubernetes/FMWKubernetesMAA/OracleEnterpriseDeploymentAutomation/OracleSOASuite
$ cd ${EDG_WORKDIR}
```

## Set environment values

Update the values in the `maak8soa.env` script with the values for your environment. The script requires information about different properties detailed in the table below with default values:

| Parameter | Description | Default |
| --- | --- | --- |
| `share_dir` | Kubernetes PV shared storage that will host the Oracle SOA Suite domain. | `/k8nfs` |
| `script_dir` | Directory for deployment scripts | `/scripts` |
| `output_dir` | Location to generate the output log and deployment files | `/soak8edg/output$dt` |
| `user` | User with passwordless sudo access to the master node| `myuser` |
| `ssh_key` | ssh key for master node access | `/home/myuser/KeySOAMAA.ppk` |
| `mnode1` | Kubernetes control plane node1 hostname | `olk8-m1` |
| `mnode2` | Kubernetes control plane node2 hostname | `olk8-m2` |
| `mnode3` | Kubernetes control plane node3 hostname | `olk8-m3` |
| `wnode1` | Worker node1 hostname | `olk8-w1` |
| `wnode2` | Worker node2 hostname | `olk8-w2` |
| `wnode3` | Worker node3 hostname | `olk8-w3` |
| `helm_version` | Helm version to be used | `3.5.4` |
| `wlsoperator_version` | WebLogic Kubernetes Operator version to be used | `3.4.2` |
| `soak8branch` | fmw-kubernetes release version | `22.3.2` |
| `soaimage` | Oracle SOA Suite Docker image | `soasuite:12.2.1.4` |
| `soaedgprefix` | RCU prefix for SOA schemas | `K8EDG`|
| `db_url` | Database connection URL | `mydb.example.com:1521/mypdb.example.com` |
| `soaedgdomain` | Oracle SOA Suite domain name | `soaedgdomain`|
| `domain_type` | Type of Oracle SOA Suite domain. Values are `soa` or `osb` or`soaosb`. | `soaosb` |
| `LBR_HN` | Load balancer virtual hostname (front end) | `k8lbr.paasmaaexample.com` |
| `soapdb` | DB PDB that will host the SOA schemas | `SOAPDB`|
| `max_trycountpod` | Number of checks on Kubernetes SOA pod creation | `90` |
| `sleeplapsepod` | Timeout settings for retries on Kubernetes SOA pod check | `20` |

## Deploy Oracle SOA Suite domain

Scripts to deploy an Oracle SOA Suite domain are located in `FMWKubernetesMAA/OracleEnterpriseDeploymentAutomation/OracleSOASuite`. Run the `maak8soa.sh` script to deploy the Oracle SOA Suite domain.

``` bash
$ cd ${EDG_WORKDIR}
$ ./maak8soa.sh
```

The script performs the following operations, among others:
- Deploys Helm.
- Installs WebLogic Kubernetes Operator and configures it.
- Clones the [fmw-kubernetes](https://github.com/oracle/fmw-kubernetes) GitHub repository.
- Creates Kubernetes secrets for RCU schema and domain credentials.
- Creates persistent volume (PV) and persistent volume claim (PVC).
- Creates RCU schemas using the RCU pod.
- Creates the SOA domain YAML file.
- Creates the SOA EDG domain.
- Creates a node port for each of the cluster services in the SOA domain.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Copyright (c) 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#
# Description:
# Script to set the EDG environment for Oracle SOA Suite deployment on a Kubernetes cluster
#
#
export dt=`date "+%F_%H-%M-%S"`


export share_dir=/k8nfs

# Directory for deployment scripts
# Note: Deployment scripts can be accessible from any nodes if placed in a shared directory
export script_dir=/scripts

# Location to generate the output log and deployment files
export output_dir=/soak8edg/output$dt

# sudo ready user
export user=myuser

# ssh key
export ssh_key=/home/myuser/KeySOAMAA.ppk

# List of Kubernetes nodes
export mnode1=olk8-m1
export mnode2=olk8-m2
export mnode3=olk8-m3
export wnode1=olk8-w1
export wnode2=olk8-w2
export wnode3=olk8-w3

# Helm version
export helm_version=3.5.4

# WebLogic Kubernetes Operator version
export wlsoperator_version=3.4.2
export soak8branch=22.3.2
export soaopdir=${script_dir}/${mnode1}/soa-$soak8branch

# SOA Suite domain information
export soaimage=soasuite:12.2.1.4
export soaedgprefix=K8EDG
export db_url=mydb.example.com:1521/mypdb.example.com
export soaedgdomain=soaedgdomain
export domain_type=soaosb
export LBR_HN=k8lbr.paasmaaexample.com

# Timeout settings for retries on Kubernetes SOA pod status
export max_trycountpod=90
export sleeplapsepod=20
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
#!/usr/bin/env bash
# Copyright (c) 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#
# Description
# Script for Oracle SOA Suite deployment on Kubernetes
# Assumes that a Kubernetes cluster is present with an appropriate NFS mount for the PV
# Depends on variables set in maak8soa.env

script="${BASH_SOURCE[0]}"
scriptDir="$( cd "$( dirname "${script}" )" && pwd )"
source ${scriptDir}/maak8soa.env

read -s -p "Enter WebLogic password: " wlpswd
echo
read -s -p "Enter Database sys password: " syspwd
echo
read -s -p "Enter RCU schema password: " schemapwd
echo

export wlpswd syspwd schemapwd

echo "Sleeping 10 seconds in case you want to break..."
sleep 10
# Labeling nodes for the Oracle SOA Suite domain (may need to parameterize this for larger clusters)
echo "Labeling nodes..."
ssh -i $ssh_key $user@$mnode1 "kubectl label node $wnode1 name=admin"
ssh -i $ssh_key $user@$mnode1 "kubectl label node $wnode2 name=wls1"
ssh -i $ssh_key $user@$mnode1 "kubectl label node $wnode3 name=wls2"
echo "Nodes labeled."

# Steps specific to Oracle SOA Suite
echo "Git cloning fmw-kubernetes repository..."
ssh -i $ssh_key $user@$mnode1 "sudo mkdir -p $soaopdir && sudo chown $user:$user $soaopdir"
ssh -i $ssh_key $user@$mnode1 "sudo yum install -y git-all";
sleep 5


ssh -i $ssh_key $user@$mnode1 "cd $soaopdir && git clone https://github.com/oracle/fmw-kubernetes.git --branch release/$soak8branch"
echo "Set up code repository to deploy Oracle SOA Suite domains done"

echo "Sleeping 10 seconds in case you want to break..."
sleep 10

echo "Creating namespaces..."
ssh -i $ssh_key $user@$mnode1 "kubectl create namespace opns"
ssh -i $ssh_key $user@$mnode1 "kubectl create serviceaccount -n opns op-sa"
ssh -i $ssh_key $user@$mnode1 "kubectl create namespace soans"
echo "Namespaces created!"

echo "Installing operator $wlsoperator_version..."
# Install operator
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes && helm install weblogic-kubernetes-operator charts/weblogic-operator --namespace opns --set image=ghcr.io/oracle/weblogic-kubernetes-operator:$wlsoperator_version --set serviceAccount=op-sa --set 'domainNamespaces={}' --set "javaLoggingLevel=FINE" --wait"
sleep 10

# Configure the operator to manage domains
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes && helm upgrade --reuse-values --namespace opns --set "domainNamespaces={soans}" --wait weblogic-kubernetes-operator charts/weblogic-operator"
echo "Operator installed!"

echo "Sleeping 10 seconds in case you want to break..."
sleep 10

echo "Creating secrets..."
# Create a Kubernetes secret for the domain
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-weblogic-domain-credentials && ./create-weblogic-credentials.sh -u weblogic -p ${wlpswd} -n soans -d $soaedgdomain -s $soaedgdomain-domain-credentials";
sleep 5

# Create a Kubernetes secret for the RCU
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-rcu-credentials && ./create-rcu-credentials.sh -u $soaedgprefix -p $schemapwd -a sys -q ${syspwd} -d $soaedgdomain -n soans -s $soaedgdomain-rcu-credentials"

echo "Secrets created!"

echo "Creating persistent volume and persistent volume claim..."
ssh -i $ssh_key $user@$mnode1 "mkdir -p $output_dir"
#Create a persistent volume configuration file
ssh -i $ssh_key $user@$mnode1 "cp $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml $output_dir/create-pv-pvc-inputs.yaml.$dt";

ssh -i $ssh_key $user@$mnode1 "cat <<EOF > $output_dir/create-pv-pvc-inputs.yaml
version: create-weblogic-sample-domain-pv-pvc-inputs-v
baseName: $soaedgdomain
domainUID: $soaedgdomain
namespace: soans
weblogicDomainStorageType: HOST_PATH
weblogicDomainStorageReclaimPolicy: Retain
weblogicDomainStorageSize: 10Gi
weblogicDomainStoragePath: $share_dir
EOF
"
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-weblogic-domain-pv-pvc && ./create-pv-pvc.sh -i $output_dir/create-pv-pvc-inputs.yaml -o $output_dir";
ssh -i $ssh_key $user@$mnode1 "kubectl create -f $output_dir/pv-pvcs/$soaedgdomain-$soaedgdomain-pv.yaml -n soans";
ssh -i $ssh_key $user@$mnode1 "kubectl create -f $output_dir/pv-pvcs/$soaedgdomain-$soaedgdomain-pvc.yaml -n soans";
echo "Persistent volume and persistent volume claim created!"

echo "Sleeping 10 seconds in case you want to break..."
sleep 10

echo "Creating RCU schemas..."
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-rcu-schema && $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-rcu-schema/create-rcu-schema.sh -s $soaedgprefix -t $domain_type -d $db_url -i $soaimage -q $syspwd -r $schemapwd -l LARGE"
echo "RCU schemas created!"
echo "Sleeping 10 seconds in case you want to break..."
sleep 10

echo "Creating domain..."
#Modify domain creation input file
ssh -i $ssh_key $user@$mnode1 "cp $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-soa-domain/domain-home-on-pv/create-domain-inputs.yaml $output_dir/create-domain-inputs.yaml.$dt";

ssh -i $ssh_key $user@$mnode1 "cat <<EOF > $output_dir/create-domain-inputs.yaml
version: create-weblogic-sample-domain-inputs-v1
sslEnabled: false
adminServerSSLPort: 7002
httpAccessLogInLogHome: true
persistentStore: jdbc
soaManagedServerSSLPort: 8002
adminPort: 7001
adminServerName: AdminServer
domainUID: $soaedgdomain
domainType: $domain_type
domainHome: /u01/oracle/user_projects/domains/${soaedgdomain}
serverStartPolicy: IF_NEEDED
soaClusterName: soa_cluster
configuredManagedServerCount: 5
initialManagedServerReplicas: 2
soaManagedServerNameBase: soa_server
soaManagedServerPort: 8001
osbClusterName: osb_cluster
osbManagedServerNameBase: osb_server
osbManagedServerPort: 9001
osbManagedServerSSLPort: 9002
image: $soaimage
imagePullPolicy: IfNotPresent
productionModeEnabled: true
weblogicCredentialsSecretName: ${soaedgdomain}-domain-credentials
includeServerOutInPodLog: true
logHome: /u01/oracle/user_projects/domains/logs/${soaedgdomain}
t3ChannelPort: 30012
t3PublicAddress: ${LBR_HN}
exposeAdminT3Channel: true
adminNodePort: 30701
exposeAdminNodePort: true
namespace: soans
javaOptions: -Dweblogic.StdoutDebugEnabled=false
persistentVolumeClaimName: ${soaedgdomain}-${soaedgdomain}-pvc
domainPVMountPath: /u01/oracle/user_projects
createDomainScriptsMountPath: /u01/weblogic
createDomainScriptName: create-domain-job.sh
createDomainFilesDir: wlst
rcuSchemaPrefix: $soaedgprefix
rcuDatabaseURL: $db_url
rcuCredentialsSecret: ${soaedgdomain}-rcu-credentials
persistentStore: jdbc
serverPodMemoryRequest: 10Gi
serverPodMemoryLimit: 10Gi
serverPodCpuRequest: 1000m
serverPodCpuLimit: 1000m
EOF
"

#Create the SOA EDG domain
ssh -i $ssh_key $user@$mnode1 "cd $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-soa-domain/domain-home-on-pv && $soaopdir/fmw-kubernetes/OracleSOASuite/kubernetes/create-soa-domain/domain-home-on-pv/create-domain.sh -i $output_dir/create-domain-inputs.yaml -o $output_dir"

ssh -i $ssh_key $user@$mnode1 "kubectl apply -f $output_dir/weblogic-domains/$soaedgdomain/domain.yaml"

stillnotuppod=true
trycountpod=0

#Verify domain start
while [ $stillnotuppod == "true" ]
do
resultpod=`ssh -i $ssh_key $user@$host "kubectl get pods -n soans"| grep soa-server |grep Running | wc -l`
if [ $resultpod -gt 1 ]; then
stillnotuppod="true"
echo "SOA pod not ready, waiting..."
((trycountpod=trycountpod+1))
sleep $sleeplapsepod
if [ "$trycountpod" -eq "$max_trycountpod" ];then
echo "Maximum number of retries reached! SOA pod not ready. Check status manually."
exit
fi
else
stillnotuppod="false"
echo "SOA pod up, life is good, domain created!"
ssh -i $ssh_key $user@$mnode1 "kubectl describe domain $soaedgdomain -n soans"
ssh -i $ssh_key $user@$mnode1 "kubectl get services -n soans"
fi
done

echo "Sleeping 10 seconds in case you want to break..."
sleep 10

echo "Creating node port services..."
if [[ "$domain_type" == *"soa"* ]]; then
# Create node port services
ssh -i $ssh_key $user@$mnode1 "cat <<EOF > $output_dir/create-nodeport${soaedgdomain}-soa-cluster.yaml
apiVersion: v1
kind: Service
metadata:
namespace: soans
labels:
serviceType: CLUSTER
weblogic.clusterName: soa_cluster
weblogic.domainName: ${soaedgdomain}
weblogic.domainUID: ${soaedgdomain}
name: ${soaedgdomain}-cluster-soa-cluster-node-port
spec:
ports:
- nodePort: 30801
port: 8001
protocol: TCP
targetPort: 8001
selector:
weblogic.clusterName: soa_cluster
weblogic.domainUID: ${soaedgdomain}
sessionAffinity: ClientIP
type: NodePort
EOF
"
ssh -i $ssh_key $user@$mnode1 "kubectl apply -f $output_dir/create-nodeport${soaedgdomain}-soa-cluster.yaml"
export soaport=`ssh -i $ssh_key $user@$mnode1 "kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services ${soaedgdomain}-cluster-soa-cluster-node-port -n soans"`
echo "SOA CLUSTER PORT: $soaport"
fi

if [[ "$domain_type" == *"osb"* ]]; then
ssh -i $ssh_key $user@$mnode1 "cat <<EOF > $output_dir/create-nodeport${soaedgdomain}-osb-cluster.yaml
apiVersion: v1
kind: Service
metadata:
namespace: soans
labels:
serviceType: CLUSTER
weblogic.clusterName: osb_cluster
weblogic.domainName: ${soaedgdomain}
weblogic.domainUID: ${soaedgdomain}
name: ${soaedgdomain}-cluster-osb-cluster-node-port
spec:
ports:
- nodePort: 30901
port: 9001
protocol: TCP
targetPort: 9001
selector:
weblogic.clusterName: osb_cluster
weblogic.domainUID: ${soaedgdomain}
sessionAffinity: ClientIP
type: NodePort
EOF
"
ssh -i $ssh_key $user@$mnode1 "kubectl apply -f $output_dir/create-nodeport${soaedgdomain}-osb-cluster.yaml"
export osbport=`ssh -i $ssh_key $user@$mnode1 "kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services ${soaedgdomain}-cluster-osb-cluster-node-port -n soans"`
echo "OSB CLUSTER PORT: $osbport"
fi

export adminport=`ssh -i $ssh_key $user@$mnode1 "kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services ${soaedgdomain}-adminserver-node-port -n soans"`
echo "ADMINISTRATION SERVER PORT: $adminport"
echo "Node port services created!"

echo "ALL DONE!"

0 comments on commit 73cbcc8

Please sign in to comment.