Sign inSign up

rlagutinhub/docker.weblogic-adminserver-app

By rlagutinhub

Updated almost 7 years ago

Image
0

130

rlagutinhub/docker.weblogic-adminserver-app repository overview

Docker: docker.weblogic-adminserver-app

Compiled Docker image: https://hub.docker.com/r/rlagutinhub/docker.weblogic-adminserver-app

  • Oracle WebLogic 12.2.1.2-generic autoconfig (only first running) domain without cluster (only AdminServer) include deploying datasources, libraries, applications.
  • Support run on Docker Standalone and Docker Swarm Mode
  • Base image oraclelinux:7-slim

FYI https://github.com/oracle/docker-images


Prepare

Docker Image Oracle Linux 7 with Oracle Server JRE:

# get git oracle docker repo
git clone https://github.com/rlagutinhub/docker.weblogic-adminserver-app.git

# download Oracle Server JRE (example Java server-jre 1.8.0.172)
# http://download.oracle.com/otn/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/server-jre-8u172-linux-x64.tar.gz
cp server-jre-8u172-linux-x64.tar.gz ~/docker.weblogic-adminserver-app/distib/OracleJava/

# create docker image OracleJava (all required packages installed from oracle repo yum.oracle.com):
cd ~/docker.weblogic-adminserver-app/distib/OracleJava/
./build.sh

# result
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/serverjre 8 fca1db36746d 5 days ago 280MB # base image + server jre
oraclelinux 7-slim 874477adb545 2 weeks ago 118MB # base image

Docker Image Oracle WebLogic 12.2.1.2-generic:

  • Required Docker Image Oracle Linux 7 with Oracle Server JRE
# get git oracle docker repo
git clone https://github.com/rlagutinhub/docker.weblogic-adminserver-app.git

# download weblogic 12.2.1.2 generic (https://www.oracle.com/middleware/technologies/weblogic-server-downloads.html)
cp fmw_12.2.1.2.0_wls_Disk1_1of1.zip ~/docker.weblogic-adminserver-app/distib/OracleWebLogic/12.2.1.2/

# create docker image weblogic:12.2.1.2-generic (all required packages installed from oracle repo yum.oracle.com)
cd ~/docker.weblogic-adminserver-app/distib/OracleWebLogic/
./buildDockerImage.sh -v 12.2.1.2 -g -s

# result
docker image ls
REPOSITORY          TAG                       IMAGE ID            CREATED             SIZE
oracle/weblogic     12.2.1.2-generic          eaaf52392276        5 days ago          2.78GB  # base image + server jre + wls
oracle/serverjre    8                         fca1db36746d        5 days ago          280MB # base image + server jre
oraclelinux         7-slim                    874477adb545        2 weeks ago         118MB # base image

# example run (for wls 12.2.1.2 to set the DOMAIN_NAME, you must set both DOMAIN_NAME and DOMAIN_HOME)
mkdir -p ~/docker/properties; cat <<EOF >  ~/docker/properties/domain.properties
username=weblogic
password=welcome1
EOF

docker run -dit \
 --name wls-app \
 --network bridge \
 -p 7001:7001/tcp -p 9002:9002/tcp \
 -v /root/docker/properties:/u01/oracle/properties \
 -e ADMINISTRATION_PORT_ENABLED=true -e DOMAIN_HOME=/u01/oracle/user_projects/domains/docker_domain -e DOMAIN_NAME=docker_domain \
 oracle/weblogic:12.2.1.2-generic

docker ps -a
docker logs wls-app --follow

JPA support
  • JPA (Java Persistent API) 2.1 it is automatically enabled on WebLogic 12.2.X but on WebLogic 12.1.3 JPA 2.1 has to be enabled manually Enabling JPA 2.1 in WebLogic Server 12.1.3 link link link
Properties

vim properties/domain_settings.properties

  • Base settings

Recommend administration_port_enabled=true (admin console access only from other port with force ssl) and recommend lower case for domain_name.

[Base]
keys=base
base.domain_name=mta4ru
base.admin_name=AdminServer
base.admin_listen_port=7001
base.production_mode=prod
base.administration_port_enabled=true
base.administration_port=9002
base.admin_console_enabled=true
base.derby_enabled=false
  • Security settings

Use only strong password 12-14 symbols wiki

[Security]
keys=sec
sec.username=weblogic
sec.password=welcome1
  • Java settings

Java settings are applied via env variables (setDomainEnv.sh not modifaed)

[Java]
keys=java
java.user_mem_args=-Xms1024m -Xmx1024m -Djava.security.egd=file:/dev/./urandom
java.java_options=-Dweblogic.configuration.schemaValidationEnabled=false -Dfile.encoding=UTF-8 -DCID=${CID} -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n -Djava.io.tmpdir=${ORACLE_HOME}/tmp/mta4ru/${CID}
  • Support wlst online modify Loggins settings

