dockerweblogic12coracle-fusion-middleware

creating new managed server containers in Weblogic 12c docker


I followed the Oracle docs and managed to set up a running Weblogic Fusion Middleware Infrastructure Container with one Managed server..

I deployed an ADF application and it works perfectly fine ..

But now I am stuck because I cant add more Managed servers in the cluster.

The following command was used to start the managedserver1 which works perfectly..

docker run -d -p 9801:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraServer.env.list container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.x startManagedServer.sh

here is the startManagedServer.sh script :

#!/bin/bash

# Copyright (c) 2014-2017 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.
#

export adminhostname=$adminhostname
export adminport=$adminport


# First Update the server in the domain
export server="infra_server1"
export DOMAIN_ROOT="/u01/oracle/user_projects/domains"
export DOMAIN_HOME="/u01/oracle/user_projects/domains/InfraDomain"

echo $adminhostname
echo $adminport
echo "DOMAIN_HOME: $DOMAIN_HOME"

/u01/oracle/oracle_common/common/bin/wlst.sh -skipWLSModuleScanning /u01/oracle/container-scripts/update_listenaddress.py $server
retval=$?

echo  "RetVal from Update listener call  $retval"

if [ $retval -ne 0 ];
then
    echo "Update listener Failed.. Please check the  Logs"
    exit
fi

# Start Infra server
mkdir -p /u01/oracle/logs
$DOMAIN_HOME/bin/startManagedWebLogic.sh $server "http://"$adminhostname:$adminport > /u01/oracle/logs/startManagedWebLogic$$.log 2>&1 &
statusfile=/tmp/notifyfifo.$$

mkfifo "${statusfile}" || exit 1
{
    # run tail in the background so that the shell can kill tail when notified that grep has exited
    tail -f /u01/oracle/logs/startManagedWebLogic$$.log &
    # remember tail's PID
    tailpid=$!
    # wait for notification that grep has exited
    read templine <${statusfile}
                        echo ${templine}
    # grep has exited, time to go
    kill "${tailpid}"
} | {
    grep -m 1 "<Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>"
    # notify the first pipeline stage that grep is done
        echo "RUNNING"> /u01/oracle/logs/startManagedWebLogic$$.status
        echo "Infra server is running"
    echo >${statusfile}
}

# clean up
rm "${statusfile}"
if [ -f /u01/oracle/logs/startManagedWebLogic$$.status ]; then
echo "Infra server has been started"
fi

#Display the logs
tail -f $DOMAIN_HOME/servers/infra_server1/logs/infra_server1.log

childPID=$!
wait $childPID

I did manage to add the Managed-Servers in the weblogic admin console by editing createorstartInfraDomain.sh and createInfraDomain.py

However editing the StartManagedServer.sh file for Infra_Server2 is not working..

Even after editing or even completely deleting the file startManagedServer.sh from the admin container the following command still works:

docker run -d -p 9801:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraServer.env.list container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.x startManagedServer.sh

The following is what i get in the console :

root@Linux-Vostro-3250:/home/amalv/FMW-Infrastructure_Docker# docker run -p 9801:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list oracle/fmw-infrastructure:12.2.1.0 startManagedServer.shInfraAdminContainer
7001
DOMAIN_HOME: /u01/oracle/user_projects/domains/InfraDomain

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

/u01/oracle/container-scripts/update_listenaddress.py called with the following sys.argv array:
sys.argv[0] = /u01/oracle/container-scripts/update_listenaddress.py
sys.argv[1] = infra_server1
c697c81b15c8
172.18.0.4
/u01/oracle/user_projects/domains/InfraDomain
INFO: SeedingConfigurationProcessor.start, finished.
INFO: SeedingConfigurationProcessor.end, finished.

whatever i do with the startManagedServer.sh I get the above log with "sys.argv[1] = infra_server1".

Can someone help me with this!!

Thanks a lot


Solution

  • Here is what i did that helped me to set up Multiple managed servers .

    alternatively you can mount the edited files into container in docker run command.

    I edited the createInfraDomain.py and createOrStartInfradomain.sh files in the container-scripts to create 6 infra-servers.This will create 6 infraserver instances and you will be able to see it in the weblogic console.

    Now use the following command to start the first Managed Server container:

    docker run -d -p 9802:8001 --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previously-committed-image startManagedServer.sh

    For startning a new managed server container I edited the startManagedServer.sh file and changed the server value to infra_server2 and ran the following command:

    docker run -d -p 9802:8001 -v /path(or)location/of/edited/cotainer-scripts/in/your/hostSystem:/u01/oracle/container-scripts --network=InfraNET --volumes-from InfraAdminContainer --name InfraManagedContainer --env-file ./infraserver.env.list previously-committed-image startManagedServer.sh
    

    For every new container I changed the server name in startNodeManager.sh and mounted it to the container in docker run command..

    I am sure there is a much simpler way to add more servers may be by using WLST scripting to add server instances in weblogic.. and also to start new managed server containers..

    if anyone knows please let us know.

    Thanks!!