Oracle Fusion Middleware/WebLogic Image Tool

3장. WebLogic Image Tool을 활용한 WebLogic Docker Image로 운영환경 구성하기 - Admin_Server 구성

수상한 김토끼 2022. 8. 8. 14:48

안녕하세요.

'수상한 김토끼' 입니다.

 

Oracle의 WebLogic Image Tool을 활용하여 WebLogic Docker Image를 만들고 운영환경 구성하기입니다.

 

이 블로그 글은 미들웨어 경험이 없으신 분들도 쉽게 따라 하실 수 있도록 쉽게 작성하는 것이 목표입니다.

설명을 보고 진행하시다가 궁금하신 내용은 댓글로 문의하시면 가능한 범위 내에서 알려 드리도록 하겠습니다.


1. WebLogic Docker Container 실행

앞장에서 WebLogic Image Tool을 활용해 WebLogic의 docker image를 생성하였습니다.

이번에는 생성된 docker image를 사용하여 운영환경을 구성해 보도록 하겠습니다.

 

우선 사용하고자 하는 docker image를 확인합니다.

1
2
3
4
5
6
[root@middleware-works-centos8 wls14c]# docker image ls
REPOSITORY                   TAG               IMAGE ID       CREATED       SIZE
wls                          14.1.1.0.0-slim   b107ac6eb4eb   6 days ago    1.02GB
wls                          14.1.1.0.0        033e6f70ff0f   6 days ago    1.39GB
wls                          12.2.1.3.0        d4374a78436c   6 days ago    1.36GB
ghcr.io/oracle/oraclelinux   8-slim            c7c0b3ae3077   4 weeks ago   101MB
cs

WebLogic 14c(14.1.1.0.0) 기본 이미지(Image Id: 033e6f70ff0f)로 컨테이너 구동 후 admin으로 사용하겠습니다.

 

Docker 명령을 자세히 다루지는 않겠습니다만, 관련 내용을 그대로 따라 하시면 구성이 가능합니다.

Docker 환경에서 사용되는 옵션은 다음과 같습니다.

1. domain_home: WebLogic domain home directory로 사용될 경로

2. properties: domain.properties 파일

3. 7001 port: admin port

 

우선 admin server로 사용할 컨테이너를 기동 합니다.

다음 옵션으로 실행해 줍니다.

docker container run --name wls_admin -d -p 7001:7001 -it -v $PWD/properties:/u01/oracle/properties -v $PWD/domains:/u01/oracle/domains 033e6f70ff0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@middleware-works-centos8 wls14c]# ls
docker_run_container.sh  domains  properties  wls_admin.sh  wls_managed.sh
 
[root@middleware-works-centos8 wls14c]# cat wls_admin.sh
#!/bin/bash
 
# 14c admin
docker container run --name wls_admin --7001:7001 -it -v $PWD/properties:/u01/oracle/properties -v $PWD/domains:/u01/oracle/domains 033e6f70ff0f
 
[root@middleware-works-centos8 wls14c]# ./wls_admin.sh
e4fdcdde81ee8feb9ab763c77c41ee8b42ac5411a7718237c986fc67bed2525f
 
[root@middleware-works-centos8 wls14c]# docker ps -a
CONTAINER ID   IMAGE          COMMAND       CREATED         STATUS         PORTS                    NAMES
e4fdcdde81ee   033e6f70ff0f   "/bin/bash"   3 seconds ago   Up 2 seconds   0.0.0.0:7001->7001/tcp   wls_admin
cs

docker ps 명령으로 정상적으로 컨테이너가 실행된 것이 확인됩니다.


2. WebLogic Admin 구성

실행된 컨테이너로 접속하여 WebLogic admin을 구성해 보겠습니다.

 

사실 여기서부터는 On-Prem환경과 다른 부분이 없습니다만 docker container로도 정상적으로 동작하는 것을 확인하기 위해 진행하도록 하겠습니다.

 

다음 명령으로 container에 접속합니다.

docker exec -it wls_admin /bin/bash
1
2
3
4
5
[root@middleware-works-centos8 wls14c]# docker ps -a
CONTAINER ID   IMAGE          COMMAND       CREATED          STATUS          PORTS                    NAMES
e4fdcdde81ee   033e6f70ff0f   "/bin/bash"   13 minutes ago   Up 13 minutes   0.0.0.0:7001->7001/tcp   wls_admin
[root@middleware-works-centos8 wls14c]# docker exec -it wls_admin /bin/bash
[oracle@e4fdcdde81ee oracle]$
cs

 