Move wls logs to single folder ${ORACLE_HOME}/Logs (the new location of the logs is not in DOMAIN_HOME, because if you use the mount volume, there will be an error files acl permission deny at creating domain). Add prefix docker ContainerID to wls logs filename (example AdminServer-123456789abc.log). Modify rotation settings for wls logs by file size and file count.

[Logging]
keys=admin access datasource diagnostic domain
admin.path=/Servers/AdminServer/Log/AdminServer
admin.file=/u01/oracle/logs/mta4ru/AdminServer.log
admin.fileMinSize=10000
admin.fileCount=50
admin.rotateLogOnStartup=True
access.path=/Servers/AdminServer/WebServer/AdminServer/WebServerLog/AdminServer
access.file=/u01/oracle/logs/mta4ru/access.log
access.fileMinSize=10000
access.fileCount=50
access.rotateLogOnStartup=True
datasource.path=/Servers/AdminServer/DataSource/AdminServer/DataSourceLogFile/AdminServer
datasource.file=/u01/oracle/logs/mta4ru/datasource.log
datasource.fileMinSize=10000
datasource.fileCount=50
datasource.rotateLogOnStartup=True
diagnostic.path=/Servers/AdminServer/ServerDiagnosticConfig/AdminServer
diagnostic.file=/u01/oracle/logs/mta4ru/diagnostic_images
diagnostic.fileMinSize=null
diagnostic.fileCount=null
diagnostic.rotateLogOnStartup=null
domain.path=/Log/mta4ru
domain.file=/u01/oracle/logs/mta4ru/base_domain.log
domain.fileMinSize=10000
domain.fileCount=50
domain.rotateLogOnStartup=True
  • Support wlst online create and modify Security Realm

When you created new Role Mapper with type weblogic.security.providers.authorization.DefaultRoleMapper (as in this example),at weblogic startup there will be the following issue <BEA-099503> <Evaluation of policy associated with role :Admin failed because the policy expression contains unregistered predicate: weblogic.entitlement.rules.AdministrativeGroup.>. Reason: dublicated Global Roles in Home >myrealm >Providers >ExampleAuthenticator >Providers >ExampleRoleMapper >Summary of Deployments >Summary of JDBC Data Sources >Summary of Security Realms >myrealm >Realm Roles. This issue can be ignored (in test only).

[SecurityRealmAuthenticationProviders]
keys=ExampleAuthenticator DefaultAuthenticator
ExampleAuthenticator.realm=myrealm
ExampleAuthenticator.name=ExampleAuthenticator
ExampleAuthenticator.type=weblogic.security.providers.authentication.DefaultAuthenticator
ExampleAuthenticator.ControlFlag=null
DefaultAuthenticator.realm=myrealm
DefaultAuthenticator.name=DefaultAuthenticator
DefaultAuthenticator.type=null
DefaultAuthenticator.ControlFlag=OPTIONAL

[SecurityRealmRoleMapping]
keys=ExampleRoleMapper
ExampleRoleMapper.realm=myrealm
ExampleRoleMapper.name=ExampleRoleMapper
ExampleRoleMapper.type=weblogic.security.providers.authorization.DefaultRoleMapper
  • Support wlst offline and online configuring datasources.
[DataSources]
keys=example1 example2
example1.url=jdbc:oracle:thin:@db.example.com:1521:example1
example1.user=example
example1.password=example
example1.Name=dsExample1
example1.jndiName=jdbc/dsExample1
example1.GlobalTransactionsProtocol=EmulateTwoPhaseCommit
example1.driver=oracle.jdbc.xa.client.OracleXADataSource
example1.MaxCapacity=50
example1.ConnectionCreationRetryFrequencySeconds=10
example1.TestTableName=SQL SELECT 1 FROM DUAL
example1.XaSetTransactionTimeout=True
example1.XaTransactionTimeout=7200
example2.url=jdbc:oracle:thin:@db.example.com:1521:example2
example2.user=example
example2.password=example
example2.Name=dsExample2
example2.jndiName=jdbc/dsExample2
example2.GlobalTransactionsProtocol=None
example2.driver=oracle.jdbc.OracleDriver
example2.MaxCapacity=50
example2.ConnectionCreationRetryFrequencySeconds=10
example2.TestTableName=SQL SELECT 1 FROM DUAL
example2.XaSetTransactionTimeout=null
example2.XaTransactionTimeout=null
  • Support wlst offline and online deploying libraries and applications.

When you offline (not online) deploy application (not library) to WebLogic, in the Admin Console the application' deployment type will be listed as "UNKNOWN" instead of "Web Application". This issue has no affect on your application.

