Skip to content

Commit 4582d6b

Browse files
authored
Merge pull request #1 from ashishchalak/master
Adding NFS support to WCSites
2 parents 7bcdd2c + 894d702 commit 4582d6b

File tree

14 files changed

+3582
-3546
lines changed

14 files changed

+3582
-3546
lines changed

OracleWebCenterSites/kubernetes/2.4.0/create-wcsites-domain/create-database/db-with-pv.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ spec:
1313
- ReadWriteMany
1414
# Valid values are Retain, Delete or Recycle
1515
persistentVolumeReclaimPolicy: Retain
16-
hostPath:
17-
# nfs:
18-
# server: %SAMPLE_STORAGE_NFS_SERVER%
16+
#hostPath:
17+
nfs:
18+
server: %NFS_SERVER%
1919
path: "/scratch/K8SVolume/WCSitesDB"
2020
---
2121
kind: PersistentVolumeClaim
Lines changed: 117 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,117 @@
1-
# Copyright 2020, Oracle Corporation and/or its affiliates.
2-
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3-
import xml.dom.minidom
4-
import re
5-
import sys
6-
7-
def getManagedServerCount(domainHome):
8-
# use the parse() function to load and parse an XML file
9-
doc = xml.dom.minidom.parse(domainHome + "/config/config.xml")
10-
servers = doc.getElementsByTagName("server")
11-
print "Total Configured Managed Servers: %d " % (servers.length - 1)
12-
return servers.length - 1;
13-
14-
15-
# Method to uncomment and comment the required tag and save back
16-
def replaceXml(domainHome, ms_server):
17-
f = open(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/ticket-cache.xml","r+w")
18-
filecontent = f.read()
19-
#Uncomment the one to be used
20-
filecontent = re.sub ( r'<!--<cacheManagerPeerProviderFactory','<cacheManagerPeerProviderFactory', filecontent,1)
21-
filecontent = re.sub ( r'cas_tgt" />-->','cas_tgt" />', filecontent,1)
22-
#Comment the one not used
23-
filecontent = re.sub ( r'<cacheManagerPeerProviderFactory','<!--cacheManagerPeerProviderFactory', filecontent,1)
24-
filecontent = re.sub ( r'propertySeparator="," />','propertySeparator="," -->', filecontent,1)
25-
f.seek(0)
26-
f.write(filecontent)
27-
f.write("\n\n\n")
28-
f.close()
29-
30-
# Method to replace the properties
31-
def replaceRmiUrlsInCache(domainHome, prefix, n, ms_server, excludedServerNumber, filename, port):
32-
doc = xml.dom.minidom.parse(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/" + filename)
33-
abc = doc.getElementsByTagName("cacheManagerPeerProviderFactory")
34-
processString = "peerDiscovery=manual,rmiUrls=//localhost:<port>/notifier"
35-
36-
for element in abc:
37-
element.setAttribute("properties", processString)
38-
39-
for x in range (1,n-1):
40-
processString = processString + "|//localhost:<port>/notifier"
41-
42-
# We should have got the properties attribute now tokenized with localhost and 41001. Exclude 1 add the rest
43-
for i in range (1,n+1):
44-
if i <> int(excludedServerNumber):
45-
processString = re.sub ( r'localhost',prefix + str(i), processString,1)
46-
processString = re.sub ( r'<port>',str(port), processString,1)
47-
48-
element.setAttribute("properties", processString)
49-
print(processString)
50-
ghi = doc.getElementsByTagName("cacheManagerPeerListenerFactory")
51-
for element in ghi:
52-
processString = element.getAttribute("properties")
53-
processString = "hostName="+prefix+ str(excludedServerNumber) +",port=" + str(port) +",remoteObjectPort=" + str(int(port)+1) + ",socketTimeoutMillis=12000"
54-
element.setAttribute("properties", processString)
55-
myfile = open(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/" + filename , "w")
56-
myfile.write(doc.toxml())
57-
myfile.close()
58-
print("Updated " + filename)
59-
60-
# Method to replace the properties
61-
def replaceRmiUrls(domainHome, prefix, n, ms_server, excludedServerNumber, port):
62-
doc = xml.dom.minidom.parse(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/ticket-cache.xml")
63-
abc = doc.getElementsByTagName("cacheManagerPeerProviderFactory")
64-
processString = ""
65-
66-
for element in abc:
67-
processString = element.getAttribute("properties")
68-
69-
for x in range (1,n-1):
70-
processString = processString + "|//localhost:41001/cas_st|//localhost:41001/cas_tgt"
71-
72-
# We should have got the properties attribute now tokenized with localhost and 41001. Exclude 1 add the rest
73-
for i in range (1,n+1):
74-
if i <> int(excludedServerNumber):
75-
processString = re.sub ( r'localhost',prefix + str(i), processString,1)
76-
processString = re.sub ( r'41001',str(port), processString,1)
77-
processString = re.sub ( r'localhost',prefix + str(i), processString,1)
78-
processString = re.sub ( r'41001',str(port), processString,1)
79-
80-
element.setAttribute("properties", processString)
81-
print(processString)
82-
ghi = doc.getElementsByTagName("cacheManagerPeerListenerFactory")
83-
for element in ghi:
84-
processString = element.getAttribute("properties")
85-
processString = "hostName=" + prefix + str(excludedServerNumber) + ",port=" + str(port) + ",remoteObjectPort=" + str(int(port)+1) + ",socketTimeoutMillis=12000"
86-
element.setAttribute("properties", processString)
87-
myfile = open(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/ticket-cache.xml", "w")
88-
myfile.write(doc.toxml())
89-
myfile.close()
90-
print("Updated " + "ticket-cache.xml")
91-
92-
def main():
93-
# count the arguments
94-
arguments = len(sys.argv) - 1
95-
print ("The script is called with %i arguments" % (arguments))
96-
domainHome = sys.argv[1]
97-
serverPrefix = sys.argv[2]
98-
ms_server = sys.argv[3]
99-
port = sys.argv[4]
100-
excludedServerNumber = ms_server[-1]
101-
print("Host prefix set to " + serverPrefix)
102-
print("Managed Server set to - " + ms_server)
103-
print("Excluded Server Number set to - " + excludedServerNumber)
104-
print("Starting port set to - " + port)
105-
replaceXml(domainHome, ms_server)
106-
servercount = getManagedServerCount(domainHome)
107-
replaceRmiUrls(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, port)
108-
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "linked-cache.xml", int(port) + 2)
109-
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "cs-cache.xml", int(port) + 4)
110-
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "cas-cache.xml", int(port) + 6 )
111-
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "ss-cache.xml", int(port) + 8 )
112-
113-
114-
if __name__ == "__main__":
115-
# calling main function
116-
main()
117-
1+
# Copyright 2020, Oracle Corporation and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
import xml.dom.minidom
4+
import re
5+
import sys
6+
7+
def getManagedServerCount(domainHome):
8+
# use the parse() function to load and parse an XML file
9+
doc = xml.dom.minidom.parse(domainHome + "/config/config.xml")
10+
servers = doc.getElementsByTagName("server")
11+
print "Total Configured Managed Servers: %d " % (servers.length - 1)
12+
return servers.length - 1;
13+
14+
15+
# Method to uncomment and comment the required tag and save back
16+
def replaceXml(domainHome, ms_server):
17+
f = open(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/ticket-cache.xml","r+w")
18+
filecontent = f.read()
19+
#Uncomment the one to be used
20+
filecontent = re.sub ( r'<!--<cacheManagerPeerProviderFactory','<cacheManagerPeerProviderFactory', filecontent,1)
21+
filecontent = re.sub ( r'cas_tgt" />-->','cas_tgt" />', filecontent,1)
22+
#Comment the one not used
23+
filecontent = re.sub ( r'<cacheManagerPeerProviderFactory','<!--cacheManagerPeerProviderFactory', filecontent,1)
24+
filecontent = re.sub ( r'propertySeparator="," />','propertySeparator="," -->', filecontent,1)
25+
f.seek(0)
26+
f.write(filecontent)
27+
f.write("\n\n\n")
28+
f.close()
29+
30+
# Method to replace the properties
31+
def replaceRmiUrlsInCache(domainHome, prefix, n, ms_server, excludedServerNumber, filename, port):
32+
doc = xml.dom.minidom.parse(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/" + filename)
33+
abc = doc.getElementsByTagName("cacheManagerPeerProviderFactory")
34+
processString = "peerDiscovery=manual,rmiUrls=//localhost:<port>/notifier"
35+
36+
for element in abc:
37+
element.setAttribute("properties", processString)
38+
39+
for x in range (1,n-1):
40+
processString = processString + "|//localhost:<port>/notifier"
41+
42+
# We should have got the properties attribute now tokenized with localhost and 41001. Exclude 1 add the rest
43+
for i in range (1,n+1):
44+
if i <> int(excludedServerNumber):
45+
processString = re.sub ( r'localhost',prefix + str(i), processString,1)
46+
processString = re.sub ( r'<port>',str(port), processString,1)
47+
48+
element.setAttribute("properties", processString)
49+
print(processString)
50+
ghi = doc.getElementsByTagName("cacheManagerPeerListenerFactory")
51+
for element in ghi:
52+
processString = element.getAttribute("properties")
53+
processString = "hostName="+prefix+ str(excludedServerNumber) +",port=" + str(port) +",remoteObjectPort=" + str(int(port)+1) + ",socketTimeoutMillis=12000"
54+
element.setAttribute("properties", processString)
55+
myfile = open(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/" + filename , "w")
56+
myfile.write(doc.toxml())
57+
myfile.close()
58+
print("Updated " + filename)
59+
60+
# Method to replace the properties
61+
def replaceRmiUrls(domainHome, prefix, n, ms_server, excludedServerNumber, port):
62+
doc = xml.dom.minidom.parse(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/ticket-cache.xml")
63+
abc = doc.getElementsByTagName("cacheManagerPeerProviderFactory")
64+
processString = ""
65+
66+
for element in abc:
67+
processString = element.getAttribute("properties")
68+
69+
for x in range (1,n-1):
70+
processString = processString + "|//localhost:41001/cas_st|//localhost:41001/cas_tgt"
71+
72+
# We should have got the properties attribute now tokenized with localhost and 41001. Exclude 1 add the rest
73+
for i in range (1,n+1):
74+
if i <> int(excludedServerNumber):
75+
processString = re.sub ( r'localhost',prefix + str(i), processString,1)
76+
processString = re.sub ( r'41001',str(port), processString,1)
77+
processString = re.sub ( r'localhost',prefix + str(i), processString,1)
78+
processString = re.sub ( r'41001',str(port), processString,1)
79+
80+
element.setAttribute("properties", processString)
81+
print(processString)
82+
ghi = doc.getElementsByTagName("cacheManagerPeerListenerFactory")
83+
for element in ghi:
84+
processString = element.getAttribute("properties")
85+
processString = "hostName=" + prefix + str(excludedServerNumber) + ",port=" + str(port) + ",remoteObjectPort=" + str(int(port)+1) + ",socketTimeoutMillis=12000"
86+
element.setAttribute("properties", processString)
87+
myfile = open(domainHome + "/config/fmwconfig/servers/" + ms_server + "/config/ticket-cache.xml", "w")
88+
myfile.write(doc.toxml())
89+
myfile.close()
90+
print("Updated " + "ticket-cache.xml")
91+
92+
def main():
93+
# count the arguments
94+
arguments = len(sys.argv) - 1
95+
print ("The script is called with %i arguments" % (arguments))
96+
domainHome = sys.argv[1]
97+
serverPrefix = sys.argv[2]
98+
ms_server = sys.argv[3]
99+
port = sys.argv[4]
100+
excludedServerNumber = ms_server[-1]
101+
print("Host prefix set to " + serverPrefix)
102+
print("Managed Server set to - " + ms_server)
103+
print("Excluded Server Number set to - " + excludedServerNumber)
104+
print("Starting port set to - " + port)
105+
replaceXml(domainHome, ms_server)
106+
servercount = getManagedServerCount(domainHome)
107+
replaceRmiUrls(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, port)
108+
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "linked-cache.xml", int(port) + 2)
109+
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "cs-cache.xml", int(port) + 4)
110+
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "cas-cache.xml", int(port) + 6 )
111+
replaceRmiUrlsInCache(domainHome, serverPrefix, servercount, ms_server, excludedServerNumber, "ss-cache.xml", int(port) + 8 )
112+
113+
114+
if __name__ == "__main__":
115+
# calling main function
116+
main()
117+
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# Copyright 2020, Oracle Corporation and/or its affiliates.
2-
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3-
4-
# Default values for ingress-per-domain.
5-
# This is a YAML-formatted file.
6-
# Declare variables to be passed into your templates.
7-
8-
# Load balancer type. Supported values are: TRAEFIK, VOYAGER
9-
type: TRAEFIK
10-
#type: VOYAGER
11-
12-
# WLS domain as backend to the load balancer
13-
wlsDomain:
14-
domainUID: wcsitesinfra
15-
adminServerName: adminserver
16-
adminServerPort: 7001
17-
wcsitesClusterName: wcsites_cluster
18-
wcsitesManagedServerPort: 8001
19-
20-
# Voyager specific values
21-
voyager:
22-
# web port
23-
webPort: 30305
24-
# stats port
25-
statsPort: 30317
1+
# Copyright 2020, Oracle Corporation and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
# Default values for ingress-per-domain.
5+
# This is a YAML-formatted file.
6+
# Declare variables to be passed into your templates.
7+
8+
# Load balancer type. Supported values are: TRAEFIK, VOYAGER
9+
type: TRAEFIK
10+
#type: VOYAGER
11+
12+
# WLS domain as backend to the load balancer
13+
wlsDomain:
14+
domainUID: wcsitesinfra
15+
adminServerName: adminserver
16+
adminServerPort: 7001
17+
wcsitesClusterName: wcsites_cluster
18+
wcsitesManagedServerPort: 8001
19+
20+
# Voyager specific values
21+
voyager:
22+
# web port
23+
webPort: 30305
24+
# stats port
25+
statsPort: 30317

OracleWebCenterSites/kubernetes/2.4.0/create-wcsites-domain/utils/create-wcsites-pv-pvc-inputs.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ namespace: wcsites-ns
1818
# Persistent volume type for the persistent storage.
1919
# The value must be 'HOST_PATH' or 'NFS'.
2020
# If using 'NFS', weblogicDomainStorageNFSServer must be specified.
21-
weblogicDomainStorageType: HOST_PATH
21+
weblogicDomainStorageType: NFS
2222

2323
# The server name or ip address of the NFS server to use for the persistent storage.
2424
# The following line must be uncomment and customized if weblogicDomainStorateType is NFS:
25-
#weblogicDomainStorageNFSServer: nfsServer
25+
weblogicDomainStorageNFSServer: %NFS_SERVER%
2626

2727
# Physical path of the persistent storage.
2828
# When weblogicDomainStorageType is set to HOST_PATH, this value should be set the to path to the
@@ -39,5 +39,4 @@ weblogicDomainStoragePath: /scratch/K8SVolume/WCSites
3939
weblogicDomainStorageReclaimPolicy: Retain
4040

4141
# Total storage allocated to the persistent storage.
42-
weblogicDomainStorageSize: 10Gi
43-
42+
weblogicDomainStorageSize: 10Gi

docs-source/content/wcsites-domains/create-wcsites-domains/_index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,10 @@ to create the domain home for other use cases. You can modify the generated doma
425425
426426
To start the domain, apply the above `domain.yaml`:
427427
428-
```bash
429-
$ kubectl apply -f kubernetes/samples/scripts/create-wcsites-domain/output/weblogic-domains/wcsitesinfra/domain.yaml
430-
domain.weblogic.oracle/wcsitesinfra created
431-
```
428+
```bash
429+
$ kubectl apply -f kubernetes/samples/scripts/create-wcsites-domain/output/weblogic-domains/wcsitesinfra/domain.yaml
430+
domain.weblogic.oracle/wcsitesinfra created
431+
```
432432

433433
#### Verify the WebCenter Sites Domain
434434
Verify that the domain and servers pods and services are created and in the READY state:

docs-source/content/wcsites-domains/manage-wcsites-domains/Elasticsearch-integration-with-WLS-Operator-and-WLS-server-logs.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,11 @@ elasticsearch ClusterIP 10.100.11.154 <none> 9200/TCP,9300/TCP 4m
149149
kibana NodePort 10.97.205.0 <none> 5601:31884/TCP 4m32s
150150
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 71d
151151
```
152-
You can access the Kibana dashboard at `http://mycompany.com:kibana-nodeport/`. In our example, the node port would be 31884.
152+
You can access the Kibana dashboard at `http://mycompany.com:kibana-nodeport/`. In our example, the node port would be 31884.
153+
154+
##### Create an Index Pattern in Kibana
155+
Create an index pattern `logstash*` in **Kibana > Management**. After the servers are started, you will see the log data in the Kibana dashboard:
156+
157+
![WLE-Kibana-Dashboard](images/logstash-kibana-1.png)
158+
159+
![WLE-Kibana-Dashboard](images/logstash-kibana-2.png)

docs-source/content/wcsites-domains/manage-wcsites-domains/Loadbalancer-Traefik-setup-for-WCSites-domain-setup-on-K8S.md

100644100755
File mode changed.

docs-source/content/wcsites-domains/manage-wcsites-domains/WebLogic-Monitoring-Exporter-Setup.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ RoleBinding is required for Prometheus to access the endpoints provided by the W
221221
subjects:
222222
- kind: ServiceAccount
223223
name: prometheus-k8s
224-
namespace: monitoring
224+
namespace: monitoring
225225
```
226226
Similarly, add the `Role` for the namespace under which the WebLogic Servers pods are running in the Kubernetes cluster. Edit `kube-prometheus/manifests/prometheus-roleSpecificNamespaces.yaml` in the Prometheus Operator deployment manifests and add the `Role` for the namespace (`wcsites-ns`) similar to the following example:
227227
```
@@ -254,6 +254,11 @@ To deploy the service monitor, use the above wls-exporter.yaml deployment YAML a
254254
```
255255
$ kubectl create -f kubernetes/samples/scripts/create-wcsites-domain/utils/weblogic-monitoring-exporter/wls-exporter.yaml
256256
```
257+
258+
#### Additional Setup For Voyager Load Balancer
259+
260+
In step 2 of [Configure Voyager to Manage Ingresses]({{< relref "/wcsites-domains/manage-wcsites-domains/loadbalancer-voyager-setup-for-wcsites-domain-setup-on-k8s#configure-voyager-to-manage-ingresses">}}), for wcsites-cluster, enable the last rule for path ‘wls-exporter’ and then re-deploy Voyager Load Balancer.
261+
257262
#### Enable Prometheus to Discover the Service
258263

259264
After the deployment of the service monitor, Prometheus should be able to discover wls-exporter and export metrics.
@@ -262,7 +267,6 @@ You can access the Prometheus dashboard at `http://mycompany.com:32101/`.
262267

263268
![Wme-Service-Discovery](images/wme-service-discovery.png)
264269

265-
266270
#### Deploy Grafana Dashboard
267271

268272
To view the domain metrics, deploy the Grafana dashboard provided in the [WebLogic Monitoring Exporter](https://github.com/oracle/weblogic-monitoring-exporter/tree/master/samples/kubernetes/end2end#monitoring-weblogic-server-with-the-grafana-dashboard).

docs-source/content/wcsites-domains/manage-wcsites-domains/_index.md

100644100755
File mode changed.
Loading

0 commit comments

Comments
 (0)