DevOps Automation

 View Only

Auto-Discovery with WebLogic

By Osman Burucu posted Thu January 05, 2023 11:45 AM

  

This article was originaly published in 2017.12.01

Auto-Discovery with WebLogic

The Oracle WebLogic WLDeploy plugin provides the ability to automatically discover a WebLogic installation on an agent, and subsequently provision the environment in IBM UrbanCode Deploy. The plugin's auto-configuration step will create resources for each domain, cluster, and server found in a WebLogic installation. This post will discuss the process for allowing your WebLogic topology to be automatically configured using IBM UrbanCode Deploy.

  Role Permissions in IBM UrbanCode Deploy

Before you get started, there are a few required permissions that we must make sure are set on the UC Auto Discovery and UC Auto Configure roles in UCD. These two roles are meant to be used for auto-discovery and auto-configuration. However, in certain versions of IBM UrbanCode Deploy you must add the 'Manage Properties' permission for resources. You can ensure that this permission is set on both roles from the Settings -> Role Configuration page in IBM UrbanCode Deploy. After you have navigated to the role configurations, select the UCD Auto Configure role. Next, click to the Resource selection and expand the Edit permissions for standard resources. 

Permissions


Ensure that the Manage Properties field is checked on the Resource.

After you've validated the permission settings for the UC Auto Configure role, repeat the process for the UC Auto Discovery role. If you are missing a required permission the Auto-Discovery process will output relevant error messages outlining what permissions are missing.

Auto Discovery role is missing the Manage Properties permission on resources.

UC Auto Discovery role is missing the Manage Properties permission on resources.

Properties for Auto-Discovery

The auto-discovery task will search different directories for the 'weblogic.jar' file. If it locates the file, a new 'WebLogic-Installation' resource will be created under the agent resource. The process utilizes a few different options for discovering a weblogic installation. These options are listed in order of precedence, meaning that if the first option is being utilized, all others will be ignored:

    1. You may set the 'wldeploy.path' agent property on the agent. This property must be set as the absolute path of the 'weblogic.jar' file on your agent machine.
    2. Otherwise, you may set the 'wldeploy.mwHome' agent property on the agent. This is to be set to your middleware home on the agent machine. Often, this is the parent directory of your web logic server.
Setting the wldeploy.path agent property.

 Setting the wldeploy.path agent property.

  1. If none of the above fields are configured, the auto-discovery task will acquire the 'MW_HOME' environment variable from the agent machine directly if it is set. This option requires no property configurations on UCD.
  2. After exhausting all of the above options, the task will search a few common installation directories listed below.

If the 'wldeploy.path' field, the 'wldeploy.mwHome' field, and the 'MW_HOME' environment variable are all not set the discovery task will search through a few common installation directories. If the agent is a Windows machine, it will recursively search:

  • C:\Program Files\Oracle\Middleware
  • C:\Program Files (x86)\Oracle\Middleware

If the agent is a Linux/Mac machine, the auto-discovery task will search:

  • /opt/wls

These are just the most common installation locations, and hence the default search locations. It is very possible that WebLogic may be installed in a different location on the file system. In this case, you must use one of the other options described earlier.

Running Auto-Discovery


Once properties are configured to actually run auto-discovery, executing the task is fairly simple. In the 'Resources' tab on UrbanCode Deploy create a new or use an existing top level resource group, and then add your WebLogic agent to that group. Assuming the WLDeploy plugin is installed, this will kick off the auto-discovery process, which you can view under the History tab of your agent resource.

The auto-discovery process during execution.


The auto-discovery process during execution.
After the auto-discovery process completes, you will have a new resource named 'WebLogic-Installation' under your agent in the Resources tab.

newly created WebLogic-Installation resource.
The newly created WebLogic-Installation resource.

Running Auto-Configuration

Now that you have successfully ran auto-discovery, it is time to execute the auto-configuration process. This process will replicate your WebLogic topology as a resource tree in IBM UrbanCode Deploy. A bit more information is required to access all of the domains, clusters, and servers. To provide this required information we will configure the WebLogic-Installation resource with the necessary properties. To configure your WebLogic-Installation resource, click the edit resource button and you will be able to fill out the required properties.
Configuring the Weblogic-Installation resource for auto-configuration.
Configuring the Weblogic-Installation resource for auto-configuration.

You'll notice that there are two fields for URLs. The reason for this is that both fields are configured on the top level of the WebLogic resource tree. Both the WLDeploy and WebLogic-WLST plugin steps will have access to these properties.

One is called the 'Administration URL' and the other is called the 'JMX Administration URL'. Essentially, these two properties are the same with only one difference. The JMX Administration URL is utilized in the WLDeploy plugin to aqcuire an MBeanServerConnection object, which must be acquired using the format 'service:jmx:t3://localhost:7001'. Note that if you only specify the 't3://localhost:7001' portion, the JMX service will be prefixed for you.

The other URL field, 'Administration URL', is just the administration URL without the prefixed JMX service. This field is used in all of the WebLogic-WLST plugin steps. This plugin doesn't create an MBeanServerConnection, instead connecting directly to the administration server. It is recommended to configure both of these fields if you are planning on using both the WebLogic-WLST and WLDeploy plugins.

After you have configure all of the desired properties on the WebLogic-Installation resource, run the 'Configure Using WL Auto-Configure' task.

Executing the auto-configuration task on a WebLogic-Installation resource.

Executing the auto-configuration task on a WebLogic-Installation resource.

After the auto-configuration completes and you refresh your resources, you will have a fully provisioned resource tree of all of your domains, servers, and clusters directly under the WebLogic-Installation resource.

WebLogic resources created under the WebLogic-Installation resource.

WebLogic resources created under the WebLogic-Installation resource.


Using the Resource Tree

Each component added to the resource tree will have access to all resource properties of parents in the resource hierarchy. These properties get created on the corresponding resources during the auto-discovery and auto-configuration tasks. All created resource properties, listed with the resource on which they are created:

  • WebLogic-Installation
    • wldeploy.url (The Administration URL)
    • wldeploy.jmxUrl (The JMX URL)
    • wldeploy.user (The username to login to the administration console)
    • wldeploy.password (The password to login to the Administration console
    • wldeploy.userkeyfile (The decryption key for the configuration file.
    • wldeploy.path (The path to the WebLogic WLDeploy Ant Task JAR or full client JAR file.
  • WebLogic-Domain
    • wldeploy.domain (The name of the WebLogic domain)
  • WebLogic-Server
    • wldeploy.targets (The name of the WebLogic server instance)
  • WebLogic-Cluster
    • wldeploy.targets (The name of the WebLogic cluster)
Adding a 'Sample.war' component to a server in the resource tree.

 Adding a 'Sample.war' component to a server in the resource tree.

In the above example, I have added the 'Sample.war' component to the 'AdminServer' WebLogic-Server resource. This will effectively allow the 'Sample.war' component to reference all resource properties of the AdminServer, base_domain, and WebLogic-Installation resources. Now, I can utilize any of these properties on a component process in the 'Sample.war' component using the syntax '${p?:resource/wldeploy.url}' for example.

Component process step to utilize resource properties.


Component process step to utilize resource properties.

You'll notice that both the WLDeploy and WebLogic-WLST plugins use the same default property values on all steps. This is so the benefits of auto-discovery and auto-configuration can be useful in both plugins.


#UrbanCodeDeploy
#weblogic
0 comments
2 views

Permalink