wlst.sh 파일을 통한 domain 구성을 위해 '/u01/oracle/wlserver/common/bin' 경로로 이동해 줍니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[oracle@e4fdcdde81ee oracle]$ pwd
/u01/oracle
[oracle@e4fdcdde81ee oracle]$ ls
OPatch  coherence  domains  inventory  oraInst.loc  oraInventory  oracle_common  oui  properties  root.sh  wlserver
[oracle@e4fdcdde81ee oracle]$ cd wlserver
[oracle@e4fdcdde81ee wlserver]$ ls
common  modules  orasocket  plugins  server
[oracle@e4fdcdde81ee wlserver]$ cd common
[oracle@e4fdcdde81ee common]$ ls
bin  deployable-libraries  derby  dpct  images  lifecycle  templates  wlst
[oracle@e4fdcdde81ee common]$ cd bin
[oracle@e4fdcdde81ee bin]$ ls
config.sh  pack.sh  unpack.sh  wlscontrol.sh  wlsifconfig.sh  wlst.sh
[oracle@e4fdcdde81ee bin]$ pwd
/u01/oracle/wlserver/common/bin
cs

 

wlst.sh 파일 실행 후 WebLogic admin 서버 설정을 진행합니다.

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
[oracle@e4fdcdde81ee bin]$ pwd
/u01/oracle/wlserver/common/bin
[oracle@e4fdcdde81ee bin]$ ./wlst.sh
WARNING: This is a deprecated script. Please invoke the wlst.sh script under oracle_common/common/bin.
 
Initializing WebLogic Scripting Tool (WLST) ...
 
Welcome to WebLogic Server Administration Scripting Shell
 
Type help() for help on available commands
 
wls:/offline> selectTemplate('Basic WebLogic Server Domain')
wls:/offline/>loadTemplates()
wls:/offline/base_domain>cd ('Security/base_domain/User/weblogic')
wls:/offline/base_domain/Security/base_domain/User/weblogic>set ('Name''weblogic')
wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('weblogic!')
wls:/offline/base_domain/Security/base_domain/User/weblogic>cd('/')
wls:/offline/base_domain>set('ProductionModeEnabled''true')
wls:/offline/base_domain>cd('Servers/AdminServer')
wls:/offline/base_domain/Server/AdminServer>set('Name''admin_server')
wls:/offline/base_domain/Server/admin_server>set('ListenPort'7001)
wls:/offline/base_domain/Server/admin_server>set('ListenAddress''All Local Addresses')
wls:/offline/base_domain/Server/admin_server>cd('/')
wls:/offline/base_domain>writeDomain('/u01/oracle/domains/docker_domain')
wls:/offline/docker_domain>closeTemplate(), exit()
 
 
Exiting WebLogic Scripting Tool.
 
[oracle@e4fdcdde81ee bin]$ cd /u01/oracle/domains
[oracle@e4fdcdde81ee domains]$ ls
docker_domain
[oracle@e4fdcdde81ee domains]$ cd docker_domain
[oracle@e4fdcdde81ee docker_domain]$ ls
autodeploy  bin  common  config  console-ext  fileRealm.properties  init-info  lib  nodemanager  resources  security  servers  startWebLogic.sh
cs

 

Domain과 admin 서버 구성이 완료되었으니 서버 실행 후 접속해 보겠습니다.

