<meta name=" dcterms.product"="">

Oracle by Example branding Deploy and Undeploy an Application on WebLogic for OKE Using Jenkins

section 0Before You Begin

This 15-minute tutorial shows you how to deploy two applications and undeploy an application with WebLogic Deploy Tooling (WDT) artifacts using the Jenkins pipeline job.

Background

Oracle WebLogic Server for Oracle Cloud Infrastructure Container Engine for Kubernetes (OKE) uses the Jenkins pipeline update domain job to update the domain configuration and deploys applications, shared libraries and resources to the new domain. In the update domain job, you specify the location of the WDT archive zip file, domain model Yaml and variables properties file using File Upload, Object Storage, or the Shared File System, and build the job.

This tutorial uses the update domain job to deploy two applications simpleear1 and simpleear2 using the WDT archive zip file that contains the model Yaml file, and then uses the update domain job to undeploy the simpleear2 application.

Note: If the UI parameters are not rendered when you run the update domain job, approve the scripts. See Approve Scripts.

What Do You Need?

  • An Oracle WebLogic Server for OKE stack created using Resource Manager
  • An application ear or war file
  • A model.yaml file created using the WDT template
  • The following example shows the  model.yaml file that uses WDT template to deploy ear files. In this  model.yaml file, replace simpleear1.ear and simpleear2.ear (ear files) with your application archive file name and the my-cluster (target file) with the name of your cluster.

    appDeployments:
        Application:
            simpleear1 :
                SourcePath: wlsdeploy/applications/simpleear1.ear
                Target: 'my-cluster'
                ModuleType: ear
    simpleear2 :
    SourcePath: wlsdeploy/applications/simpleear2.ear
    Target: 'my-cluster'
    ModuleType: ear

    To deploy a war file, change the module type to ModuleType: war in the model.yaml file, and for jar file, change the module type to ModuleType: jar in the model.yaml file.

section 1Deploy the Applications

    To deploy the applications, use the following model.yaml file:

appDeployments:
    Application:
        simpleear1 :
            SourcePath: wlsdeploy/applications/simpleear1.ear
            Target: 'my-cluster'
            ModuleType: ear
simpleear2 :
SourcePath: wlsdeploy/applications/simpleear2.ear
Target: 'my-cluster'
ModuleType: ear

  1. From your computer, run the SSH command to connect to the stack's Administration Server as the opc user.
  2. ssh -i path_to_private_key -o ProxyCommand="ssh -W %h:%p –i path_to_private_key opc@bastion_public_ip" opc@admin_ip

  3. Go to /u01/shared location and run the following commands to create an archive.zip with WDT model.yaml.
    mkdir -p wlsdeploy/applications
    mv your-app.ear wlsdeploy/applications
    mv your-app1.ear wlsdeploy/applications
    # For ear file, use your-app.ear and for jar file, use your-app.jar.
    mkdir -p model mv path_to_your_model.yaml/your-model.yaml model/model.yaml zip -r archive.zip wlsdeploy/applications/ model/model.yaml
  4. Sign in to the Jenkins console for your domain. See Access the Jenkins Console.
  5. On the Dashboard page, click update domain.
  6. Click Build with Parameters.
  7. From Domain_Name, select the domain for which you want to deploy the applications.
  8. Select Shared File System from the Archive_Source list.
  9. For Archive_File_Location, specify the path of the archive zip file on the admin host /u01/shared/path_to_your_archive.zip/archive.zip.
  10. Click Build.

section 2 Access the Deployed Applications

  1. From your computer, run the SSH command to connect to the stack's Administration Server as the opc user. 
  2. ssh -i path_to_private_key -o ProxyCommand="ssh -W %h:%p –i path_to_private_key opc@bastion_public_ip" opc@admin_ip

  3. Run the kubectl command to get the external load balancer IP address.
  4. kubectl get svc -A
  5. Access the deployed applications using the following URLs:
    https://external_lb_ip/simpleear1
    https://external_lb_ip/simpleear2 

section 2 Undeploy the Application

    To undeploy the simpleear2.ear application, use the following model.yaml file:

    appDeployments:
        Application:
            simpleear1 :
                SourcePath: wlsdeploy/applications/simpleear1.ear
                Target: 'my-cluster'
                ModuleType: ear        

  1. From your computer, run the SSH command to connect to the stack's Administration Server as the opc user.
  2. ssh -i path_to_private_key -o ProxyCommand="ssh -W %h:%p –i path_to_private_key opc@bastion_public_ip" opc@admin_ip

  3. Go to /u01/shared location and run the following commands to create an archive1.zip with WDT model.yaml
    zip -r archive1.zip wlsdeploy/applications/ model/model.yaml
  4. Sign in to the Jenkins console for your domain. See Access the Jenkins Console.
  5. On the Dashboard page, click update domain.
  6. Click Build with Parameters.
  7. From Domain_Name, select the domain for which you want to undeploy the application.
  8. Select Shared File System from the Archive_Source list.
  9. For Archive_File_Location,, specify the path of the archive zip file on the admin host /u01/shared/path_to_your_archive1.zip/archive1.zip.
  10. Click Build.

more informationWant to Learn More?



ield