Basics 6 - Deploying a Typical Java Enterprise Application

Article ID:360033187451
5 minute readKnowledge base

In this module, you will learn how to deploy an enterprise application. This tutorial presents the following information:

  • Describe the structure of the application.

  • Define the application tiers and application processes.

  • Describe the jpetstore application and deploy it.

The steps below describe how to deploy a typical Java application as demonstrated in the video.

Typical Java Application

Let’s first look at the application model of a typical Java application.

  1. In the Home page, click Applications.

  2. In the Applications List, click jpetstore‐app .

    The Applications Visual Editor opens.

    The application model consists of the following objects:

    • Application tier: A tier is a logical grouping of components.

    • Component: The output or result deploying an application in CloudBees CD (CloudBees Flow). It can be used by other procedures or applications, or it can be part of your continuous delivery solution.

    • Component process: A group of steps or actions taken on a component when the CloudBees CD (CloudBees Flow) application is deployed.

The jpetstore‐app application has these objects:

  • Components : The App Server tier has the jpetstore‐mysql.war component, which is used to deploy the jpetstore website. The DB tier has the dataload component, which can retrieve the files used to create jpetstore‐mysql.war.

    To see the component details for jpetstore‐mysql.war, click the Menu button () in the jpetstore‐mysql.war component and select Details . The component is based on the jpetstore‐ mysql.war artifact version 1.

  • Component processes : The jpetstore‐mysql.war component has two component processes, Deploy and Undeploy .

    To see the Deploy component process model, click the down arrow in the component and select Deploy .

    The Component Process Visual Editor opens and displays the component process model. The steps in the component process can be defined by a component, plugin, command, or procedure.

    To see the details of the "unzip war" step, click the Edit button () in the step and select Details .

    The Component Process Step dialog box shows that the step is defined by the FileOps plugin and its procedure called "Unzip File." This step unzips the jpetstore‐mysql.war zip file and puts it in the ./jpetstore‐mysql directory.

Application Process Model

Now that we have defined the components, let’s look at the application process model. It consists of process steps that can be defined by:

  1. In the Applications List, go to the jpetstore‐app row, click on the down arrow next to the number of application processes, and select Deploy .

    The Applications Process Visual Editor opens and displays the application process model.
    The application process model consists of these objects:

    • An application process with one or more steps.

    • A step is defined by a component operation, a plugin, a command or script, or a procedure. (Start and End steps are automatically created when you create an application process.)

    • Steps can run serially or in parallel.

    • CloudBees CD (CloudBees Flow) uses transitions between steps to decide the next step in the process.

    • The default transition state is Always (), which means that when the previous step is completed, the process progresses to the next process step automatically.

    • Other transitions can be set:

    • Successful: The process progresses to the next step if the previous step was successful.

    • Failure: The previous step fails, the process fails, and CloudBees CD (CloudBees Flow) sends the administrator an email about the failure.

    • Add condition +: The process progresses to the next step if the previous step meets a custom condition.

    • To see the details of the "Deploy App" step, click the Edit button () in step and select Details .

      The Application Process Step dialog box shows that the step is defined by the JBoss plugin and its procedure called "DeployApp." This step deploys the application and specifies where to find the WAR files.

      To make it easier to find the application when it is deployed, you can enter "jpetstore" in the Deployment Name field.

    • To add a step the process, click the Add Step () button and drag it to where you want to add it in the process.

      The Application Process Step dialog box opens, where you define the new step.

    • Tier Maps

    • Let’s look at the tier maps now. The application must be mapped to an environment before the application can be deployed.

      In the Applications List, go to the jpetstore‐app row, click on the down arrow next to the number of tier maps, and select map1.

    • image::Basics_6_-_Deploying_a_Typical_Java_Enterprise_Application/5d6983959d2c9.png[]

    • The tier map for the jpetstore‐env environment appears. It shows the mapping between the application tiers in jpetstore‐app and the environment tiers in jpetstore‐env.

      • The processes run in App Server tier will be deployed to the Wildfly environment tier.

      • The processes run in the DB tier will be deployed to the MariaDB environment tier.

    • Deploying the Application

    • Let’s deploy the application.

      1. Go to the Applications List.

      2. In the jpetstore‐app row, click on green Run Process button () and select New Run .

        The dialog box to specify the settings for the application run opens.

      3. Select Deploy in the Select Process field.

      4. Select jpetstore‐env in the Select Environment field.

      5. The Artifact field is enabled because New Run was selected in the previous step. Click the right arrow to see the artifacts that can be deployed with the application.

        The application has two artifacts: jpetstore‐mysql.war to build the website and jpetstore‐mysql‐ database.sql that has the files for the .war file.

        The jpetstore‐app application does not have any snapshots or parameters to deploy it so the "Select a Snapshot" and Parameters row are disabled (in gray).
      6. You can set Smart Deploy to On or Off . Set Smart Deploy to On .

        When Smart Deploy is On , CloudBees CD (CloudBees Flow) deploys only the artifacts that have been changed or are a different version than the deployed artifacts.

        When the Smart Deploy is Off , CloudBees CD (CloudBees Flow) deploys all the artifacts for this application run.

      7. Click OK to deploy the application.
        The Applications / View Run page shows the application’s progress.

      8. To see more information about a specific object in the application, click the View Detail button ().

        When you click this button for the application, the Job Details page opens and shows the full details of the job.

      9. To get more information on some objects, click the Log button.
        When you click this button for the DeployApp procedure, the Job Details page for that object opens and shows the run details of the procedure.

    • Verifying the Environment Where the Artifacts are Deployed

    • Let’s verify the environment to which the application was deployed.

      1. In the Applications / View Run page, click the environment name on the top of the page.
        The Environments Visual Editor opens.

      2. Click Environments in the upper left corner to go to the Enviroments List.

      3. In the jpetstore‐env row, click the Inventory button () to go to the Environment Inventory.

      4. In the jpetstore‐app row, click the Expand button () to see the list of artifact versions deployed with details.

    • (1) Component name
      (2) Artifact name
      (3) Artifact version
      (4) Name of the environment tier
      (5) When the artifact was last deployed

    • image::Basics_6_-_Deploying_a_Typical_Java_Enterprise_Application/5d6983a60e56d.png[]

    • Verifying that the Application is Up and Running

      1. In a browser, go to localhost:8080/jpetstore‐mysql/. The application was successfully deployed when you see this:

      2. Click Enter the Store.

    • What’s next

    • Create and run more application deployments.

    • To learn more, go to the support site