Skip to content

Commit c6ddf1a

Browse files
More alignment for operator
1 parent db28651 commit c6ddf1a

File tree

13 files changed

+227
-127
lines changed

13 files changed

+227
-127
lines changed

samples/docker-domain/Dockerfile

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,73 +48,81 @@ MAINTAINER Richard Killen <[email protected]>
4848
ARG WDT_ARCHIVE
4949
ARG WDT_VARIABLE
5050
ARG WDT_MODEL
51-
ARG ARG_ADMIN_HOST=wlsadmin
52-
ARG ARG_ADMIN_PORT=7001
53-
ARG ARG_MS_PORT=8001
54-
ARG ARG_DOMAIN_NAME=base_domain
55-
ARG ARG_DEBUG_PORT=8453
51+
ARG CUSTOM_ADMIN_NAME=admin-server
52+
ARG CUSTOM_ADMIN_HOST=wlsadmin
53+
ARG CUSTOM_ADMIN_PORT=7001
54+
ARG CUSTOM_MANAGED_SERVER_PORT=8001
55+
ARG CUSTOM_DOMAIN_NAME=base_domain
56+
ARG CUSTOM_DEBUG_PORT=8453
5657

57-
RUN echo DOMAIN_NAME=${DOMAIN_FOLDER_NAME}
5858
# Persist arguments - for ports to expose and container to use
5959
# Create a placeholder for the manager server name. This will be provided when run the container
60+
# Weblogic and Domain locations
61+
# Set the start derby in admin server flag to true. Override this in the runtime properties
62+
# The boot.properties will be created under the DOMAIN_HOME when the admin server container is run
63+
# WDT installation
6064
# ---------------------------
61-
ENV ADMIN_HOST=${ARG_ADMIN_HOST} \
62-
ADMIN_PORT=${ARG_ADMIN_PORT} \
63-
MS_NAME="" \
64-
MS_PORT=${ARG_MS_PORT} \
65-
DEBUG_PORT=${ARG_DEBUG_PORT} \
66-
DOMAIN_NAME=${ARG_DOMAIN_NAME} \
67-
ORACLE_HOME=/u01/oracle
65+
ENV ADMIN_NAME=${CUSTOM_ADMIN_NAME} \
66+
ADMIN_HOST=${CUSTOM_ADMIN_HOST} \
67+
ADMIN_PORT=${CUSTOM_ADMIN_PORT} \
68+
MANAGED_SERVER_NAME=${MANAGED_SERVER_NAME} \
69+
MANAGED_SERVER_PORT=${CUSTOM_MANAGED_SERVER_PORT} \
70+
DEBUG_PORT=${CUSTOM_DEBUG_PORT} \
71+
DERBY_FLAG="true" \
72+
ORACLE_HOME=/u01/oracle \
73+
DOMAIN_NAME=${CUSTOM_DOMAIN_NAME} \
74+
DOMAIN_PARENT=${ORACLE_HOME}/user_projects/domains
6875

