Skip to content

Commit db0d2f4

Browse files
CarolynRountreemarkxnelson
authored andcommitted
Fixes sample domain in image wdt (#688)
* changes to align with newest docker-images and also corrections * changes to align with newest docker-images and also corrections * fix for properties directory * remove reference to serverstartmode, add directory to git clone * Changes for properties dir rename and wdt image rename * Correct scriptdir on github clone for image build * Minor update to README Signed-off-by: doxiao <[email protected]> * Move some generate domain resource file code from function createDomainHome to createFiles
1 parent b8ca68c commit db0d2f4

File tree

3 files changed

+29
-43
lines changed

3 files changed

+29
-43
lines changed

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The script will perform the following steps:
2727
* Create a directory for the generated properties and Kubernetes YAML files for this domain if it does not already exist. The pathname is `/path/to/weblogic-operator-output-directory/weblogic-domains/<domainUID>`. If the directory already exists, its contents will be removed.
2828
* Create a properties file, `domain.properties`, in the directory that is created above. This properties file will be used to create a sample WebLogic Server domain.
2929
* Clone the weblogic docker-images project via the `git clone https://github.com/oracle/docker-images.git` into the current directory.
30-
* Replace the built-in username and password in the `properties/docker_build/domain_security.properties` file with the `username` and `password` that are supplied in the command line via the `-u` and `-p` options. These credentials need to match the WebLogic domain admin credentials in the secret that is specified via `weblogicCredentialsSecretName` property in the `create-domain-inputs.yaml` file.
30+
* Replace the built-in username and password in the `properties/docker-build/domain_security.properties` file with the `username` and `password` that are supplied in the command line via the `-u` and `-p` options. These credentials need to match the WebLogic domain admin credentials in the secret that is specified via `weblogicCredentialsSecretName` property in the `create-domain-inputs.yaml` file.
3131
* Build a Docker image based on the Docker sample, [Example Image with a WebLogic Server Domain using the Oracle WebLogic Deploy Tooling (WDT)](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image-wdt) and [Example Image with a WebLogic Server Domain using WLST](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image). It will create a sample WebLogic Server domain in the Docker image. Also, you can run the Docker sample, [Example Image with a WebLogic Server Domain](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image), manually with the generated `domain.properties` to create a domain home image. **Note**: Oracle recommends keeping the domain home image private in the local repository.
3232
* Create a Kubernetes domain YAML file, `domain.yaml`, in the directory that is created above. This YAML file can be used to create the Kubernetes resource using the `kubectl create -f` or `kubectl apply -f` command.
3333

@@ -77,7 +77,7 @@ The following parameters can be provided in the inputs file.
7777
| `domainUID` | Unique ID that will be used to identify this particular domain. Used as the name of the generated WebLogic domain as well as the name of the Kubernetes domain resource. This ID must be unique across all domains in a Kubernetes cluster. This ID cannot contain any character that is not valid in a Kubernetes service name. | `domain1` |
7878
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
7979
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
80-
| `image` | WebLogic Docker image that the domain resource will use. If not specified, the value is the name of the generated Docker image. | `12213-domain-wdt` |
80+
| `image` | WebLogic Docker image that the domain resource will use. If not specified, the value is the name of the generated Docker image. | `12213-domain-home-in-image-wdt` |
8181
| `imagePath` | The relative directory of the WebLogic domain home in image Docker image in `https://github.com/oracle/docker-images.git` project under the `docker-images/OracleWebLogic/samples` directory. | `12213-domain-home-in-image-wdt` |
8282
| `imagePullPolicy` | WebLogic Docker image pull policy. Legal values are "IfNotPresent", "Always", or "Never" | `IfNotPresent` |
8383
| `imagePullSecretName` | Name of the Kubernetes secret to access the Docker Store to pull the WebLogic Server Docker image. The presence of the secret will be validated when this parameter is specified | |

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ productionModeEnabled: true
4343
# WebLogic Docker image that the domain resource will use.
4444
# If not specified, the value is the name of the generated Docker image, which is
4545
# "12213-domain-home-in-image" if the imagePath property is specified as "12213-domain-home-in-image";
46-
# "12213-domain-wdt" if the imagePath property is specified as "12213-domain-home-in-image-wdt".
47-
image: 12213-domain-wdt
46+
# "12213-domain-home-in-image-wdt" if the imagePath property is specified as "12213-domain-home-in-image-wdt".
47+
image: 12213-domain-home-in-image-wdt
4848

4949
# Image pull policy
5050
# Legal values are "IfNotPresent", "Always", or "Never"

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function initialize {
153153
#
154154
function getDockerSample {
155155
rm -rf ${scriptDir}/docker-images
156-
git clone https://github.com/oracle/docker-images.git
156+
git clone https://github.com/oracle/docker-images.git ${scriptDir}/docker-images
157157
}
158158

159159
#
@@ -174,11 +174,11 @@ function createFiles {
174174
enabledPrefix="" # uncomment the feature
175175
disabledPrefix="# " # comment out the feature
176176

177-
domainName=${domainUID}
177+
domainName=${domainUID}
178178

179179
# Generate the properties file that will be used when creating the weblogic domain
180180
echo Generating ${domainPropertiesOutput}
181-
181+
182182
cp ${domainPropertiesInput} ${domainPropertiesOutput}
183183
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPropertiesOutput}
184184
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${domainPropertiesOutput}
@@ -235,25 +235,10 @@ function createFiles {
235235
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
236236
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${dcrOutput}
237237

238-
# Remove any "...yaml-e" files left over from running sed
239-
rm -f ${domainOutputDir}/*.yaml-e
240-
}
241-
242-
#
243-
# Function to build docker image and create WebLogic domain home
244-
#
245-
function createDomainHome {
246238
if [ -z $imagePath ]; then
247239
imagePath="12213-domain-home-in-image-wdt"
248240
fi
249-
250-
cp ${domainPropertiesOutput} ./docker-images/OracleWebLogic/samples/${imagePath}/properties/docker_build
251-
252-
imageName="12213-domain-home-in-image"
253-
# use the existence of build-archive.sh file to determine if we need to download WDT
254-
if [ -f "./docker-images/OracleWebLogic/samples/${imagePath}/build-archive.sh" ]; then
255-
imageName="12213-domain-wdt"
256-
fi
241+
imageName="${imagePath}:latest"
257242

258243
# now we know which image to use, update the domain yaml file
259244
if [ -z $image ]; then
@@ -262,40 +247,41 @@ function createDomainHome {
262247
sed -i -e "s|%IMAGE_NAME%|${image}|g" ${dcrOutput}
263248
fi
264249

265-
cd docker-images/OracleWebLogic/samples/${imagePath}
250+
# Remove any "...yaml-e" files left over from running sed
251+
rm -f ${domainOutputDir}/*.yaml-e
252+
}
266253

254+
#
255+
# Function to build docker image and create WebLogic domain home
256+
#
257+
function createDomainHome {
258+
dockerDir=${scriptDir}/docker-images/OracleWebLogic/samples/${imagePath}
259+
dockerPropsDir=${dockerDir}/properties
260+
cp ${domainPropertiesOutput} ${dockerPropsDir}/docker-build
261+
267262
# 12213-domain-home-in-image use one properties file for the credentials
268-
usernameFile="properties/docker_build/domain_security.properties"
269-
passwordFile="properties/docker_build/domain_security.properties"
270-
263+
usernameFile="${dockerPropsDir}/docker-build/domain_security.properties"
264+
passwordFile="${dockerPropsDir}/docker-build/domain_security.properties"
265+
271266
# 12213-domain-home-in-image-wdt uses two properties files for the credentials
272267
if [ ! -f $usernameFile ]; then
273-
usernameFile="properties/docker-build/adminuser.properties"
274-
passwordFile="properties/docker-build/adminpass.properties"
275-
sed -i -e "s|weblogic|${username}|g" $usernameFile
276-
sed -i -e "s|welcome1|${password}|g" $passwordFile
277-
else
278-
sed -i -e "s|myuser|${username}|g" $usernameFile
279-
sed -i -e "s|mypassword1|${password}|g" $passwordFile
268+
usernameFile="${dockerPropsDir}/docker-build/adminuser.properties"
269+
passwordFile="${dockerPropsDir}/docker-build/adminpass.properties"
280270
fi
271+
272+
sed -i -e "s|myuser|${username}|g" $usernameFile
273+
sed -i -e "s|mypassword1|${password}|g" $passwordFile
281274

282-
# use the existence of build-archive.sh file to determine if we need to download WDT
283-
if [ -f "build-archive.sh" ]; then
284-
sh ./build-archive.sh
285-
wget https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.14/weblogic-deploy.zip
286-
fi
287-
288275
if [ ! -z $baseImage ]; then
289-
sed -i -e "s|\(FROM \).*|\1 ${baseImage}|g" Dockerfile
276+
sed -i -e "s|\(FROM \).*|\1 ${baseImage}|g" ${dockerDir}/Dockerfile
290277
fi
291278

292-
sh ./build.sh
279+
sh ${dockerDir}/build.sh
293280

294281
if [ "$?" != "0" ]; then
295282
fail "Create domain ${domainName} failed."
296283
fi
297284

298-
cd -
299285
echo ""
300286
echo "Create domain ${domainName} successfully."
301287
}

0 commit comments

Comments
 (0)