안녕하세요.
'수상한 김토끼' 입니다.
Oracle의 WebLogic Image Tool을 활용하여 WebLogic Docker Image 만들기 응용 2번째입니다.
이 블로그 글은 미들웨어 경험이 없으신 분들도 쉽게 따라 하실 수 있도록 쉽게 작성하는 것이 목표입니다.
설명을 보고 진행하시다가 궁금하신 내용은 댓글로 문의하시면 가능한 범위 내에서 알려 드리도록 하겠습니다.
1. 기존 WebLogic Domain Artifact 백업 생성
앞서 2장 응용 1번째에서 WebLogic Image Tool의 공식 홈페이지에 나와 있는 quick start와 같이 12c버전의 WebLogic이 아닌 14c버전을 docker image로 만들어 보았습니다.
이번에는 응용 2번째로 기존 WebLogic Domain Artifact를 백업하여 기존 Domain을 포함하는 14c 버전 docker image를 만들어 보도록 하겠습니다.
이번 장에서는 데모 웹 응용 프로그램 1개(데이터 소스도 포함될 수 있음)가 실행 중인 기존 WebLogic Domain Artifact를 백업하는 과정을 진행할 예정입니다.
최종적으로는 OCI(Oracle Cloud)의 OCIR(Container Registry)에 저장하여 OKE에 배포하는 것을 목표로 합니다.
WebLogic Domain Artifact 백업을 위해서는 'WebLogic Deploy Tooling'을 사용하며, WDT(WebLogic Deploy Tooling)는 일상적인 도메인 생성 및 애플리케이션 배포 작업을 위해 복잡한 WLST 스크립트를 작성할 필요가 없도록 도와주는 도구입니다.
https://oracle.github.io/weblogic-deploy-tooling/
우선 WDT를 다운로드하여 WebLogic이 설치된 서버에 업로드를 해 줍니다.
https://github.com/oracle/weblogic-deploy-tooling/releases
본 예제에서는 최신버전인 2.4.2를 사용하겠습니다.
다운로드한 파일을 서버에 업로드 후 압축을 풀어줍니다.
1
2
3
4
5
|
[weblogic@coherence downloads]$ ls -al
total 3278612
drwxrwxr-x. 3 weblogic weblogic 4096 Jan 3 21:51 .
drwx------. 11 weblogic weblogic 4096 Jan 5 10:31 ..
-rw-rw-r--. 1 weblogic weblogic 1492478 Nov 11 06:03 weblogic-deploy.zip
|
cs |
압축을 푼 디렉터리의 bin 디렉터리로 이동하여 discoverDomain.sh 명령을 실행하여 Artifact를 생성해 줍니다.
discoverDomain.sh는 다음과 같이 사용합니다.
./discoverDomain.sh -oracle_home /home/weblogic/weblogic14c/ -domain_home /home/weblogic/weblogic14c/domains/kami_domain/ -archive_file wls-k8s-domain.zip -model_file wls-k8s-domain.yaml
Key | Value | Note |
oracle_home | /home/weblogic/weblogic14c/ | oracle 미들웨어가 설치된 경로 위치 |
domain_home | /home/weblogic/weblogic14c/domains/kami_domain/ | 기존 WebLogic 도메인이 설치된 경로 위치 |
archive_file | wls-k8s-domain.zip | 대상 도메인에 바이너리 및 기타 파일 리소스를 배포하기 위한 zip파일 아카이브 |
model_file | wls-k8s-domain.yaml | 도메인 및 애플리케이션을 설명하는 yaml 파일 |
discoverDomain.sh 파일 실행결과는 다음과 같습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
[weblogic@coherence bin]$ pwd
/home/weblogic/downloads/tmp/weblogic-deploy/bin
[weblogic@coherence bin]$ ls -al
total 196
drwxrwxr-x. 2 weblogic weblogic 4096 Jan 3 20:12 .
drwxrwxr-x. 7 weblogic weblogic 104 Jan 3 20:12 ..
-rw-r-----. 1 weblogic weblogic 3142 Nov 11 05:59 compareModel.cmd
-rwxr-x---. 1 weblogic weblogic 2355 Nov 11 05:59 compareModel.sh
-rw-r-----. 1 weblogic weblogic 8113 Nov 11 05:59 createDomain.cmd
-rwxr-x---. 1 weblogic weblogic 7509 Nov 11 05:59 createDomain.sh
-rw-r-----. 1 weblogic weblogic 6933 Nov 11 05:59 deployApps.cmd
-rwxr-x---. 1 weblogic weblogic 6438 Nov 11 05:59 deployApps.sh
-rw-r-----. 1 weblogic weblogic 6001 Nov 11 05:59 discoverDomain.cmd
-rwxr-x---. 1 weblogic weblogic 5502 Nov 11 05:59 discoverDomain.sh
-rw-r-----. 1 weblogic weblogic 4498 Nov 11 05:59 encryptModel.cmd
-rwxr-x---. 1 weblogic weblogic 3764 Nov 11 05:59 encryptModel.sh
-rw-r-----. 1 weblogic weblogic 5136 Nov 11 05:59 extractDomainResource.cmd
-rwxr-x---. 1 weblogic weblogic 4452 Nov 11 05:59 extractDomainResource.sh
-rw-r-----. 1 weblogic weblogic 4845 Nov 11 05:59 injectVariables.cmd
-rwxr-x---. 1 weblogic weblogic 4609 Nov 11 05:59 injectVariables.sh
-rw-r-----. 1 weblogic weblogic 4216 Nov 11 05:59 modelHelp.cmd
-rwxr-x---. 1 weblogic weblogic 3526 Nov 11 05:59 modelHelp.sh
-rw-r-----. 1 weblogic weblogic 3098 Nov 11 05:59 prepareModel.cmd
-rwxr-x---. 1 weblogic weblogic 2296 Nov 11 05:59 prepareModel.sh
-rw-r-----. 1 weblogic weblogic 13591 Nov 11 05:59 shared.cmd
-rwxr-x---. 1 weblogic weblogic 13142 Nov 11 05:59 shared.sh
-rw-r-----. 1 weblogic weblogic 6944 Nov 11 05:59 updateDomain.cmd
-rwxr-x---. 1 weblogic weblogic 6480 Nov 11 05:59 updateDomain.sh
-rw-r-----. 1 weblogic weblogic 6252 Nov 11 05:59 validateModel.cmd
-rwxr-x---. 1 weblogic weblogic 4970 Nov 11 05:59 validateModel.sh
[weblogic@coherence bin]$ ./discoverDomain.sh -oracle_home /home/weblogic/weblogic14c/ -domain_home /home/weblogic/weblogic14c/domains/kami_domain/ -archive_file wls-k8s-domain.zip -model_file wls-k8s-domain.yaml
JDK version is 1.8.0_321-b07
JAVA_HOME = /home/weblogic/jdk1.8.0_321
WLST_EXT_CLASSPATH = /home/weblogic/downloads/tmp/weblogic-deploy/lib/weblogic-deploy-core.jar
CLASSPATH = /home/weblogic/downloads/tmp/weblogic-deploy/lib/weblogic-deploy-core.jar
WLST_PROPERTIES = -Dcom.oracle.cie.script.throwException=true -Djava.util.logging.config.class=oracle.weblogic.deploy.logging.WLSDeployLoggingConfig
/home/weblogic/weblogic14c//oracle_common/common/bin/wlst.sh /home/weblogic/downloads/tmp/weblogic-deploy/lib/python/discover.py -oracle_home /home/weblogic/weblogic14c/ -domain_home /home/weblogic/weblogic14c/domains/kami_domain/ -archive_file wls-k8s-domain.zip -model_file wls-k8s-domain.yaml
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
####<Jan 5, 2023 11:23:43 AM> <INFO> <WebLogicDeployToolingVersion> <logVersionInfo> <WLSDPLY-01750> <The WebLogic Deploy Tooling discoverDomain version is 2.4.2:.53376e2:Nov 10, 2022 20:59 UTC>
####<Jan 5, 2023 11:23:43 AM> <INFO> <WLSDeployLoggingConfig> <logLoggingDirectory> <WLSDPLY-01755> <The discoverDomain program will write its log to directory /home/weblogic/downloads/tmp/weblogic-deploy/logs>
####<Jan 5, 2023 11:23:43 AM> <INFO> <ModelContext> <__copy_from_args> <WLSDPLY-01050> <WebLogic version for aliases is 14.1.1.0.0>
####<Jan 5, 2023 11:23:43 AM> <INFO> <ModelContext> <__copy_from_args> <WLSDPLY-01050> <WebLogic version for aliases is 14.1.1.0.0>
####<Jan 5, 2023 11:23:43 AM> <INFO> <discover> <main> <WLSDPLY-06024> <No variable file provided. Model passwords will contain the token '-- FIX ME --'>
####<Jan 5, 2023 11:23:47 AM> <INFO> <discover> <_get_domain_name> <WLSDPLY-06022> <Discover domain kami_domain>
####<Jan 5, 2023 11:23:47 AM> <INFO> <TopologyDiscoverer> <discover> <WLSDPLY-06600> <Discovering domain model topology>
####<Jan 5, 2023 11:23:48 AM> <INFO> <TopologyDiscoverer> <_get_nm_properties> <WLSDPLY-06627> <Discovering NM Properties>
####<Jan 5, 2023 11:23:48 AM> <INFO> <TopologyDiscoverer> <get_clusters> <WLSDPLY-06601> <Discovering 1 clusters>
####<Jan 5, 2023 11:23:48 AM> <INFO> <TopologyDiscoverer> <get_clusters> <WLSDPLY-06602> <Adding Cluster Cluster-0>
####<Jan 5, 2023 11:23:48 AM> <INFO> <Discoverer> <_get_attribute_value_with_get> <WLSDPLY-06127> <Unable to discover WLST attribute CorsAllowedOrigin at location /Cluster/Cluster-0/DynamicServers/NO_NAME_0 : get(CorsAllowedOrigin) in offline mode failed: Method [[getCorsAllowedOrigin, isCorsAllowedOrigin]] not found>
####<Jan 5, 2023 11:23:49 AM> <INFO> <TopologyDiscoverer> <get_servers> <WLSDPLY-06603> <Discovering 3 servers>
####<Jan 5, 2023 11:23:49 AM> <INFO> <TopologyDiscoverer> <get_servers> <WLSDPLY-06604> <Adding Server AdminServer>
####<Jan 5, 2023 11:23:49 AM> <INFO> <TopologyDiscoverer> <get_servers> <WLSDPLY-06604> <Adding Server Server-1>
####<Jan 5, 2023 11:23:50 AM> <INFO> <Discoverer> <_add_to_dictionary> <WLSDPLY-06106> <Unable to add ExcludedCiphersuite from location /Server/Server-1/SSL/NO_NAME_0 to the model : Failed to convert the wlst attribute name and value for the model at location (model_folders = ['Server', 'SSL'], 'name_tokens' = {'DOMAIN': 'kami_domain','SSL': 'NO_NAME_0','SERVER': 'Server-1'}) : The wlst attribute ExcludedCiphersuite is not defined for the model folder /Server/SSL>
####<Jan 5, 2023 11:23:50 AM> <INFO> <TopologyDiscoverer> <get_servers> <WLSDPLY-06604> <Adding Server Server-2>
####<Jan 5, 2023 11:23:50 AM> <INFO> <Discoverer> <_add_to_dictionary> <WLSDPLY-06106> <Unable to add ExcludedCiphersuite from location /Server/Server-2/SSL/NO_NAME_0 to the model : Failed to convert the wlst attribute name and value for the model at location (model_folders = ['Server', 'SSL'], 'name_tokens' = {'DOMAIN': 'kami_domain','SSL': 'NO_NAME_0','SERVER': 'Server-2'}) : The wlst attribute ExcludedCiphersuite is not defined for the model folder /Server/SSL>
####<Jan 5, 2023 11:23:51 AM> <INFO> <TopologyDiscoverer> <get_machines> <WLSDPLY-06611> <Discovering 1 machines>
####<Jan 5, 2023 11:23:51 AM> <INFO> <TopologyDiscoverer> <get_machines> <WLSDPLY-06612> <Adding Machine Machine-coherence>
####<Jan 5, 2023 11:23:51 AM> <INFO> <TopologyDiscoverer> <discover_security_configuration> <WLSDPLY-06622> <Adding Security Configuration>
####<Jan 5, 2023 11:23:51 AM> <INFO> <Discoverer> <_add_to_dictionary> <WLSDPLY-06106> <Unable to add IdentityAssertionCacheTtl from location /SecurityConfiguration/kami_domain/Realm/myrealm to the model : Failed to convert the wlst attribute name and value for the model at location (model_folders = ['SecurityConfiguration', 'Realm'], 'name_tokens' = {'DOMAIN': 'kami_domain','REALM': 'myrealm','SECURITYCONFIGURATION': 'kami_domain'}) : The wlst attribute IdentityAssertionCacheTtl is not defined for the model folder /SecurityConfiguration/Realm>
####<Jan 5, 2023 11:23:52 AM> <INFO> <TopologyDiscoverer> <get_embedded_ldap_configuration> <WLSDPLY-06639> <Skipping Embedded LDAP Server Configuration>
####<Jan 5, 2023 11:23:52 AM> <INFO> <ResourcesDiscoverer> <discover> <WLSDPLY-06300> <Discovering domain model resources>
####<Jan 5, 2023 11:23:52 AM> <INFO> <DeploymentsDiscoverer> <discover> <WLSDPLY-06380> <Discovering domain model deployments>
####<Jan 5, 2023 11:23:52 AM> <INFO> <DeploymentsDiscoverer> <get_applications> <WLSDPLY-06391> <Discovering 1 Applications>
####<Jan 5, 2023 11:23:52 AM> <INFO> <DeploymentsDiscoverer> <get_applications> <WLSDPLY-06392> <Adding Application testApp>
####<Jan 5, 2023 11:23:53 AM> <INFO> <DeploymentsDiscoverer> <add_application_to_archive> <WLSDPLY-06394> <Add application testApp binary /home/weblogic/webapps/testApp to archive>
####<Jan 5, 2023 11:23:53 AM> <INFO> <MultiTenantDiscoverer> <discover> <WLSDPLY-06700> <Discover Multi-tenant>
####<Jan 5, 2023 11:23:53 AM> <INFO> <MultiTenantTopologyDiscoverer> <discover> <WLSDPLY-06709> <Discover Multi-tenant Topology>
####<Jan 5, 2023 11:23:53 AM> <INFO> <MultiTenantResourcesDiscoverer> <discover> <WLSDPLY-06707> <Discover Multi-tenant Resources>
####<Jan 5, 2023 11:23:53 AM> <INFO> <filter_helper> <apply_filters> <WLSDPLY-20017> <No filter configuration file /home/weblogic/downloads/tmp/weblogic-deploy/lib/model_filters.json>
####<Jan 5, 2023 11:23:53 AM> <INFO> <filter_helper> <apply_filters> <WLSDPLY-20016> <No filters of type discover found in filter configuration file /home/weblogic/downloads/tmp/weblogic-deploy/lib/model_filters.json>
####<Jan 5, 2023 11:23:53 AM> <INFO> <variable_injector> <inject_variables_keyword_file> <WLSDPLY-19519> <No variables were inserted into the model during variable replacement>
Issue Log for discoverDomain version 2.4.2 running WebLogic version 14.1.1.0.0 offline mode:
Total: WARNING : 0 SEVERE : 0
discoverDomain.sh completed successfully (exit code = 0)
|
cs |
정상적으로 수행이 완료되면 위와 같이 표시되며 Artifact가 백업되어 yaml파일과 zip파일이 생성됩니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
[weblogic@coherence bin]$ ls -al
total 196
drwxrwxr-x. 2 weblogic weblogic 4096 Jan 5 11:23 .
drwxrwxr-x. 7 weblogic weblogic 104 Jan 3 20:12 ..
-rw-r-----. 1 weblogic weblogic 3142 Nov 11 05:59 compareModel.cmd
-rwxr-x---. 1 weblogic weblogic 2355 Nov 11 05:59 compareModel.sh
-rw-r-----. 1 weblogic weblogic 8113 Nov 11 05:59 createDomain.cmd
-rwxr-x---. 1 weblogic weblogic 7509 Nov 11 05:59 createDomain.sh
-rw-r-----. 1 weblogic weblogic 6933 Nov 11 05:59 deployApps.cmd
-rwxr-x---. 1 weblogic weblogic 6438 Nov 11 05:59 deployApps.sh
-rw-r-----. 1 weblogic weblogic 6001 Nov 11 05:59 discoverDomain.cmd
-rwxr-x---. 1 weblogic weblogic 5502 Nov 11 05:59 discoverDomain.sh
-rw-r-----. 1 weblogic weblogic 4498 Nov 11 05:59 encryptModel.cmd
-rwxr-x---. 1 weblogic weblogic 3764 Nov 11 05:59 encryptModel.sh
-rw-r-----. 1 weblogic weblogic 5136 Nov 11 05:59 extractDomainResource.cmd
-rwxr-x---. 1 weblogic weblogic 4452 Nov 11 05:59 extractDomainResource.sh
-rw-r-----. 1 weblogic weblogic 4845 Nov 11 05:59 injectVariables.cmd
-rwxr-x---. 1 weblogic weblogic 4609 Nov 11 05:59 injectVariables.sh
-rw-r-----. 1 weblogic weblogic 4216 Nov 11 05:59 modelHelp.cmd
-rwxr-x---. 1 weblogic weblogic 3526 Nov 11 05:59 modelHelp.sh
-rw-r-----. 1 weblogic weblogic 3098 Nov 11 05:59 prepareModel.cmd
-rwxr-x---. 1 weblogic weblogic 2296 Nov 11 05:59 prepareModel.sh
-rw-r-----. 1 weblogic weblogic 13591 Nov 11 05:59 shared.cmd
-rwxr-x---. 1 weblogic weblogic 13142 Nov 11 05:59 shared.sh
-rw-r-----. 1 weblogic weblogic 6944 Nov 11 05:59 updateDomain.cmd
-rwxr-x---. 1 weblogic weblogic 6480 Nov 11 05:59 updateDomain.sh
-rw-r-----. 1 weblogic weblogic 6252 Nov 11 05:59 validateModel.cmd
-rwxr-x---. 1 weblogic weblogic 4970 Nov 11 05:59 validateModel.sh
-rw-r-----. 1 weblogic weblogic 1833 Jan 5 11:23 wls-k8s-domain.yaml
-rw-r-----. 1 weblogic weblogic 4028 Jan 5 11:23 wls-k8s-domain.zip
|
cs |
WebLogic Domain Artifact 백업이 완료되었습니다.
2. Artifact yaml 파일 수정
Domain Artifact 백업이 완료되어 생성된 yaml 파일과 zip 파일의 일부 항목에 대한 수정이 필요합니다.
우선 생성된 yaml 파일(wls-k8s-domain.yaml)을 확인해 보면 다음과 같습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
[weblogic@coherence bin]$ cat wls-k8s-domain.yaml
domainInfo:
AdminUserName: --FIX ME--
AdminPassword: --FIX ME--
topology:
Name: kami_domain
DomainVersion: 14.1.1.0.0
NMProperties:
PropertiesVersion: 14.1.1.0.0
JavaHome: /home/weblogic/jdk1.8.0_321
weblogic.StartScriptName: startWebLogic.sh
SecureListener: false
Cluster:
Cluster-0:
HealthCheckPeriodsUntilFencing: 6
Server:
AdminServer: {}
Server-1:
Machine: Machine-coherence
ListenPort: 8001
ServerDiagnosticConfig:
WldfDiagnosticVolume: Low
WebServer:
WebServerLog:
NumberOfFilesLimited: false
Server-2:
Machine: Machine-coherence
ListenPort: 8002
ServerDiagnosticConfig:
WldfDiagnosticVolume: Low
WebServer:
WebServerLog:
NumberOfFilesLimited: false
Machine:
Machine-coherence:
NodeManager:
NMType: Plain
SecurityConfiguration:
NodeManagerPasswordEncrypted: --FIX ME--
Realm:
myrealm:
CertPathBuilder: WebLogicCertPathProvider
AuthenticationProvider:
DefaultAuthenticator:
DefaultAuthenticator: {}
DefaultIdentityAsserter:
DefaultIdentityAsserter:
ActiveType:
- AuthenticatedUser
- weblogic-jwt-token
appDeployments:
Application:
testApp:
SourcePath: wlsdeploy/applications/testApp/
ModuleType: war
Target: Server-1,Server-2
SecurityDDModel: DDOnly
StagingMode: nostage
|
cs |
이 yaml 파일에서 '--FIX ME--'의 값을 올바른 값으로 변경하여 저장하는 과정이 필요합니다.
Key | Value | Note |
AdminUserName | weblogic | WebLogic 관리자 사용자 |
AdminPassword | weblogic! | WebLogic 관리자 암호 |
NodeManagerPasswordEncrypted | 이 항목 제거 | 삭제 (불필요) |
CredentialEncrypted | 이 항목 제거 | 삭제 (불필요) |
PasswordEncrypted | weblogic! | 데이터 소스 사용자 비밀번호 |
본 예제에 사용된 데모 애플리케이션에서는 데이터 소스가 없어 'PasswordEncrypted'항목은 없습니다만 사용하시는 환경에 맞게 변경해 주시면 됩니다.
변경이 완료된 파일은 다음과 같습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
[weblogic@coherence tmp]$ cat wls-k8s-domain.yaml
domainInfo:
AdminUserName: 'weblogic'
AdminPassword: 'weblogic!'
topology:
Name: kami_domain
DomainVersion: 14.1.1.0.0
NMProperties:
PropertiesVersion: 14.1.1.0.0
JavaHome: /home/weblogic/jdk1.8.0_321
weblogic.StartScriptName: startWebLogic.sh
SecureListener: false
Cluster:
Cluster-0:
HealthCheckPeriodsUntilFencing: 6
Server:
AdminServer: {}
Server-1:
Machine: Machine-coherence
ListenPort: 8001
ServerDiagnosticConfig:
WldfDiagnosticVolume: Low
WebServer:
WebServerLog:
NumberOfFilesLimited: false
Server-2:
Machine: Machine-coherence
ListenPort: 8002
ServerDiagnosticConfig:
WldfDiagnosticVolume: Low
WebServer:
WebServerLog:
NumberOfFilesLimited: false
Machine:
Machine-coherence:
NodeManager:
NMType: Plain
SecurityConfiguration:
Realm:
myrealm:
CertPathBuilder: WebLogicCertPathProvider
AuthenticationProvider:
DefaultAuthenticator:
DefaultAuthenticator: {}
DefaultIdentityAsserter:
DefaultIdentityAsserter:
ActiveType:
- AuthenticatedUser
- weblogic-jwt-token
appDeployments:
Application:
testApp:
SourcePath: wlsdeploy/applications/testApp/
ModuleType: war
Target: Server-1,Server-2
SecurityDDModel: DDOnly
StagingMode: nostage
|
cs |
여기까지 WebLogic Domain Artifact 백업이 완료되었습니다.
이번장은 여기서 마무리하고 다음장에서 Artifact 기반 docker 이미지 생성과 관련된 내용을 알아보도록 하겠습니다.