69-
ENV DOMAIN_PARENT=$ORACLE_HOME/user_projects/domains
70-
71-
# WLS Configuration - oracle home and domain home
72-
# The boot.properties will be created under the DOMAIN_HOME when the AdminServer container is run
73-
# WDT install location and container scripts location
74-
# ---------------------------
75-
ENV DOMAIN_HOME=$DOMAIN_PARENT/${DOMAIN_NAME} \
76+
ENV DOMAIN_HOME=${DOMAIN_PARENT}/${DOMAIN_NAME} \
7677
PROPERTIES_FILE_DIR=$ORACLE_HOME/properties \
7778
WDT_HOME="/u01" \
7879
SCRIPT_HOME="${ORACLE_HOME}" \
79-
PATH=$PATH:${ORACLE_HOME}/oracle_common/common/bin:${ORACLE_HOME}/wlserver/common/bin:$DOMAIN_HOME/bin:${ORACLE_HOME}
80-
80+
PATH=$PATH:${ORACLE_HOME}/oracle_common/common/bin:${ORACLE_HOME}/wlserver/common/bin:${DOMAIN_HOME}:${DOMAIN_HOME}/bin:${ORACLE_HOME}
81+
8182
COPY weblogic-deploy.zip ${WDT_HOME}
8283
COPY container-scripts/* ${SCRIPT_HOME}/
8384

8485
# Create the properties file directory and the domain home parent with the correct permissions / owner.
8586
# Unzip and install the WDT image.
8687
# Export variable file values into the environment
8788
USER root
88-
RUN chmod +xw ${SCRIPT_HOME}/*.sh && \
89-
mkdir -p +xwr ${PROPERTIES_FILE_DIR} && \
89+
RUN chmod +xw $SCRIPT_HOME/*.sh && \
90+
chown -R oracle:oracle ${SCRIPT_HOME} && \
91+
mkdir -p +xwr $PROPERTIES_FILE_DIR && \
92+
chown -R oracle:oracle $PROPERTIES_FILE_DIR && \
9093
mkdir -p $DOMAIN_PARENT && \
94+
chown -R oracle:oracle $DOMAIN_PARENT && \
9195
chmod -R a+xwr $DOMAIN_PARENT && \
9296
cd ${WDT_HOME} && \
9397
$JAVA_HOME/bin/jar xf ./weblogic-deploy.zip && \
9498
rm weblogic-deploy.zip && \
9599
chmod +xw weblogic-deploy/bin/*.sh && \
96-
chmod -R +xw weblogic-deploy/lib/python
100+
chmod -R +xw weblogic-deploy/lib/python && \
101+
chown -R oracle:oracle weblogic-deploy
102+
103+
# Persist the WDT tool home location
104+
ENV WDT_HOME=$WDT_HOME/weblogic-deploy
97105

98106
# Copy the WDT model, archive file, variable file and credential secrets to the property file directory.
99107
# These files will be removed after the image is built.
100108
# Be sure to build with --force-rm to eliminate this container layer
101109

102-
COPY ${WDT_MODEL} ${WDT_ARCHIVE} ${WDT_VARIABLE} properties/docker_build/*.properties ${PROPERTIES_FILE_DIR}/
110+
COPY ${WDT_MODEL} ${WDT_ARCHIVE} ${WDT_VARIABLE} properties/docker-build/*.properties ${PROPERTIES_FILE_DIR}/
111+
# --chown for COPY is available in docker version 18 'COPY --chown oracle:oracle'
112+
RUN chown -R oracle:oracle ${PROPERTIES_FILE_DIR}
103113

104114
# Create the domain home in the docker image.
105115
#
106116
# The create domain tool creates a domain at the DOMAIN_HOME location
107117
# The domain name is set using the value in the model / variable files
108118
# The domain name can be different from the DOMAIN_HOME domain folder name.
109-
110-
ENV WDT_HOME=$WDT_HOME/weblogic-deploy
111-
119+
#
112120
# Set WORKDIR for @@PWD@@ global token in model file
113121
WORKDIR $ORACLE_HOME
122+
USER oracle
114123
RUN if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file $PROPERTIES_FILE_DIR/${WDT_MODEL##*/}"; fi && \
115124
if [ -n "$WDT_ARCHIVE" ]; then ARCHIVE_OPT="-archive_file $PROPERTIES_FILE_DIR/${WDT_ARCHIVE##*/}"; fi && \
116125
if [ -n "$WDT_VARIABLE" ]; then VARIABLE_OPT="-variable_file $PROPERTIES_FILE_DIR/${WDT_VARIABLE##*/}"; fi && \
117-
echo parent $DOMAIN_PARENT && \
118126
${WDT_HOME}/bin/createDomain.sh \
119127
-oracle_home $ORACLE_HOME \
120128
-java_home $JAVA_HOME \
@@ -123,16 +131,17 @@ RUN if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file $PROPERTIES_FILE_DIR/${W
123131
$VARIABLE_OPT \
124132
$MODEL_OPT \
125133
$ARCHIVE_OPT && \
126-
chown -R oracle:oracle $DOMAIN_PARENT && \
134+
chmod -R a+x $DOMAIN_HOME/bin/*.sh && \
127135
rm -rf $PROPERTIES_FILE_DIR
128136

137+
# Mount the domain home and the WDT home for easy access.
129138
VOLUME $DOMAIN_HOME
139+
VOLUME $WDT_HOME
130140

131141
# Expose admin server, managed server port and domain debug port
132-
EXPOSE $ADMIN_PORT $MS_PORT $DEBUG_PORT
142+
EXPOSE $ADMIN_PORT $MANAGED_SERVER_PORT $DEBUG_PORT
133143

134-
# Define default command to start bash.
135-
WORKDIR $SCRIPT_HOME
136-
USER oracle
144+
WORKDIR $DOMAIN_HOME
137145

138-
CMD ["./startWLSDomain.sh"]
146+
# Define default command to start bash.
147+
CMD ["/u01/oracle/startAdminServer.sh"]

samples/docker-domain/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To build this sample, run:
3838
$ docker build \
3939
--build-arg WDT_MODEL=simple-topology.yaml \
4040
--build-arg WDT_ARCHIVE=archive.zip \
41-
--build-arg WDT_VARIABLE=simple-topology.properties \
41+
--build-arg WDT_VARIABLE=container-scripts/domain.properties \
4242
--force-rm=true \
4343
-t 12213-domain-wdt .
4444

samples/docker-domain/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ docker build \
1515
--build-arg WDT_MODEL=simple-topology.yaml \
1616
--build-arg WDT_VARIABLE=properties/docker-build/domain.properties \
1717
--build-arg WDT_ARCHIVE=archive.zip \
18+
--force-rm=true \
1819
-t 12213-domain-wdt .
1920

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash ex
22

3-
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
44
# The Universal Permissive License (UPL), Version 1.0
55
#
66
# This example creates the BUILD_ARG environment variable as a string of --build-arg for
@@ -29,35 +29,42 @@ if [ -n "$DOMAIN_DIR" ]; then
2929
DOMAIN_NAME=$DOMAIN_DIR
3030
export DOMAIN_NAME
3131
echo DOMAIN_NAME=$DOMAIN_NAME
32-
BUILD_ARG="$BUILD_ARG --build-arg ARG_DOMAIN_NAME=$DOMAIN_NAME"
32+
BUILD_ARG="$BUILD_ARG --build-arg CUSTOM_DOMAIN_NAME=$DOMAIN_NAME"
3333
fi
3434

3535
ADMIN_HOST=`awk '{print $1}' $PROPERTIES_FILE | grep ^ADMIN_HOST= | cut -d "=" -f2`
3636
if [ -n "$ADMIN_HOST" ]; then
3737
export ADMIN_HOST
3838
echo ADMIN_HOST=$ADMIN_HOST
39-
BUILD_ARG="$BUILD_ARG --build-arg ARG_ADMIN_HOST=$ADMIN_HOST"
39+
BUILD_ARG="$BUILD_ARG --build-arg CUSTOM_ADMIN_HOST=$ADMIN_HOST"
40+
fi
41+
42+
ADMIN_NAME=`awk '{print $1}' $PROPERTIES_FILE | grep ^ADMIN_NAME= | cut -d "=" -f2`
43+
if [ -n "$ADMIN_NAME" ]; then
44+
export ADMIN_NAME
45+
echo ADMIN_NAME=$ADMIN_NAME
46+
BUILD_ARG="$BUILD_ARG --build-arg CUSTOM_ADMIN_NAME=$ADMIN_NAME"
4047
fi
4148

4249
ADMIN_PORT=`awk '{print $1}' $PROPERTIES_FILE | grep ^ADMIN_PORT= | cut -d "=" -f2`
4350
if [ -n "$ADMIN_PORT" ]; then
4451
export ADMIN_PORT
4552
echo ADMIN_PORT=$ADMIN_PORT
46-
BUILD_ARG="$BUILD_ARG --build-arg ARG_ADMIN_PORT=$ADMIN_PORT"
53+
BUILD_ARG="$BUILD_ARG --build-arg CUSTOM_ADMIN_PORT=$ADMIN_PORT"
4754
fi
4855

49-
MS_PORT=`awk '{print $1}' $PROPERTIES_FILE | grep ^MS_PORT= | cut -d "=" -f2`
50-
if [ -n "$MS_PORT" ]; then
51-
export MS_PORT
52-
echo MS_PORT=$MS_PORT
53-
BUILD_ARG="$BUILD_ARG --build-arg ARG_MS_PORT=$MS_PORT"
56+
MANAGED_SERVER_PORT=`awk '{print $1}' $PROPERTIES_FILE | grep ^MANAGED_SERVER_PORT= | cut -d "=" -f2`
57+
if [ -n "$MANAGED_SERVER_PORT" ]; then
58+
export MANAGED_SERVER_PORT
59+
echo MANAGED_SERVER_PORT=$MANAGED_SERVER_PORT
60+
BUILD_ARG="$BUILD_ARG --build-arg CUSTOM_MANAGED_SERVER_PORT=$MANAGED_SERVER_PORT"
5461
fi
5562

5663
DEBUG_PORT=`awk '{print $1}' $PROPERTIES_FILE | grep ^DEBUG_PORT= | cut -d "=" -f2`
5764
if [ -n "$DEBUG_PORT" ]; then
5865
export DEBUG_PORT
5966
echo DEBUG_PORT=$DEBUG_PORT
60-
BUILD_ARG="$BUILD_ARG --build-arg ARG_DEBUG_PORT=$DEBUG_PORT"
67+
BUILD_ARG="$BUILD_ARG --build-arg CUSTOM_DEBUG_PORT=$DEBUG_PORT"
6168
fi
6269

6370
echo BUILD_ARG=$BUILD_ARG
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
#
3+
#Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
4+
#
5+
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+
#
7+
# Start the domain Admin Server.
8+
9+
# Locate the runtime properties
10+
PROPERTIES_FILE=${PROPERTIES_FILE_DIR}/security.properties
11+
if [ ! -e "$PROPERTIES_FILE" ]; then
12+
echo "A security.properties file with the username and password needs to be supplied."
13+
exit
14+
fi
15+
16+
# Define Admin Server JAVA_OPTIONS
17+
JAVA_OPTIONS=`awk '{print $1}' $PROPERTIES_FILE | grep ^JAVA_OPTIONS= | cut -d "=" -f2`
18+
if [ -z "${JAVA_OPTIONS}" ]; then
19+
JAVA_OPTIONS="-Dweblogic.StdoutDebugEnabled=false"
20+
fi
21+
export ${JAVA_OPTIONS}
22+
echo "Java Options: ${JAVA_OPTIONS}"
23+
24+
echo "I am here"
25+
# Define start of Derby Database
26+
echo "start derby"
27+
CUSTOM_DERBY_FLAG=`awk '{print $1}' $PROPERTIES_FILE | grep ^DERBY_FLAG= | cut -d "=" -f2`
28+
if [ -n "${CUSTOM_DERBY_FLAG}" ]; then
29+
echo got a derby flag from prop
30+
DERBY_FLAG="${CUSTOM_DERBY_FLAG}"
31+
fi
32+
echo found the dervby
33+
export ${DERBY_FLAG}
34+
echo "Start Derby: ${DERBY_FLAG}"
35+
36+
export AS_HOME="${DOMAIN_HOME}/servers/${ADMIN_NAME}"
37+
export AS_SECURITY="${AS_HOME}/security"
38+
export AS_LOGS="${AS_HOME}/logs"
39+
40+
if [ -f ${AS_LOGS}}/${ADMIN_NAME}.log ]; then
41+
exit
42+
fi
43+
44+
echo "Admin Server Home: ${AS_HOME}"
45+
echo "Admin Server Security: ${AS_SECURITY}"
46+
echo "Admin Server Logs: ${AS_LOGS}"
47+
48+
USER=`awk '{print $1}' $PROPERTIES_FILE | grep ^username= | cut -d "=" -f2`
49+
if [ -z "$USER" ]; then
50+
echo "The domain username is blank. The Admin username must be set in the properties file."
51+
exit 1
52+
fi
53+
54+
PASS=`awk '{print $1}' $PROPERTIES_FILE | grep ^password= | cut -d "=" -f2`
55+
if [ -z "$PASS" ]; then
56+
echo "The domain password is blank. The Admin password must be set in the properties file."
57+
exit 1
58+
fi
59+
60+
mkdir -p ${AS_SECURITY}
61+
echo "username=${USER}" >> ${AS_SECURITY}/boot.properties
62+
echo "password=${PASS}" >> ${AS_SECURITY}/boot.properties
63+
64+
# Start Admin Server and tail the logs
65+
${DOMAIN_HOME}/bin/setDomainEnv.sh
66+
${DOMAIN_HOME}/startWebLogic.sh
67+
68+
tail -f ${AS_LOGS}/${ADMIN_NAME}.log &
69+
70+
childPID=$!
71+
wait $childPID
Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
#!/bin/bash
22
#
3-
#Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved.
3+
#Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
44
#
55
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
66
#
7-
# Start the Domain.
7+
# Start a Domain Managed Server.
88

9-
PROPERTIES_FILE=/u01/oracle/properties/security.properties
9+
PROPERTIES_FILE=${PROPERTIES_FILE_DIR}/security.properties
1010
if [ ! -e "$PROPERTIES_FILE" ]; then
11-
echo "A properties file with variable definitions needs to be supplied."
11+
echo "A security.properties file with variable definitions needs to be supplied."
1212
exit
1313
fi
1414

15+
JAVA_OPTIONS=`awk '{print $1}' $PROPERTIES_FILE | grep ^JAVA_OPTIONS= | cut -d "=" -f2`
16+
if [ -z "$JAVA_OPTIONS" ]; then
17+
JAVA_OPTIONS="-Dweblogic.StdoutDebugEnabled=false"
18+
fi
19+
20+
export MS_HOME="${DOMAIN_HOME}/servers/${MANAGED_SERVER_NAME}"
21+
export MS_SECURITY="${MS_HOME}/security"
22+
export MS_LOGS="${MS_HOME}/logs"
23+
24+
if [ -f ${MS_LOGS}/${MANAGED_SERVER_NAME}.log ]; then
25+
exit
26+
fi
27+
28+
# Wait for the domain Admin Server to become available
29+
${SCRIPT_HOME}/waitForAdminServer.sh
30+
31+
echo "Managed Server Name: ${MANAGED_SERVER_NAME}"
32+
echo "Managed Server Home: ${MS_HOME}"
33+
echo "Managed Server Security: ${MS_SECURITY}"
34+
echo "Managed Server Logs: ${MS_LOGS}"
35+
1536
USER=`awk '{print $1}' $PROPERTIES_FILE | grep ^username= | cut -d "=" -f2`
1637
if [ -z "$USER" ]; then
1738
echo "The admin username is blank. The admin username must be set in the properties file."
18-
exit
39+
exit
1940
fi
2041

2142
PASS=`awk '{print $1}' $PROPERTIES_FILE | grep ^password= | cut -d "=" -f2`
@@ -24,14 +45,17 @@ if [ -z "$PASS" ]; then
2445
exit
2546
fi
2647

27-
mkdir -p $DOMAIN_HOME/servers/$MS_NAME/security
28-
echo username=$USER > $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties
29-
echo password=$PASS >> $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties
48+
mkdir -p ${MS_SECURITY}
49+
echo username=$USER > ${MS_SECURITY}/boot.properties
50+
echo password=$PASS >> ${MS_SECURITY}/boot.properties
51+
52+
# Start Managed Server
53+
${DOMAIN_HOME}/bin/setDomainEnv.sh
54+
echo 'Start Managed Server: ${MANAGED_SERVER_NAME}'
55+
${DOMAIN_HOME}/bin/startManagedWebLogic.sh ${MANAGED_SERVER_NAME} http://${ADMIN_HOST}:${ADMIN_PORT}
3056

31-
# Start Managed Server and tail the logs
32-
${DOMAIN_HOME}/bin/startManagedWebLogic.sh $MS_NAME http://$ADMIN_HOST:$ADMIN_PORT
33-
touch ${DOMAIN_HOME}/servers/$MS_NAME/logs/${MS_NAME}.log
34-
tail -f ${DOMAIN_HOME}/servers/$MS_NAME/logs/${MS_NAME}.log &
57+
# Tail Managed Server Log
58+
tail -f ${MS_LOGS}/${MANAGED_SERVER_NAME}.log &
3559

3660
childPID=$!
3761
wait $childPID

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

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

0 commit comments

Comments
 (0)