Basics 2 - Application Modeling

See It

This is an example of application modeling. 

Now Try It Yourself

In this module, you will learn how to:

  • Model an application containing two tiers (for an App Server and a database) and two components (one in each tier).
  • Define a Deploy process for the individual components and for the whole application.
  • Map the application to the environment in which the application is deployed.

The steps below describe how to model applications as demonstrated in the video. 

Let's model a new application.

Step 1: Create an application.

  1. Go to the Applications List.
  2. Click Add + to add an application.
  3. In the dialog box, select Create new Application > Create new app.
  4. Enter "SF Application" in the Name field and click OK.
    The default tier is created in the Applications Visual Editor for SF Application.
  5. Click the Edit button () next to "Tier 1".
  6. Change the tier name from the default (Tier 1) to "App Server" and click OK.

    We have created the "App Server" tier in the "SF Application" application.

    Next, we will add a WAR file as a component in this tier.

Step 2: Add a component to an application tier.

  1. Click + in the App Server tier.
  2. In the dialog box, click Create from new application component.
  3. Enter "Storefront war" in the Name field and click Next.
  4. In the Component Details dialog box, enter the component details.
    ElectricFlow supports artifacts from different types of locations: an external repository like Maven, the file system or an artifact stored in ElectricFlow repository.
    In this tutorial, we will use Maven.
  5. In the Content Location field, click the down arrow and select EC-Maven.
    Let's take a look at where this artifact lies in the repository. In the browser, go to http://54.153.51.90:8080/#welcome, and navigate to Storefront war version 1.0.0.
  6. Enter the artifact details to define the component in the "SF Application" application.
    • For public server URL: http://54.153.51.90:8080/content/repositories/
    • For Repository: ecfe
    • For Artifact: ecfe.storefront
    • For Version, select Exact and enter "2.0.0"
    • For Artifact Extension: .war
    • For Retrieve to Directory: /var/temp
  7. Click OK.

Step 3: Create another tier for this application – a database tier.

  1. In the Applications Visual Editor, click the Add tier () button in the upper right corner to create a new application tier.
  2. In the Application Tier Details dialog box, rename the tier as "DB" and click OK.

    Next, we will define the component using a master component. Master components are template components that can be re-used throughout your project, so you only need to define a master component once.

Step 4: Define the component using a master component.

  1. Click + in the DB tier.
  2. In the dialog box, click Create from existing master component.
  3. Click dataload in the "Create from existing component" list to select it.
  4. Leave the component name as dataload and click OK.

Step 5: Define the component process.

We can define how each component is deployed or undeployed by creating component processes. In this step, we will define a deploy process for the StoreFront war component:

  1. Click the Add component process button () in the StoreFront war component.
  2. In the Component Process Details dialog box, enter "Deploy" in the Name field.
  3. Click OK.

Step 6: Define the component process steps.

We will now define a step to retrieve the war file to the directory specified in its definition.

The Component Process Visual Editor shows a process with one step that needs to be defined.

  1. Define this component process step using the Components option.
    a. In this step, click the Menu button () to define the process step.
    b. In the Component Process Step dialog box, enter "Retrieve war file" in the
        Step name field, and click Next.
    c. Select Components > dataload > OK. We are using the default options for
        the dataload component.
       
        The Component Process Visual Editor now shows the Deploy process with the
        "Retrieve war file" step.

  2. Create a new step after the first step and define it using Plugins. In this step, ElectricFlow can perform file operations like unzipping a war file.
    a. Click + at the bottom of the first step.
        A new step appears below it.
    b. Click the Menu button () to define the process step.
    c. In the Component Process Step dialog box, enter "Unzip war file" in the Step
        name field, and click Next.
    d. Select Plugins > Utility > FileOps > Unzip File.
    e. In the Zip File field, enter "/var/tmp/storefront-1.0.0.war".
    f. In the Destination Directory field, enter "./storefront".
    g. Click OK.

    The Component Process Visual Editor now shows the Deploy process with two steps.

  3. Create a new step using shell commands if your deployment involves executing shell commands.
    a. Click + at the bottom of the second step.
        A new step appears below it.
    b. Click the Menu button () to define the process step.
    c. In the Component Process Step dialog box, enter "Copy files to destination" in
        the Step name field, and click Next.
    d. Select Command.
    e. In the Define Step page:
        i. For the On Error setting, keep the default setting (Continue
           running
    ). When the error occurs while the step is running, ElectricFlow
           either stops executing the step (Stop running) or continues to execute the
           step regardless of the error (Continue running). 
       ii. Enter "sh" in the Shell field and paste the shell script in the Command 
           field.
      iii. Click OK.

    The Component Process Visual Editor now shows the Deploy process with three steps.

    You now know how to define a process for a component! You can define other processes for your components (for instance, an undeploy process) the same way.

