Chapter 3. Downloading and deploying applications using Developer Launcher

This section shows you how to download and deploy example applications provided with the runtimes. The example applications are available on Developer Launcher.

3.1. Working with Developer Launcher

Developer Launcher (developers.redhat.com/launch) runs on OpenShift. When you deploy example applications, the Developer Launcher guides you through the process of:

  • Selecting a runtime
  • Building and executing the application

Based on your selection, Developer Launcher generates a custom project. You can either download a ZIP version of the project or directly launch the application on an OpenShift Online instance.

When you deploy your application on OpenShift using Developer Launcher, the Source-to-Image (S2I) build process is used. This build process handles all the configuration, build, and deployment steps that are required to run your application on OpenShift.

3.2. Downloading the example applications using Developer Launcher

Red Hat provides example applications that help you get started with the Spring Boot runtime. These examples are available on Developer Launcher (developers.redhat.com/launch).

You can download the example applications, build, and deploy them. This section explains how to download example applications.

You can use the example applications as templates to create your own cloud-native applications.

Procedure

  1. Go to Developer Launcher (developers.redhat.com/launch).
  2. Click Start.
  3. Click Deploy an Example Application.
  4. Click Select an Example to see the list of example applications available with the runtime.
  5. Select a runtime.
  6. Select an example application.

    Note

    Some example applications are available for multiple runtimes. If you have not selected a runtime in the previous step, you can select a runtime from the list of available runtimes in the example application.

  7. Select the release version for the runtime. You can choose from the community or product releases listed for the runtime.
  8. Click Save.
  9. Click Download to download the example application.

    A ZIP file containing the source and documentation files is downloaded.

3.3. Deploying an example application on OpenShift Container Platform or CDK (Minishift)

You can deploy the example application to either OpenShift Container Platform or CDK (Minishift). Depending on where you want to deploy your application use the relevant web console for authentication.

Prerequisites

  • An example application project created using Developer Launcher.
  • If you are deploying your application on OpenShift Container Platform, you must have access to the OpenShift Container Platform web console.
  • If you are deploying your application on CDK (Minishift), you must have access to the CDK (Minishift) web console.
  • oc command-line client installed.

Procedure

  1. Download the example application.
  2. You can deploy the example application on OpenShift Container Platform or CDK (Minishift) using the oc command-line client.

    You must authenticate the client using the token provided by the web console. Depending on where you want to deploy your application, use either the OpenShift Container Platform web console or CDK (Minishift) web console. Perform the following steps to get the authenticate the client:

    1. Login to the web console.
    2. Click the question mark icon, which is in the upper-right corner of the web console.
    3. Select Command Line Tools from the list.
    4. Copy the oc login command.
    5. Paste the command in a terminal to authenticate your oc CLI client with your account.

      $ oc login OPENSHIFT_URL --token=MYTOKEN
  3. Extract the contents of the ZIP file.

    $ unzip MY_APPLICATION_NAME.zip
  4. Create a new project in OpenShift.

    $ oc new-project MY_PROJECT_NAME
  5. Navigate to the root directory of MY_APPLICATION_NAME.
  6. Deploy your example application using Maven.

    $ mvn clean fabric8:deploy -Popenshift

    NOTE: Some example applications may require additional setups. To build and deploy the example applications, follow the instructions provided in the README file.

  7. Check the status of your application and ensure your pod is running.

    $ oc get pods -w
    NAME                             READY     STATUS      RESTARTS   AGE
    MY_APP_NAME-1-aaaaa               1/1       Running     0          58s
    MY_APP_NAME-s2i-1-build           0/1       Completed   0          2m

    The MY_APP_NAME-1-aaaaa pod has the status Running after it is fully deployed and started. The pod name of your application may be different. The numeric value in the pod name is incremented for every new build. The letters at the end are generated when the pod is created.

  8. After your example application is deployed and started, determine its route.

    Example Route Information

    $ oc get routes
    NAME                 HOST/PORT                                                     PATH      SERVICES        PORT      TERMINATION
    MY_APP_NAME         MY_APP_NAME-MY_PROJECT_NAME.OPENSHIFT_HOSTNAME      MY_APP_NAME      8080

    The route information of a pod gives you the base URL which you can use to access it. In this example, you can use http://MY_APP_NAME-MY_PROJECT_NAME.OPENSHIFT_HOSTNAME as the base URL to access the application.