Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
CarolynRountree authored Jan 4, 2019
2 parents ef827e0 + 8b023c7 commit 5ad166e
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 125 deletions.
42 changes: 23 additions & 19 deletions OracleWebLogic/samples/12213-domain-home-in-image-wdt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,31 @@ The Dockerfile uses the `createDomain` script from the Oracle WebLogic Deploy To

### WDT Model File and Archive

This sample includes a basic WDT model, `simple-topology.yaml`, that describes the intended configuration of the domain within the Docker image. WDT models can be created and modified using a text editor, following the format and rule described in the README file for the WDT project in GitHub.
This sample includes a basic WDT model, `simple-topology.yaml`, that describes the intended configuration of the domain within the Docker image. WDT models can be created and modified using a text editor, following the format and rules described in the README file for the WDT project in GitHub.

Another option is to use the WDT `discoverDomain` tool to create a model. This process is also described in the WDT project's README file. A user can use the tool to analyze an existing domain, and create a model based on its configuration. The user may choose to customize the model before using it to create a new Docker image.
Another option is to use the WDT `discoverDomain` tool to create a model. This process is also described in the WDT project README file. A user can use the tool to analyze an existing domain, and create a model based on its configuration. The user may choose to customize the model before using it to create a new Docker image.

The sample model is accompanied by a properties file whose values can be changed to customize a domain. The model's variable tokens are replaced with values from 'simple-topology.properties' when building the docker image. The properties files can be created and modified using a text editor. Select variables in the properties file are used by the Dockerfile during the build to persist ENV variables and expose ports in the image.
Care should be taken to secure the credentials that are present in the model. The ADMIN credential attributes in the sample model have a file token referencing a special property file. Each special property file must only contain a single property and can be created and modified using a text editor. The sample includes the files adminuser.properties and the adminpass.properties in the properties/docker_build directory.
The sample model is accompanied by a properties file whose values can be changed to customize a domain. The model's variable tokens are replaced with values from 'simple-topology.properties' when building the Docker image. The properties files can be created and modified using a text editor. Select variables in the properties file are used by the Dockerfile during the build to persist ENV variables and expose ports in the image.

Care should be taken to secure the credentials that are present in the model. The ADMIN credential attributes in the sample model have a file token referencing a special property file. Each special property file must only contain a single property and can be created and modified using a text editor. The sample includes the files `adminuser.properties` and the `adminpass.properties` in the `properties/docker_build` directory.

See the README file for more information on using property and file tokens in the WDT model.

The ADMIN credentials are necessary to start the Admin or Managed Server in a docker container. The sample provides security.properties in the properties/docker-run directory. This file contains the admin credentials and additional properties used to customize the Weblogic Server start.
The ADMIN credentials are necessary to start the Administration or Managed Server in a Docker container. The sample provides `security.properties` in the `properties/docker-run` directory. This file contains the admin credentials and additional properties used to customize the WebLogic Server start.

Note: Oracle recommends that the adminpass.properties, adminuser.properties and security.properties files be deleted or secured after the image is built and the WebLogic Server are started so that the user name and password are not inadvertently exposed.
**Note**: Oracle recommends that the `adminpass.properties`, `adminuser.properties`, and `security.properties` files be deleted or secured after the image is built and the WebLogic Server is started so that the user name and password are not inadvertently exposed.

Domain creation may require the deployment of applications and libraries. This is accomplished by creating a ZIP archive with a specific structure, then referencing those items in the model. This sample creates and deploys a simple ZIP archive containing a small application WAR. That archive is built in the sample directory prior to creating the Docker image.

When the WDT `discoverDomain` tool is used on an existing domain, a ZIP archive is created containing any necessary applications and libraries. The corresponding configuration for those applications and libraries is added to the model.

### How to Build and Run
## How to Build and Run


**NOTE:** The image is based on a WebLogic Server image in the docker-images project: `oracle/weblogic:12.2.1.3-developer`. Build that image to your local repository before building this sample.