[Deployments]
keys=jaxrs hello
jaxrs.name=jax-rs#[email protected]
jaxrs.type=Library
jaxrs.sourcePath=/u01/oracle/wlserver/common/deployable-libraries/jax-rs-2.0.war
jaxrs.securityDDModel=DDOnly
hello.name=hello
hello.type=AppDeployment
hello.sourcePath=/u01/oracle/files/hello.war
hello.securityDDModel=DDOnly

Run on Docker Standalone

automate:

./build-dev.sh

or manual:

# 1.rm
docker rm -f wls-app; docker image rm oracle/weblogic:12.2.1.2-generic_custom

# 2.app
./build-app.sh

# 3.image
./build.sh "properties" "scripts" "files" "Dockerfile" "oracle/weblogic:12.2.1.2-generic_custom" "."

# 4.container
# default graceful stop-timeout 10s then forcestop (kill -9)
docker run -dit --stop-timeout 120 --name wls-app --network bridge -p 7001:7001/tcp -p 9002:9002/tcp oracle/weblogic:12.2.1.2-generic_custom; docker logs --follow wls-app

Run on Docker Swarm Mode
  • For mount source mkdir -p /data/{logs,tmp} on docker host required chmod -R 0777 /data/{logs,tmp}

docker stack deploy --compose-file docker-compose.yml wls-hello

version: '3.7'
services:
  app:
    image: rlagutinhub/docker.weblogic-adminserver-app:12.2.1.2-generic_custom
    networks:
       - proxy
    volumes:
      - /data/logs:/u01/oracle/logs:rw
      - /data/tmp:/u01/oracle/tmp:rw
    configs:
      - source: hello_domain_settings.properties.2019-09-05
        target: /u01/oracle/properties/domain_settings.properties
    stop_grace_period: 2m
    deploy:
      # mode: global
      replicas: 1
      update_config:
        parallelism: 1
        delay: 10s
        order: start-first
        # order: stop-first
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 3
        window: 120s
      labels:
        # https://docs.traefik.io/configuration/backends/docker/#on-containers
        - "traefik.enable=true"
        - "traefik.port=7001"
        # - "traefik.weight=10"
        - "traefik.frontend.rule=Host:hello.example.com,hello.test.example.com"
        # - "traefik.frontend.rule=Host:hello.example.com,hello.test.example.com;AddPrefix:/hello;"
        - "traefik.frontend.entryPoints=http"
        # - "traefik.frontend.entryPoints=http,https"
        # - "traefik.frontend.headers.SSLRedirect=true"
        # - "traefik.frontend.auth.basic.users=root:$$apr1$$mLRjS/wr$$QqrALWNDgW9alDmnb9DeK1"
        # - "traefik.backend.loadbalancer.stickiness=true"
        - "traefik.backend.loadbalancer.method=wrr"
      placement:
        constraints:
          # - node.role == manager
          # - node.role == worker
          - node.labels.hello == true
networks:
  proxy:
    external: true
configs:
  hello_domain_settings.properties.2019-09-05:
    external: true

Quick setup
1. git clone https://github.com/rlagutinhub/docker.weblogic-adminserver-app.git # clone git repo
2. cd docker.weblogic-adminserver-app/ # cd git repo root folder
3. rm -f files/* # clean distrib folder
4. cp *.war *.jar *.ear files/ # copy new distrib files to distrib folder
5. vim scripts/runWLS.sh # uncomment and modify copy libraries jar files to ${ORACLE_HOME}/wlserver/server/lib/mbeantypes/ (line 183, only if required)
6. ./build.sh "properties" "scripts" "files" "Dockerfile" "oracle/weblogic:12.2.1.2-generic_custom.$(date +%F)" "." # build docker image
7. docker tag oracle/weblogic:12.2.1.2-generic_custom.$(date +%F) rlagutinhub/docker.weblogic-adminserver-app:12.2.1.2-generic_custom:latest # new tag for docker image
8. docker push rlagutinhub/docker.weblogic-adminserver-app:12.2.1.2-generic_custom:latest # push tagged image to docker hub
9. vim properties/domain_settings.properties # modify weblogic properties
10. docker config create example_domain_settings.properties.$(date +%F) properties/domain_settings.properties # create docker config
11. vim docker-compose.yml # custom docker-compose file
12. docker stack deploy --compose-file docker-compose.yml example # run

Result

https://raw.githubusercontent.com/rlagutinhub/docker.weblogic-adminserver-app/master/example.run.log

Tag summary

Content type

Image

Digest

Size

2.3 GB

Last updated

almost 7 years ago

docker pull rlagutinhub/docker.weblogic-adminserver-app:12.2.1.2-generic_custom