-
Notifications
You must be signed in to change notification settings - Fork 89
Issue#130 add docker sample that creates a domain #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9650906
a67a8ef
ef54a92
d2efccb
d358e00
07dae77
6b78d59
bf1ee34
527f5d2
6053557
6102f25
daafc38
63f59d5
4025e20
b815bf2
648d384
ae0d841
ad86a0f
7423c43
6ba3a70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| #Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. | ||
| # | ||
| #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
| # | ||
| # ORACLE DOCKERFILES PROJECT | ||
| # -------------------------- | ||
| # This Dockerfile extends the Oracle WebLogic image by creating a sample domain. | ||
| # | ||
| # Util scripts are copied into the image enabling users to plug NodeManager | ||
| # automatically into the AdminServer running on another container. | ||
| # | ||
| # HOW TO BUILD THIS IMAGE | ||
| # ----------------------- | ||
| # Put all downloaded files in the same directory as this Dockerfile | ||
| # Build the deployment archive file using the build-archive.sh script. | ||
| # $ ./build-archive.sh | ||
| # | ||
| # Run: | ||
| # $ sudo docker build \ | ||
| # --build-arg WDT_MODEL=simple-topology.yaml \ | ||
| # --build-arg WDT_ARCHIVE=archive.zip \ | ||
| # -t 12213-domain-wdt . | ||
| # | ||
| # Pull base image | ||
| # --------------- | ||
| FROM store/oracle/weblogic:12.2.1.3 | ||
|
|
||
| # Maintainer | ||
| # ---------- | ||
| MAINTAINER Monica Riccelli <monica.riccelli@oracle.com> | ||
|
|
||
| ARG WDT_MODEL | ||
| ARG WDT_ARCHIVE | ||
|
|
||
| # WLS Configuration | ||
| # --------------------------- | ||
| ENV ADMIN_HOST="wlsadmin" \ | ||
| NM_PORT="5556" \ | ||
| MS_PORT="8001" \ | ||
| DEBUG_PORT="8453" \ | ||
| ORACLE_HOME=/u01/oracle \ | ||
| SCRIPT_FILE=/u01/oracle/createAndStartWLSDomain.sh \ | ||
| CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true" \ | ||
| PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_domain}/bin:/u01/oracle | ||
|
|
||
| # Domain and Server environment variables | ||
| # ------------------------------------------------------------ | ||
| ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}" \ | ||
| PRE_DOMAIN_HOME=/u01/oracle/user_projects \ | ||
| ADMIN_PORT="${ADMIN_PORT:-7001}" \ | ||
| WDT_MODEL="$WDT_MODEL" \ | ||
| WDT_ARCHIVE="$WDT_ARCHIVE" | ||
|
|
||
| # Add files required to build this image | ||
| COPY container-scripts/* /u01/oracle/ | ||
| COPY weblogic-deploy.zip /u01 | ||
| COPY ${WDT_MODEL} ${ARCHIVE_FILE} /u01/ | ||
|
|
||
| #Create directory where domain will be written to | ||
| USER root | ||
| RUN chmod +xw /u01/oracle/*.sh && \ | ||
| chmod +xw /u01/oracle/*.py && \ | ||
| mkdir -p $PRE_DOMAIN_HOME && \ | ||
| mkdir -p $PRE_DOMAIN_HOME/domains && \ | ||
| chmod a+xr $PRE_DOMAIN_HOME && \ | ||
| chown -R oracle:oracle $PRE_DOMAIN_HOME && \ | ||
| cd /u01 && \ | ||
| $JAVA_HOME/bin/jar xf /u01/weblogic-deploy.zip && \ | ||
| chmod +xw /u01/weblogic-deploy/bin/*.sh && \ | ||
| chmod -R +xw /u01/weblogic-deploy/lib/python && \ | ||
| if [ -n "$WDT_MODEL" ]; then MODEL_OPT="-model_file /u01/$WDT_MODEL"; fi && \ | ||
| if [ -n "$WDT_ARCHIVE" ]; then ARCHIVE_OPT="-archive_file /u01/$WDT_ARCHIVE"; fi && \ | ||
| /u01/weblogic-deploy/bin/createDomain.sh \ | ||
| -oracle_home $ORACLE_HOME \ | ||
| -java_home ${JAVA_HOME} \ | ||
| -domain_parent $PRE_DOMAIN_HOME/domains \ | ||
| -domain_type WLS \ | ||
| -variable_file /u01/oracle/domain.properties \ | ||
| $MODEL_OPT \ | ||
| $ARCHIVE_OPT && \ | ||
| chown -R oracle:oracle $PRE_DOMAIN_HOME | ||
|
|
||
| VOLUME $PRE_DOMAIN_HOME | ||
| # Expose Node Manager default port, and also default for admin and managed server | ||
| EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT $DEBUG_PORT | ||
|
|
||
| USER oracle | ||
| WORKDIR $ORACLE_HOME | ||
|
|
||
| # Define default command to start bash. | ||
| CMD ["/u01/oracle/startWLSDomain.sh"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| Example Image with a WLS Domain | ||
| =============================== | ||
| This Dockerfile extends the Oracle WebLogic image by creating a sample WLS 12.2.1.3 domain and cluster. Utility scripts are copied into the image, enabling users to plug Node Manager automatically into the Administration Server running on another container. | ||
|
|
||
| The Dockerfile uses the createDomain script from the Oracle WebLogic Deploy Tooling (WDT) to create the domain from a text-based model file. More information about WDT is available in the README file for the WDT project in GitHub: | ||
|
|
||
| https://github.com/oracle/weblogic-deploy-tooling | ||
|
|
||
| ### 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. | ||
|
|
||
| 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. | ||
|
|
||
| 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 | ||
|
|
||
| **NOTE:** The image is based on a WebLogic image in the Docker store: store/oracle/weblogic:12.2.1.3 . Download this image to your local repository before building the image. | ||
|
|
||
| The WebLogic Deploy Tool installer is required to build this image. Add weblogic-deploy.zip to the sample directory. | ||
|
|
||
| $ wget https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.11/weblogic-deploy.zip | ||
|
|
||
| This sample deploys a simple one-page web application contained in a .zip archive. This archive needs to be built (one time only) before building the Docker image. | ||
|
|
||
| $ ./build-archive.sh | ||
|
|
||
| To build this sample, run: | ||
|
|
||
| $ docker build \ | ||
| --build-arg WDT_MODEL=simple-topology.yaml \ | ||
| --build-arg WDT_ARCHIVE=archive.zip \ | ||
| -t 12213-domain-wdt . | ||
|
|
||
| This will use the model file and archive in the sample directory. | ||
|
|
||
| To start the containerized Administration Server, run: | ||
|
|
||
| $ docker run -d --name wlsadmin --hostname wlsadmin -p 7001:7001 --env-file ./container-scripts/domain.properties 12213-domain-wdt | ||
|
|
||
| To start a containerized Managed Server (ms-1) to self-register with the Administration Server above, run: | ||
|
|
||
| $ docker run -d --name ms-1 --link wlsadmin:wlsadmin -p 9001:9001 --env-file ./container-scripts/domain.properties -e ADMIN_PASSWORD=<admin_password> -e MS_NAME=ms-1 12213-domain-wdt startManagedServer.sh | ||
|
|
||
| To start an additional Managed Server (in this example ms-2), run: | ||
|
|
||
| $ docker run -d --name ms-2 --link wlsadmin:wlsadmin -p 9002:9001 --env-file ./container-scripts/domain.properties -e ADMIN_PASSWORD=<admin_password> -e MS_NAME=ms-2 12213-domain-wdt startManagedServer.sh | ||
|
|
||
| The above scenario from this sample will give you a WebLogic domain with a dynamic cluster set up on a single host environment. | ||
|
|
||
| You may create more containerized Managed Servers by calling the `docker` command above for `startManagedServer.sh` as long you link properly with the Administration Server. For an example of a multihost environment, see the sample `1221-multihost`. | ||
|
|
||
| # Copyright | ||
| Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/sh | ||
| # | ||
| #Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. | ||
| # | ||
| #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
| # | ||
| rm -Rf archive | ||
| mkdir -p archive/wlsdeploy/applications | ||
| cd simple-app | ||
| jar cvf ../archive/wlsdeploy/applications/simple-app.war * | ||
| cd ../archive | ||
| jar cvf ../archive.zip * |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/sh | ||
| # | ||
| #Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. | ||
| # | ||
| #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
| # | ||
| docker build \ | ||
| --build-arg WDT_MODEL=simple-topology.yaml \ | ||
| --build-arg WDT_ARCHIVE=archive.zip \ | ||
| -t 12213-domain-wdt . | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| DOMAIN_NAME=my_domain | ||
| ADMIN_PORT=7001 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this domain.properties if you have a simple-properties.yaml and can define the defaults in the Dockerfile
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't currently use this for the admin startup script, not sure if we will need for the server scripts. One problem is that we can't easily extract the values we want from the yaml model file. I'll know more once we have startup scripts. |
||
| ADMIN_HOST=wlsadmin | ||
| ADMIN_USER=weblogic | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/bash | ||
| # | ||
| #Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. | ||
| # | ||
| #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
| # | ||
| # Start the Domain. | ||
|
|
||
| #Define DOMAIN_HOME | ||
| export DOMAIN_HOME=/u01/oracle/user_projects/domains/$DOMAIN_NAME | ||
|
|
||
| mkdir -p $DOMAIN_HOME/servers/$MS_NAME/security | ||
| echo username=$ADMIN_USER > $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties | ||
| echo password=$ADMIN_PASSWORD >> $DOMAIN_HOME/servers/$MS_NAME/security/boot.properties | ||
|
|
||
| # Start Managed Server and tail the logs | ||
| ${DOMAIN_HOME}/bin/startManagedWebLogic.sh $MS_NAME http://$ADMIN_HOST:$ADMIN_PORT | ||
| touch ${DOMAIN_HOME}/servers/$MS_NAME/logs/${MS_NAME}.log | ||
| tail -f ${DOMAIN_HOME}/servers/$MS_NAME/logs/${MS_NAME}.log & | ||
|
|
||
| childPID=$! | ||
| wait $childPID |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/bin/bash | ||
| # | ||
| #Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved. | ||
| # | ||
| #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. | ||
| # | ||
| # Start the Domain. | ||
|
|
||
| # determine the domain name. there is only one domain directory. | ||
| export DOMAIN_NAME=`ls /u01/oracle/user_projects/domains | head -1` | ||
|
|
||
| #Define DOMAIN_HOME | ||
| export DOMAIN_HOME=/u01/oracle/user_projects/domains/$DOMAIN_NAME | ||
|
|
||
| # Start Admin Server and tail the logs | ||
| ${DOMAIN_HOME}/startWebLogic.sh | ||
| touch ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should discuss this as for K8s we're going to want the logs relocated outside the domain home to a file-system location where a persistent volume is mounted.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is planned to have a dynamic cluster, still working on that. I think the log directory can be moved to persistent volume.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this statement does not preclude the logs being outside. The mechanism in Docker -v is used to map the logs outside of the container. |
||
| tail -f ${DOMAIN_HOME}/servers/AdminServer/logs/AdminServer.log & | ||
|
|
||
| childPID=$! | ||
| wait $childPID | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> | ||
| <welcome-file-list> | ||
| <welcome-file>/simple.html</welcome-file> | ||
| </welcome-file-list> | ||
| </web-app> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"> | ||
| <context-root>/simple</context-root> | ||
| </weblogic-web-app> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <html> | ||
| <head> | ||
| <title>Simple Application</title> | ||
| </head> | ||
| <body> | ||
| <h1>Simple Application</h1> | ||
| <p>This is the simple application.</p> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| domainInfo: | ||
| AdminUserName: '@@PROP:ADMIN_USER@@' | ||
| AdminPassword: welcome1 | ||
| ServerStartMode: dev | ||
| topology: | ||
| Name: '@@PROP:DOMAIN_NAME@@' | ||
| AdminServerName: AdminServer | ||
| Cluster: | ||
| mycluster: | ||
| ClientCertProxyEnabled: true | ||
| ClusterMessagingMode: unicast | ||
| DynamicServers: | ||
| ServerTemplate: template1 | ||
| CalculatedListenPorts: false | ||
| MaximumDynamicServerCount: 2 | ||
| ServerNamePrefix: 'ms-' | ||
| DynamicClusterSize: 2 | ||
| MaxDynamicClusterSize: 8 | ||
| Server: | ||
| AdminServer: | ||
| Machine: machine1 | ||
| ListenPort: '@@PROP:ADMIN_PORT@@' | ||
| ServerTemplate: | ||
| template1: | ||
| Machine: machine1 | ||
| ListenPort: 9001 | ||
| Machine: | ||
| machine1: | ||
| Notes: The only machine | ||
| NodeManager: | ||
| NMType: SSL | ||
| ListenPort: 5556 | ||
| Notes: The only node manager | ||
| SecurityConfiguration: | ||
| NodeManagerUsername: weblogic | ||
| NodeManagerPasswordEncrypted: welcome1 | ||
| JMX: | ||
| InvocationTimeoutSeconds: 40 | ||
| Notes: JMX notes | ||
| ManagedServerNotificationsEnabled: true | ||
| JTA: | ||
| MaxTransactions: 4 | ||
| Notes: JTA notes | ||
| resources: | ||
| JDBCSystemResource: | ||
| Generic1: | ||
| Target: mycluster | ||
| JdbcResource: | ||
| JDBCDataSourceParams: | ||
| JNDIName: [ jdbc/generic1, jdbc/special1 ] | ||
| GlobalTransactionsProtocol: TwoPhaseCommit | ||
| JDBCDriverParams: | ||
| DriverName: oracle.jdbc.xa.client.OracleXADataSource | ||
| 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)))' | ||
| PasswordEncrypted: welcome1 | ||
| Properties: | ||
| user: | ||
| Value: jshum | ||
| oracle.net.CONNECT_TIMEOUT: | ||
| Value: 5000 | ||
| oracle.jdbc.ReadTimeout: | ||
| Value: 30000 | ||
| JDBCConnectionPoolParams: | ||
| InitialCapacity: 0 | ||
| MaxCapacity: 15 | ||
| appDeployments: | ||
| Application: | ||
| # Quote needed because of hyphen in string | ||
| 'simple-app': | ||
| SourcePath: 'wlsdeploy/applications/simple-app.war' | ||
| Target: mycluster | ||
| ModuleType: war | ||
| StagingMode: nostage | ||
| PlanStagingMode: nostage |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Download the WebLogic Deploy Tool installer to the sample directory. | ||
| # | ||
| # - wget https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.11/weblogic-deploy.zip | ||
| # | ||
| d35e83d969dd6a485409da6e9eca250f weblogic-deploy.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avi might ask that you have a buildDockerImage script similar to https://github.com/oracle/docker-images/blob/master/OracleWebLogic/samples/12213-webtier-apache/buildDockerImage.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that looks pretty straightforward. Let me know if he wants to do this.