서버 시작 로그입니다.

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
[oracle@e4fdcdde81ee docker_domain]$ pwd
/u01/oracle/domains/docker_domain
[oracle@e4fdcdde81ee docker_domain]$ ls
autodeploy  bin  common  config  console-ext  fileRealm.properties  init-info  lib  nodemanager  resources  security  servers  startWebLogic.sh
[oracle@e4fdcdde81ee docker_domain]$ ./startWebLogic.sh &
[1385
[oracle@e4fdcdde81ee docker_domain]$ .
.
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000
.
CLASSPATH=/u01/jdk/lib/tools.jar:/u01/oracle/wlserver/server/lib/weblogic.jar:/u01/oracle/wlserver/../oracle_common/modules/thirdparty/ant-contrib-1.0b3.jar:/u01/oracle/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/u01/oracle/wlserver/common/derby/lib/derbynet.jar:/u01/oracle/wlserver/common/derby/lib/derbyclient.jar:/u01/oracle/wlserver/common/derby/lib/derby.jar
.
PATH=/u01/oracle/domains/docker_domain/bin:/u01/oracle/wlserver/server/bin:/u01/oracle/wlserver/../oracle_common/modules/thirdparty/org.apache.ant/1.10.5.0.0/apache-ant-1.10.5/bin:/u01/jdk/jre/bin:/u01/jdk/bin:/home/oracle/.local/bin:/home/oracle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/u01/jdk/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http://hostname:port/console        *
***************************************************
Starting WLS with line:
/u01/jdk/bin/java -server   -Xms256m -Xmx512m -XX:CompileThreshold=8000 -cp /u01/oracle/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=admin_server -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy  -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader  -javaagent:/u01/oracle/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/u01/oracle/wlserver/server -Dweblogic.home=/u01/oracle/wlserver/server     -Djava.endorsed.dirs=/u01/jdk/jre/lib/endorsed:/u01/oracle/wlserver/../oracle_common/modules/endorsed:/u01/oracle/wlserver/modules/endorsed  weblogic.Server
<Aug 82022 5:34:09 AM UTC> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.>
<Aug 82022 5:34:10 AM UTC> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.>
<Aug 82022 5:34:10 AM UTC> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.202-b08 from Oracle Corporation.>
<Aug 82022 5:34:11 AM UTC> <Info> <Management> <BEA-141107> <Version: WebLogic Server 14.1.1.0.0  Thu Mar 26 03:15:09 GMT 2020 2000885>
<Aug 82022 5:34:12 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<Aug 82022 5:34:12 AM UTC> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.>
<Aug 82022 5:34:13,392 AM UTC> <Notice> <Log Management> <BEA-170019> <The server log file weblogic.logging.FileStreamHandler instance=348768606
Current log file=/u01/oracle/domains/docker_domain/servers/admin_server/logs/admin_server.log
Rotation dir=/u01/oracle/domains/docker_domain/servers/admin_server/logs
 is opened. All server side log events will be written to this file.>
<Aug 82022 5:34:13,718 AM UTC> <Notice> <Security> <BEA-090946> <Security pre-initializing using security realm: myrealm>
<Aug 82022 5:34:14,413 AM UTC> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm>
<Aug 82022 5:34:15,444 AM UTC> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm>
<Aug 82022 5:34:16,042 AM UTC> <Notice> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://172.17.0.2:7001/jndi/weblogic.management.mbeanservers.runtime.>
<Aug 82022 5:34:16,562 AM UTC> <Notice> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://172.17.0.2:7001/jndi/weblogic.management.mbeanservers.domainruntime.>
<Aug 82022 5:34:16,728 AM UTC> <Notice> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://172.17.0.2:7001/jndi/weblogic.management.mbeanservers.edit.>
<Aug 82022 5:34:17,809 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.>
<Aug 82022 5:34:17,810 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<Aug 82022 5:34:17,856 AM UTC> <Notice> <Log Management> <BEA-170036> <The Logging monitoring service timer has started to check for logged message counts every 30 seconds.>
<Aug 82022 5:34:18,239 AM UTC> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
<Aug 82022 5:34:18,505 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.>
<Aug 82022 5:34:18,569 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.>
<Aug 82022 5:34:18,660 AM UTC> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "admin_server" for domain "docker_domain" running in development mode.>
<Aug 82022 5:34:18,664 AM UTC> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 172.17.0.2:7001 for protocols iiop, t3, ldap, snmp, http.>
<Aug 82022 5:34:18,665 AM UTC> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<Aug 82022 5:34:18,665 AM UTC> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 172.17.0.2:7001 for protocols iiop, t3, ldap, snmp, http.>
<Aug 82022 5:34:18,665 AM UTC> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<Aug 82022 5:34:18,676 AM UTC> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
<Aug 82022 5:34:18,686 AM UTC> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
cs

 

Console에 접속 해 보겠습니다.

WebLogic 14c Console

 

Domain 구성시 사용한 name, password를 입력 후 로그인합니다.

WebLogic 14c Console Log-in

 

로그인에 성공하였습니다.

 

위와 같이 볼륨 마운트 방식으로 container를 구성하면 docker종료 후 재 실행 시에도 아무 문제없이 기존 domain구성을 활용할 수 있습니다.

 

여기까지 이번장을 마치고 다음 장에서는 managed server 구성에 대해 알아보도록 하겠습니다.