The WebLogic Deploy Tool installer is required to build this image. Add `weblogic-deploy.zip` to the sample directory. The Docker sample requires a minimum release of weblogic-deploy-tooling-0.14. This release uses the new command argument `-domain_home` on the `createDomain` step. This argument allows a domain home path with a domain folder name that can be different from the domain name in the model file.

The WebLogic Deploy Tool installer is required to build this image. Add `weblogic-deploy.zip` to the sample directory. The docker sample requires a minimum release of weblogic-deploy-tooling-0.14. This release uses the new command argument -domain_home on the createDomain step. This argument allows a Domain Home path with a domain folder name that can be different from the Domain name in the model file.

$ wget https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.14/weblogic-deploy.zip

Expand All @@ -40,10 +44,9 @@ This sample deploys a simple, one-page web application contained in a ZIP archiv

$ ./build-archive.sh

The sample requires the Admin Host, Admin Port and Admin Name. It also requires the Managed Server port and the domain Debug
Port. The ports will be EXPOSED through Docker. The other arguments are persisted in the image to be used when running a
container. If an attribute is not provided as a --build-arg on the build command, the following defaults are set.
The sample requires the Admin Host, Admin Port and Admin Name. It also requires the Managed Server port and the domain debug port. The ports will be EXPOSED through Docker. The other arguments are persisted in the image to be used when running a container. If an attribute is not provided as a `--build-arg` on the `build` command, the following defaults are set.

```
CUSTOM_ADMIN_NAME = admin-server
The value is persisted to the image as ADMIN_NAME
Expand All @@ -61,8 +64,9 @@ CUSTOM_DEBUG_PORT = 8453
CUSTOM_DOMAIN_NAME = base_domain
The value is persisted to the image as DOMAIN_NAME
```

To build this sample taking the defaults, run:
To build this sample keeping the defaults, run:

$ docker build \
--build-arg WDT_MODEL=simple-topology.yaml \
Expand All @@ -71,16 +75,16 @@ To build this sample taking the defaults, run:
--force-rm=true \
-t 12213-domain-home-in-image-wdt .

This will use the model, variable and archive files in the sample directory.
This will use the model, variable, and archive files in the sample directory.

This sample provides a script which will read the model variable file and parse the domain, admin and managed server information
into a string of --build-arg statements. This build arg string is exported as environment variable BUILD_ARG.
The sample script specifically parses the sample variable file. Use it as an example to parse a custom variable file.
This will insure that the values docker exposes and persists in the image are the same values configured in the domain.
This sample provides a script which will read the model variable file and parse the domain, Administration and Managed Server information
into a string of `--build-arg` statements. This build `arg` string is exported as the environment variable `BUILD_ARG`.
The sample script specifically parses the sample variable file. Use it as an example to parse a custom variable file.
This will insure that the values Docker exposes and persists in the image are the same values configured in the domain.

To parse the sample variable file and build the sample, run:

$ container-scripts/setEnv.sh properties/docker-build/domain.properties
$ container-scripts/setEnv.sh properties/docker-build/domain.properties

$ docker build \
$BUILD_ARG \
Expand Down
37 changes: 21 additions & 16 deletions OracleWebLogic/samples/12213-domain-home-in-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,33 @@ Example Image with a WebLogic Server Domain
=============================================
This Dockerfile extends the Oracle WebLogic image by creating a sample WebLogic Server 12.2.1.3 domain and cluster into a Docker image.

A domain is created inside the image and utility scripts are copied into the image, enabling users to start an Administration Server and a Managed Servers each running in separate containers. As part of the domain configuration there is a data source that connects to a Derby database started in the Admin Server container. The data source in the Managed servers connect to the Derby database in the Admin server container.
A domain is created inside the image and utility scripts are copied into the image, enabling users to start an Administration Server and a Managed Server, each running in separate containers.

**Note:** In this sample the WebLogic servers are configured with a blank listen address, when running JTA transactions you must use a DNS server to configure the listen addresses to use DNS names.
**Note:** In this sample, the WebLogic Servers are configured with a blank listen address; when running JTA transactions, you must use a DNS server to configure the listen addresses to use DNS names.