Step 7: Deploy the application.

To deploy the full application, follow these steps:

  1. In the Application Visual Editor for SF Application, click the Add process button () in the upper right corner.
  2. In the Application Process Details dialog box, enter "Deploy" in the Name field, and click OK.
    The Application Process Visual Editor shows a process with one step that needs to be defined.
  3. Define the first application process step to deploy the war file.
        For the first step:
            a. Enter "Deploy war file" in the Step name field, keep the App Server as
                the environment tier in the Tier field, and click Next.
            b. Select Component > Storefront war > Deploy.
                The Define Step page shows that the step is defined by the "Storefront
                war" component with the Deploy process.
                The Applications Visual Editor shows the Deploy process with the "Deploy
                war file" step.
    We have defined the first step for the application to deploy the war file component. The next step is to deploy the DB component.
  4. Define the second application process step to deploy the DB component.
        To create a new step after the first step:
            a. Click + at the bottom of the first step.
                A new step appears below it.
            b. Click the Menu button () to define the new process step.
            c. In the Application Process Step dialog box, enter "Deploy DB" in the 
                Step name field, select DB as the environment tier in the Tier field, and
                click Next.
            d. Select Components > dataload > Deploy.
            e. Click OK.
                The Application Process Visual Editor now shows the Deploy process with
                two steps.
  5. Define steps to have the deployments of each component run in parallel.
        We can also have the application processes run in parallel when deploying
        each component.
            a. Click the connector () below the "Deploy war file" step, and select
                Change Target in the pop-up menu.
            b. Select the Finish step and click OK.
  6. Define steps to have the deployments of each component run in parallel.
        To define additional steps in the process:
            a. Click + at the bottom of the Deploy DB step.
                A new step appears below it.
            b. In the Application Process Step dialog box, enter "Initialize" in the Step
                name field and click Next.
            c. Select Command.
            d. In the Define Step page, select Stop running for the On Error setting.
            e. Enter "sh" in the Shell field and paste the shell script in the Command
                field.
            f. Click OK.

               The Component Process Visual Editor now shows the Deploy process with
               three steps.

    We have now defined the application processes!

Step 8: Map the application to an environment.

Before the application can be deployed, specify which environment in which the application is deployed.

To create a tier map connecting SF Application to an environment:

  1. Go to the Applications Visual Editor.
  2. Click the Add tier map button () in the upper right corner of the visual editor.
  3. In the Tier Map dialog box, click Environment > SF Test to select where the application will be deployed.
  4. In the Web Server application tier row, click the Menu button () and select the Web App environment tier.
    A green check mark appears in the row when the mapping is successful.
  5. In the DB application tier row, click the Menu button () and select the Database environment tier.
    A green check mark appears in the row when the mapping is successful.
  6. Click OK.

    Your application is now ready to be deployed!

Summary

This tutorial showed how to model applications:

  • Define processes for components and applications.
  • Run steps in sequence or parallel.
  • Use master components.

What's next

Create and run more application deployments.

To learn more, go to learn.electric-cloud.com.

Have more questions? Submit a request

Comments

Powered by Zendesk