2 Setup the Environment

Before you start the deployment, install the prerequisite software and setup the environment.

You need to build the AMC container image using AMC ear file. See Create the AMC Container Image.

Prerequisites

The following are the prerequisites to deploy the Containerized AMC:

  • Familiarity with Containers, Kubernetes, and Helm
  • Ability to setup the Kubernetes cluster
  • Availability of Oracle DB or MySQL database
  • Access to Oracle Container Registry (OCR)
  • Java SE Subscription license to download AMC ear from Oracle Technology Resources (OTN) or My Oracle Support (MOS)
  • Privilege to perform common administrative tasks on Database

System Requirements

System requirements to deploy WebLogic Kubernetes Operator (WKO) and Containerized AMC.

  • Prerequisites for WKO release: See WKO Prerequisites
  • Setup either of the following database, which is ready to accept external connections from AMC application:
    • Oracle DB: 19c, 12c, or 11g
    • MySQL: 8, 5.7, or 5.6
  • WebLogic Cluster, as a publicly accessible Kubernetes Service, must be accessible from all agent machines

    Note:

    Change in the host name provided at the time of AMC initialization might stop AMC Agent to communicate with the server and block agent bundle downloads.
  • WKO deployment in Kubernetes Cluster
  • Kubernetes worker nodes must have internet access as AMC connects to external network to fetch Java release information
  • All agents must be able to access the server

Environment Setup

You need to setup the environment for seamless deployment of Containerized AMC.

Ensure you have the following environment setup:

Create the AMC Container Image

You can use WebLogic Image Tooling (WIT) to create the AMC Container Image.

This topic provides a high level procedure to create the AMC container image. For detailed instructions, see Image Creation Guide.

Note:

  • Ensure that the operating system user has adequate permissions to perform install and deploy commands. Use sudo or sudo -E commands as required.
  • The folder names mentioned in this topic are for illustrative purposes. You can name the folders as per your requirement.
  1. Create a working folder model-images.
    Example Command:
    $ mkdir model-images
    $ cd model-images/
  2. Download latest version of WIT and place it in model-images folder. Extract the zip into this folder.
  3. Download the latest version of WebLogic Deploy Tooling (WDT) and place it in the model-images folder.
  4. Download the WebLogic container image from Oracle Container Registry. You need to accept the license by accessing Oracle Container Registry in a browser before proceeding. This is a one time requirement.
    Use the following command to download the WebLogic container image:
    docker login container-registry.oracle.com
    docker pull container-registry.oracle.com/middleware/weblogic:12.2.1.4
    Example Command:
    $ docker login container-registry.oracle.com       
    Username: <abc>        
    Password: <123>
    $ docker pull container-registry.oracle.com/middleware/weblogic:12.2.1.4
  5. Create the archive-AMC inside the model-images folder to save the AMC application bundle. The folder structure within archive-AMC must be wlsdeploy/applications. WDT archives have a well-defined directory structure, which always has wlsdeploy as the top directory. Download the latest AMC EAR (JavaAMC-2_20.ear) from AMC download page. Save the file in the wlsdeploy/applications folder.
    Example Command:
    $ mkdir archive-AMC
    $ cd archive-AMC
    $ mkdir -p wlsdeploy/applications
    $ cp JavaAMC-2_20.ear wlsdeploy/applications/
    $ zip -r archive.zip wlsdeploy
  6. Export JAVA_HOME:
    export JAVA_HOME=</jdk/home/>
    Example Command:
    $ export JAVA_HOME=/usr/java/jdk1.8.0_271-amd64
  7. Cache the WDT for successful image creation using the following command from the model-images directory:
    
    $ cd model-images 
    ./imagetool/bin/imagetool.sh cache addInstaller \  
    --type wdt \  
    --version latest \  
    --path ./weblogic-deploy.zip
  8. Stage the model files. Copy the following code snippet into a model.amc.yaml file and save it in the model-images folder.
    Sample model.amc.yaml file:
    # Copyright (c) 2020, Oracle Corporation and/or its affiliates.
    # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
    
    domainInfo:
        AdminUserName: '@@SECRET:__weblogic-credentials__:username@@'
        AdminPassword: '@@SECRET:__weblogic-credentials__:password@@'
        ServerStartMode: 'prod'
    
    appDeployments:
        Application:
            JavaAMC:
                SourcePath: 'wlsdeploy/applications/JavaAMC-2_20.ear'
                ModuleType: ear
                Target: '@@ENV:AMC-CLUSTER-NAME@@'
        Library:
            'jax-rs#2.0@2.22.4.0':
                SourcePath: '@@WL_HOME@@/common/deployable-libraries/jax-rs-2.0.war'
                ModuleType: war
                Target: '@@ENV:AMC-CLUSTER-NAME@@'
  9. Build the image using WIT:
    
    ./imagetool/bin/imagetool.sh update \
      --tag amc-<version>:latest \
      --chown oracle:root \
      --fromImage container-registry.oracle.com/middleware/weblogic:12.2.1.4 \
      --wdtModel      ./model.amc.yaml \
      --wdtArchive    ./archive-AMC/archive.zip \
      --wdtModelOnly \
      --wdtDomainType WLS

    The fromImage is the WebLogic container image that is referenced from Oracle Container Registry.

    Example Script:
    #!/bin/bash
    wls_image="container-registry.oracle.com/middleware/weblogic:12.2.1.4"
    
    ./imagetool/bin/imagetool.sh update \
      --tag amc2u20:latest \
      --chown oracle:root \
      --fromImage ${wls_image} \
      --wdtModel      ./model.amc.yaml \
      --wdtArchive    ./archive-AMC/archive.zip \
      --wdtModelOnly \
      --wdtDomainType WLS
The image is successfully built and following message appears:
[INFO ] Build successful. Build time=36s. Image tag=amc2u20:latest

Also, run the container (docker) image commands to verify if the image is created successfully.

Distribute the Image to all Kubernetes Nodes

The AMC container image is built on one machine. During deployment, the image must be available on all Kubernetes nodes.

To distribute the image to all Kubernetes nodes, push the image to a private container registry and pull the image from this registry during deployment. If the registry is not available, then you can distribute the image using the Save and Load method.

Follow these steps to distribute the image to all cluster nodes using the Save and Load method:
  1. From the machine where the image is built, save the image as a tar file using the command:
    docker save <amc2u20:latest> -o <amc2u20>.tar 

    Note:

    Ensure that you use the same <repo/image:tag> (for example, <amc2u20:latest>) while configuring the parameters in the deployment configuration file. This configuration file is referred to as custom-values.yaml file in this deployment guide.
  2. Copy the tar file to all the node machines using the command:
    scp <amc2u20>.tar <user>@<machine>:/home/<user>/
    If you are using ssh key-based authentication, use the command:
    scp -i private_key <amc2u20>.tar <user>@<machine>:/home/<user>/
  3. On the Kubernetes node machines, load the image using the following command:
    cat <amc2u20>.tar | docker load