### Providing the Administration Server user name and password
## Providing the Administration Server user name and password

**During Docker Build:** The user name, password must be supplied in domain_security.properties file. The property file is located in the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker-build` in the HOST. This property file gets copied into the image directory `/u01/oracle/properties`.

**During Docker Run:** The user name and password must be supplied in a security.properties file. The property file is located in a `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker-run` in the HOST. In the Docker run command line add the -v option maps the property file into the image directory /u01/oracle/properties.
**During Docker Build:** The user name and password must be supplied in the `domain_security.properties` file. The property file is located in the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_build` in the HOST. This property file gets copied into the image directory `/u01/oracle/properties`.

The security property files enables the scripts to configure the correct authentication for the WebLogic Administration Server and Managed Servers. The format of the security.properties and domain_security.properties files are key=value pairs, for example:
**During Docker Run:** The user name and password must be supplied in a `security.properties` file. The property file is located in a `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_run` directory in the HOST. On the Docker run command line, the `-v` option maps the property file into the image directory `/u01/oracle/properties`.


The security property files enable the scripts to configure the correct authentication for the WebLogic Administration Server and Managed Servers. The format of the `security.properties` and `domain_security.properties` files are key=value pairs, for example:

username=myadminusername
password=myadminpassword

**Note:** Oracle recommends that the domain_security.properties and security.properties files be deleted or secured after the container and the WebLogic Server are started so that the user name and password are not inadvertently exposed.
**Note:** Oracle recommends that the `domain_security.properties` and `security.properties` files be deleted or secured after the container and the WebLogic Server are started so that the user name and password are not inadvertently exposed.

## How to Build and Run
At build time, the `domain.properties` file is used to pass in the Docker arguments and configuration parameters for the WebLogic domain.


### How to Build and Run
At build time the domain.properties file is used to pass in the Docker arguments and configuration parameters for the Weblogic domain.
**During Docker Build:** The domain configuration parameters must be supplied in the `domain.properties` file. This file is located in the directory `properties/docker_build` in the HOST. This property file gets copied into the image directory `/u01/oracle/properties`.

**During Docker Build:** The domain configuration parameters must be supplied in the domain.properties file. This file is located in the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker-build` in the HOST. This property file gets copied into the image directory `/u01/oracle/properties`.

The domain property file enables you to customize the parameter to configure the WebLogic domain. The format of the domain.properties are key=value pairs, for example:
The domain property file enables you to customize the parameters to configure the WebLogic domain. The format of the `domain.properties` are key=value pairs, for example:

ADMIN_NAME=admin-server
ADMIN_HOST=wlsadmin
Expand All @@ -35,9 +39,11 @@ The domain property file enables you to customize the parameter to configure the
PRODUCTION_MODE_ENABLED=true
CLUSTER_TYPE=DYNAMIC

**NOTE:** Before invoking the build make sure you have built `oracle/weblogic:12.2.1.3-developer`.
**NOTE:** Before invoking the build make sure you have built `oracle/weblogic:12.2.1.3-developer`.


Under the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/container_scripts` find the script `setEnv.sh`. This script extracts the following Docker arguments and passes them as a `--build-arg` to the Dockerfile.

Under the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/container-scripts` find the script setEnv.sh. This script extracts the following Docker arguments and passes them as a --build-arg to the Dockerfile.

* Domain Name: `DOMAIN_NAME` (default: `base_domain`)
* Admin Port: `ADMIN_PORT` (default: `7001`)
Expand All @@ -47,16 +53,15 @@ Under the directory `docker-images/OracleWebLogic/samples/12213-domain-home-in-i
* Admin Server Name: `ADMIN_NAME` (default: `admin-server`)
* Admin Server Host: `ADMIN_HOST` (default: `wlsadmin`)

