IBM Cloud Docs
Deploy a Java Liberty app by using IBM Cloud Schematics

Deploy a Java Liberty app by using IBM Cloud Schematics

In this tutorial, you learn how to create and deploy a scalable Java Liberty application. This scalable web app offers a one-click option to create an IBM Cloud® Schematics workspace with your choice of preconfigured Terraform templates. The Terraform templates deploy your app to IBM Cloud with options for the deployment target (Kubernetes or Red Hat® OpenShift®) and the DevOps toolchain pipeline structure.

IBM Cloud Schematics delivers Terraform-as-a-Service so that you can use a high-level scripting language to model the resources that you want in your IBM Cloud environment, and enable Infrastructure as Code (IaC). Terraform is an open source software that is developed by HashiCorp that enables predictable and consistent resource provisioning to rapidly build complex, multitier cloud environments.

In this tutorial, you follow two easy steps to create a Schematics workspace and apply a Terraform execution plan. When you apply the plan, a Kubernetes or OpenShift cluster is created, and a Java Liberty application is deployed to it by using an IBM Cloud DevOps toolchain.

Two types of DevOps toolchain pipeline structures are available with this app:

  • Classic pipeline structure
  • Tekton "GitSecure" pipeline structure

Both toolchain template options offer a code repository, delivery pipelines, and web IDE.

Before you begin

Create a Schematics workspace

  1. Click one of the following options for the cluster deployment target and toolchain pipeline type. This action takes you to the Deploy to IBM Cloud page where you create a Schematics workspace. Complete the required fields on that page, and then click Next.

    The following options use the simple-helm-toolchain template, which uses a Classic pipeline structure.

    Deploy to Kubernetes on IBM Cloud Deploy to OpenShift on IBM Cloud

    The following options use the secure-kube-toolchain template, which uses a Tekton pipeline structure.

    Deploy to Kubernetes on IBM Cloud (secured) Deploy to OpenShift on IBM Cloud (secured)

    Based on which option you select, the corresponding Terraform template from this repository is automatically imported into the new Schematics workspace. The Terraform engine version is v1.3.

  2. Verify the information, and then click Create. The Schematics workspace is created, and the Settings page for the Schematics workspace is displayed.

Apply the Terraform execution plan

  1. In the Variables section of the Schematics Settings page, enter the values for each variable. Required fields are the fields without default values. However, default values can be overridden.
  2. Optional. Click Generate plan. This action creates a Terraform execution plan and checks your configuration for syntax errors. On the Schematics Activity page, you can review log files for errors and IBM Cloud resources that must be created, modified, or deleted to achieve the state of the Terraform template.
  3. After you enter all the values for the variables and are satisfied with the changes, click Apply plan. This step takes some time to complete (usually 20 - 30 minutes, but it can take longer), due to the creation of a new Kubernetes or OpenShift cluster.
  4. Follow the progress of this step by clicking the View log link next to the corresponding step.
  5. After the plan is successfully applied, view the URL to the generated IBM Cloud DevOps toolchain. The URL is located near the end of the log file on a line that begins with View the toolchain at:.
  6. Copy and paste the URL into a browser search bar to view the newly created toolchain.
  7. On the toolchain's Overview page, click ci-pipeline in the Delivery pipelines card.
  8. Check the status of your application by choosing one of the following options, depending on whether you ran a Classic or a Tekton pipeline:
    1. Classic pipelines: On the Delivery Pipeline page, check the status of the Deploy stage.
      • If the status is Stage Passed, click the "Passed" link that is next to the deploy job to open the log file. In the log file, locate the string VIEW THE APPLICATION AT:, and then click the URL.
      • If the status is Stage Failed, click the Play icon Play icon to run the stage again.
    2. Tekton pipelines: On the ci-pipeline Dashboard page, check the Status column in the table.
      • If the status is Succeeded, click the name of the pipeline run, and then click the execute step in the deploy-to-kubernetes task. The task deploys the app into the Kubernetes cluster. In the log file, locate the string VIEW THE APPLICATION AT:, and then click the URL.
      • If the status is Failed, click the Action menu Action menu for the pipeline run, and select Rerun. Alternatively, click Run pipeline, and then click Rerun on the Run Pipeline page.

If you apply your plan a second time, the previously created Kubernetes or OpenShift cluster and any applications that are deployed to it are deleted, and a new cluster is created.