Skip to content

Commit 74e22f5

Browse files
committed
Issue #134 - Use properties file from mounted volume; use WLS quick sample image; use production start mode
1 parent 05944bb commit 74e22f5

File tree

6 files changed

+92
-19
lines changed

6 files changed

+92
-19
lines changed

samples/docker-domain/Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#
2424
# Pull base image
2525
# ---------------
26-
FROM store/oracle/weblogic:12.2.1.3
26+
# FROM store/oracle/weblogic:12.2.1.3
27+
FROM oracle/weblogic:12.2.1.3-developer
2728

2829
# Maintainer
2930
# ----------
@@ -56,7 +57,11 @@ COPY container-scripts/* /u01/oracle/
5657
COPY weblogic-deploy.zip /u01
5758
COPY ${WDT_MODEL} ${ARCHIVE_FILE} /u01/
5859

59-
#Create directory where domain will be written to
60+
# this file contains credentials.
61+
# be sure to build with --force-rm to eliminate this container layer
62+
COPY properties /u01/oracle
63+
64+
# Create directory where domain will be written to
6065
USER root
6166
RUN chmod +xw /u01/oracle/*.sh && \
6267
chmod +xw /u01/oracle/*.py && \
@@ -78,7 +83,8 @@ RUN chmod +xw /u01/oracle/*.sh && \
7883
-variable_file /u01/oracle/domain.properties \
7984
$MODEL_OPT \
8085
$ARCHIVE_OPT && \
81-
chown -R oracle:oracle $PRE_DOMAIN_HOME
86+
chown -R oracle:oracle $PRE_DOMAIN_HOME && \
87+
rm /u01/oracle/domain.properties
8288

8389
VOLUME $PRE_DOMAIN_HOME
8490
# Expose Node Manager default port, and also default for admin and managed server

samples/docker-domain/container-scripts/domain.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.

samples/docker-domain/container-scripts/startManagedServer.sh

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,48 @@
66
#
77
# Start the Domain.
88

9+
PROPERTIES_FILE=/u01/oracle/properties/domain.properties
10+
if [ ! -e "$PROPERTIES_FILE" ]; then
11+
echo "A properties file with variable definitions needs to be supplied."
12+
exit
13+
fi
14+
15+
DOMAIN_NAME=`awk '{print $1}' $PROPERTIES_FILE | grep ^DOMAIN_NAME= | cut -d "=" -f2`
16+
if [ -z "$DOMAIN_NAME" ]; then
17+
echo "The domain name is blank. The domain name must be set in the properties file."
18+
exit
19+
fi
20+
21+
USER=`awk '{print $1}' $PROPERTIES_FILE | grep ^username= | cut -d "=" -f2`
22+
if [ -z "$USER" ]; then
23+
echo "The admin username is blank. The admin username must be set in the properties file."
24+
exit
25+
fi
26+
27+
PASS=`awk '{print $1}' $PROPERTIES_FILE | grep ^password= | cut -d "=" -f2`
28+
if [ -z "$PASS" ]; then
29+
echo "The admin password is blank. The admin password must be set in the properties file."
30+
exit
31+
fi
32+
33+
ADMIN_HOST=`awk '{print $1}' $PROPERTIES_FILE | grep ^ADMIN_HOST= | cut -d "=" -f2`
34+
if [ -z "$ADMIN_HOST" ]; then
35+
echo "The admin host is blank. The admin host must be set in the properties file."
36+
exit
37+
fi
38+
39+
ADMIN_PORT=`awk '{print $1}' $PROPERTIES_FILE | grep ^ADMIN_PORT= | cut -d "=" -f2`
40+
if [ -z "$ADMIN_PORT" ]; then
41+
echo "The admin port is blank. The admin port must be set in the properties file."
42+
exit
43+
fi
44+
945
#Define DOMAIN_HOME
1046
export DOMAIN_HOME=/u01/oracle/user_projects/domains/$DOMAIN_NAME
1147

1248
mkdir -p $DOMAIN_HOME/servers/$MS_NAME/security
13-
echo username=$ADMIN_USER > $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties
14-
echo password=$ADMIN_PASSWORD >> $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties
49+
echo username=$USER > $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties
50+
echo password=$PASS >> $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties
1551

1652
# Start Managed Server and tail the logs
1753
${DOMAIN_HOME}/bin/startManagedWebLogic.sh $MS_NAME http://$ADMIN_HOST:$ADMIN_PORT

samples/docker-domain/container-scripts/startWLSDomain.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,37 @@
66
#
77
# Start the Domain.
88

9-
# determine the domain name. there is only one domain directory.
10-
export DOMAIN_NAME=`ls /u01/oracle/user_projects/domains | head -1`
9+
PROPERTIES_FILE=/u01/oracle/properties/domain.properties
10+
if [ ! -e "$PROPERTIES_FILE" ]; then
11+
echo "A properties file with the username and password needs to be supplied."
12+
exit
13+
fi
14+
15+
DOMAIN_NAME=`awk '{print $1}' $PROPERTIES_FILE | grep ^DOMAIN_NAME= | cut -d "=" -f2`
16+
if [ -z "$DOMAIN_NAME" ]; then
17+
echo "The domain name is blank. The domain name must be set in the properties file."
18+
exit
19+
fi
20+
21+
USER=`awk '{print $1}' $PROPERTIES_FILE | grep ^username= | cut -d "=" -f2`
22+
if [ -z "$USER" ]; then
23+
echo "The domain username is blank. The Admin username must be set in the properties file."
24+
exit
25+
fi
26+
27+
PASS=`awk '{print $1}' $PROPERTIES_FILE | grep ^password= | cut -d "=" -f2`
28+
if [ -z "$PASS" ]; then
29+
echo "The domain password is blank. The Admin password must be set in the properties file."
30+
exit
31+
fi
1132

1233
#Define DOMAIN_HOME
1334
export DOMAIN_HOME=/u01/oracle/user_projects/domains/$DOMAIN_NAME
1435

36+
mkdir -p ${DOMAIN_HOME}/servers/AdminServer/security/
37+
echo "username=${USER}" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties
38+
echo "password=${PASS}" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties
39+
1540
# Start Admin Server and tail the logs
1641
${DOMAIN_HOME}/startWebLogic.sh
1742
touch ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# These variables are used for substitution in the WDT model file.
2+
# The username and password variables are also used as admin credentials for server startup.
3+
username=weblogic
4+
password=welcome1
5+
DOMAIN_NAME=my_domain
6+
DB_USER=dba
7+
DB_PASSWORD=dba1
8+
NM_USER=weblogic
9+
NM_PASSWORD=welcome1
10+
ADMIN_PORT=7001
11+
ADMIN_HOST=wlsadmin

samples/docker-domain/simple-topology.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
domainInfo:
2-
AdminUserName: '@@PROP:ADMIN_USER@@'
3-
AdminPassword: welcome1
4-
ServerStartMode: dev
2+
AdminUserName: '@@PROP:username@@'
3+
AdminPassword: '@@PROP:password@@'
4+
ServerStartMode: prod
55
topology:
66
Name: '@@PROP:DOMAIN_NAME@@'
77
AdminServerName: AdminServer
@@ -12,7 +12,6 @@ topology:
1212
DynamicServers:
1313
ServerTemplate: template1
1414
CalculatedListenPorts: false
15-
MaximumDynamicServerCount: 2
1615
ServerNamePrefix: 'ms-'
1716
DynamicClusterSize: 2
1817
MaxDynamicClusterSize: 8
@@ -32,8 +31,8 @@ topology:
3231
ListenPort: 5556
3332
Notes: The only node manager
3433
SecurityConfiguration:
35-
NodeManagerUsername: weblogic
36-
NodeManagerPasswordEncrypted: welcome1
34+
NodeManagerUsername: '@@PROP:NM_USER@@'
35+
NodeManagerPasswordEncrypted: '@@PROP:NM_PASSWORD@@'
3736
JMX:
3837
InvocationTimeoutSeconds: 40
3938
Notes: JMX notes
@@ -52,10 +51,10 @@ resources:
5251
JDBCDriverParams:
5352
DriverName: oracle.jdbc.xa.client.OracleXADataSource
5453
URL: 'jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=slc05til.us.oracle.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl.us.oracle.com)))'
55-
PasswordEncrypted: welcome1
54+
PasswordEncrypted: '@@PROP:DB_PASSWORD@@'
5655
Properties:
5756
user:
58-
Value: jshum
57+
Value: '@@PROP:DB_USER@@'
5958
oracle.net.CONNECT_TIMEOUT:
6059
Value: 5000
6160
oracle.jdbc.ReadTimeout:

0 commit comments

Comments
 (0)