**NOTE:** The DOMAIN_HOME will be persisted in the image directory `/u01/oracle/user-projects/domains/$DOMAIN_NAME`.
**NOTE:** The `DOMAIN_HOME` will be persisted in the image directory `/u01/oracle/user-projects/domains/$DOMAIN_NAME`.

To build this sample, run:

$ . container-scripts/setEnv.sh ./properties/docker-build/domain.properties
$ docker build $BUILD_ARG --force-rm=true -t 12213-domain-home-in-image .



**During Docker Run:** of the admin and managed servers, the user name and password need to be passed in as well as some optional parameters. The property file is located in a `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker-run` in the HOST. In the Docker run command line add the -v option which maps the property file into the image directory /u01/oracle/properties.
**During Docker Run:** of the Administration and Managed Servers, the user name and password need to be passed in as well as some optional parameters. The property file is located in a `docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_run` in the HOST. On the Docker run command line, add the `-v` option which maps the property file into the image directory `/u01/oracle/properties`.


To start the containerized Administration Server, run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def getEnvVar(var):
print('cluster_type : [%s]' % cluster_type);
print('managed_server_name_base : [%s]' % managed_server_name_base);
print('production_mode_enabled : [%s]' % production_mode_enabled);
print('dsname : [%s]' % dsname);
#print('dsname : [%s]' % dsname);
print('t3_channel_port : [%s]' % t3_channel_port);
print('t3_public_address : [%s]' % t3_public_address);

Expand Down Expand Up @@ -159,46 +159,46 @@ def getEnvVar(var):

# Create a Data Source
# ======================
cd('/')
print('Configuring a Data Source: %s' % dsname);
create(dsname, 'JDBCSystemResource')
cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
cmo.setName(dsname)

cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String(dsjndiname))
set('GlobalTransactionsProtocol', java.lang.String('None'))

cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName', dsdriver)
set('URL', dsurl)
set('PasswordEncrypted', dspassword)
set('UseXADataSourceInterface', 'false')

print 'create JDBCDriverParams Properties'
create('myProperties','Properties')
cd('Properties/NO_NAME_0')
create('user','Property')
cd('Property/user')
set('Value', dsusername)

cd('../../')
create('databaseName','Property')
cd('Property/databaseName')
set('Value', dsdbname)

print 'create JDBCConnectionPoolParams'
cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SQL SELECT 1 FROM DUAL')
set('InitialCapacity',int(dsinitalcapacity))

print('Done setting attributes for Data Source: %s' % dsname);
#cd('/')
#print('Configuring a Data Source: %s' % dsname);
#create(dsname, 'JDBCSystemResource')
#cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
#cmo.setName(dsname)

#cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
#create('myJdbcDataSourceParams','JDBCDataSourceParams')
#cd('JDBCDataSourceParams/NO_NAME_0')
#set('JNDIName', java.lang.String(dsjndiname))
#set('GlobalTransactionsProtocol', java.lang.String('None'))

#cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
#create('myJdbcDriverParams','JDBCDriverParams')
#cd('JDBCDriverParams/NO_NAME_0')
#set('DriverName', dsdriver)
#set('URL', dsurl)
#set('PasswordEncrypted', dspassword)
#set('UseXADataSourceInterface', 'false')

#print 'create JDBCDriverParams Properties'
#create('myProperties','Properties')
#cd('Properties/NO_NAME_0')
#create('user','Property')
#cd('Property/user')
#set('Value', dsusername)

#cd('../../')
#create('databaseName','Property')
#cd('Property/databaseName')
#set('Value', dsdbname)

#print 'create JDBCConnectionPoolParams'
#cd('/JDBCSystemResource/' + dsname + '/JdbcResource/' + dsname)
#create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
#cd('JDBCConnectionPoolParams/NO_NAME_0')
#set('TestTableName','SQL SELECT 1 FROM DUAL')
#set('InitialCapacity',int(dsinitalcapacity))

#print('Done setting attributes for Data Source: %s' % dsname);

# Assign
# ======
Expand Down
Loading

0 comments on commit 5ad166e

Please sign in to comment.