Creating applications using the Developer perspective

The Developer perspective in the web console provides you the following options from the +Add view to create applications and associated services and deploy them on OKD:

  • Getting started resources: Use these resources to help you get started with Developer Console. You can choose to hide the header using the Options menu kebab.

    • Creating applications using samples: Use existing code samples to get started with creating applications on the OKD.

    • Build with guided documentation: Follow the guided documentation to build applications and familiarize yourself with key concepts and terminologies.

    • Explore new developer features: Explore the new features and resources within the Developer perspective.

  • Developer catalog: Explore the Developer Catalog to select the required applications, services, or source to image builders, and then add it to your project.

    • All Services: Browse the catalog to discover services across OKD.

    • Database: Select the required database service and add it to your application.

    • Operator Backed: Select and deploy the required Operator-managed service.

    • Helm chart: Select the required Helm chart to simplify deployment of applications and services.

    • Event Source: Select an Event source to register interest in a class of events from a particular system.

      The Managed services option is also available if the RHOAS Operator is installed.

  • Git repository: Import an existing codebase, Devfile, or Dockerfile from your Git repository using the From Git, From Devfile, or From Dockerfile options respectively, to build and deploy an application on OKD.

  • Container images: Use existing images from an image stream or registry to deploy it on to the OKD.

  • Pipelines: Use Tekton pipeline to create CI/CD pipelines for your software delivery process on the OKD.

  • Serverless: Explore the Serverless options to create, build, and deploy stateless and serverless applications on the OKD.

    • Channel: Create a Knative Channel to create an event forwarding and persistence layer with in-memory and reliable implementations.
  • Samples: Explore the available sample applications to create, build, and deploy an application quickly.

  • From Local Machine: Explore the From Local Machine tile to import or upload files on your local machine for building and deploying applications easily.

    • Import YAML: Upload a YAML file to create and define resources for building and deploying applications.

    • Upload JAR file: Upload a JAR file to build and deploy Java applications.

Prerequisites

To create applications using the Developer perspective ensure that:

Creating Sample applications

You can use the basic sample applications in the +Add flow of the Developer perspective to create, build, and deploy applications quickly.

The following procedure explains the Samples option in the Developer perspective to create a sample application.

Procedure

  1. In the +Add view, click on the Samples tile to see the Samples page.

  2. On the Samples page, select one of the available sample applications to see the Create Sample Application form.

  3. In the Create Sample Application Form:

    • In the Name field, the deployment name is displayed by default. You can modify this name as required.

    • In the Builder Image Version, a builder image is selected by default. You can modify this image version by using the Builder Image Version drop-down list.

    • A sample Git repository URL is added by default.

  4. Click Create to create the sample application. The build status of the sample application is displayed on the Topology view. After the sample application is created, you can see the deployment added to the application.

Importing a codebase from Git to create an application

You can use the Developer perspective to create, build, and deploy an application on OKD using an existing codebase in GitHub.

The following procedure walks you through the From Git option in the Developer perspective to create an application.

Procedure

  1. In the +Add view, click From Git in the Git Repository tile to see the Import from git form.

  2. In the Git section, enter the Git repository URL for the codebase you want to use to create an application. For example, enter the URL of this sample Node.js application https://github.com/sclorg/nodejs-ex. The URL is then validated.

  3. Optional: You can click Show Advanced Git Options to add details such as:

    • Git Reference to point to code in a specific branch, tag, or commit to be used to build the application.

    • Context Dir to specify the subdirectory for the application source code you want to use to build the application.

    • Source Secret to create a Secret Name with credentials for pulling your source code from a private repository.

  4. Optional: You can import a devfile, a Dockerfile, or a builder image through your Git repository to further customize your deployment.

    • If your Git repository contains a devfile, a Dockerfile, or a builder image, it is automatically detected and populated on the respective path fields. If a devfile, a Dockerfile, and a builder image are detected in the same repository, the devfile is selected by default.

    • To edit the file import type and select a different strategy, click Edit import strategy option.

    • If multiple devfiles, Dockerfiles, or builder images are detected, to import a specific devfile, Dockerfile, or a builder image, specify the respective paths relative to the context directory.

  5. After the Git URL is validated, the recommended builder image is selected and marked with a star. If the builder image is not auto-detected, select a builder image. For the [https://github.com/sclorg/nodejs-ex](https://github.com/sclorg/nodejs-ex) Git URL, by default the Node.js builder image is selected.

    1. Optional: Use the Builder Image Version drop-down to specify a version.

    2. Optional: Use the Edit import strategy to select a different strategy.

  6. In the General section:

    1. In the Application field, enter a unique name for the application grouping, for example, myapp. Ensure that the application name is unique in a namespace.

    2. The Name field to identify the resources created for this application is automatically populated based on the Git repository URL if there are no existing applications. If there are existing applications, you can choose to deploy the component within an existing application, create a new application, or keep the component unassigned.

      The resource name must be unique in a namespace. Modify the resource name if you get an error.

  7. In the Resources section, select:

    • Deployment, to create an application in plain Kubernetes style.

    • Deployment Config, to create an OKD style application.

    • Knative Service, to create a microservice.

    The Knative Service option is displayed in the Import from git form only if the Serverless Operator is installed in your cluster. For further details refer to documentation on installing OpenShift Serverless.

  8. In the Pipelines section, select Add Pipeline, and then click Show Pipeline Visualization to see the pipeline for the application.

  9. In the Advanced Options section, the Create a route to the application is selected by default so that you can access your application using a publicly available URL. You can clear the check box if you do not want to expose your application on a public route.

  10. Optional: You can use the following advanced options to further customize your application:

    Routing

    Click the Routing link to:

    • Customize the hostname for the route.

    • Specify the path the router watches.

    • Select the target port for the traffic from the drop-down list.

    • Secure your route by selecting the Secure Route check box. Select the required TLS termination type and set a policy for insecure traffic from the respective drop-down lists.

      For serverless applications, the Knative Service manages all the routing options above. However, you can customize the target port for traffic, if required. If the target port is not specified, the default port of 8080 is used.

    Health Checks

    Click the Health Checks link to add Readiness, Liveness, and Startup probes to your application. All the probes have prepopulated default data; you can add the probes with the default data or customize it as required.

    To customize the health probes:

    • Click Add Readiness Probe, if required, modify the parameters to check if the container is ready to handle requests, and select the check mark to add the probe.

    • Click Add Liveness Probe, if required, modify the parameters to check if a container is still running, and select the check mark to add the probe.

    • Click Add Startup Probe, if required, modify the parameters to check if the application within the container has started, and select the check mark to add the probe.

      For each of the probes, you can specify the request type - HTTP GET, Container Command, or TCP Socket, from the drop-down list. The form changes as per the selected request type. You can then modify the default values for the other parameters, such as the success and failure thresholds for the probe, number of seconds before performing the first probe after the container starts, frequency of the probe, and the timeout value.

    Build Configuration and Deployment

    Click the Build Configuration and Deployment links to see the respective configuration options. Some options are selected by default; you can customize them further by adding the necessary triggers and environment variables.

    For serverless applications, the Deployment option is not displayed as the Knative configuration resource maintains the desired state for your deployment instead of a DeploymentConfig.

    Scaling

    Click the Scaling link to define the number of pods or instances of the application you want to deploy initially.

    For serverless applications, you can:

    • Set the upper and lower limit for the number of pods that can be set by the autoscaler. If the lower limit is not specified, it defaults to zero.

    • Define the soft limit for the required number of concurrent requests per instance of the application at a given time. It is the recommended configuration for autoscaling. If not specified, it takes the value specified in the cluster configuration.

    • Define the hard limit for the number of concurrent requests allowed per instance of the application at a given time. This is configured in the revision template. If not specified, it defaults to the value specified in the cluster configuration.

    Resource Limit

    Click the Resource Limit link to set the amount of CPU and Memory resources a container is guaranteed or allowed to use when running.

    Labels

    Click the Labels link to add custom labels to your application.

  11. Click Create to create the application and see its build status in the Topology view.

Upload JAR files for easy deployment of Java applications

You can use the JAR files in the Topology view of the Developer perspective to deploy your Java applications. You can upload a JAR file using the following options:

  • Navigate to the +Add view of the Developer perspective, and click Upload JAR file in the From Local Machine tile. Browse and select your JAR file, or drag and drop a JAR file to deploy your application.

  • Navigate to the Topology view and use the Upload JAR file option, or drag and drop a JAR file to deploy your application.

  • Use the in-context menu in the Topology view, and then use the Upload JAR file option to upload your JAR file to deploy your application.

Use the following instructions to upload a JAR file in the Topology view to deploy a Java application:

Procedure

  1. In the Topology view, right-click anywhere in the Topology view to see the Add to Project menu.

  2. Hover over the Add to Project menu to see the menu options, and then select the Upload JAR file option to see the Upload JAR file form . Alternatively, you can drag and drop the JAR file in the Topology view.

  3. In the JAR file field, browse for the required JAR file on your local machine and upload it. Alternatively, you can drag and drop the JAR file on the field. A toast alert is displayed at the top right if an incompatible file type is dragged and dropped on the Topology view. A field error is displayed if an incompatible file type is dropped on the field in the upload form.

  4. You can further specify optional Java commands to customize your deployed application. The Runtime Icon and Builder Image is selected by default. If a Builder Image is not auto-detected, select a Builder Image. If required, you can change the version using the Builder Image Version drop-down list.

  5. In the optional Application Name field, enter a unique name for your application for the resource labelling.

  6. In the Name field, enter a unique component name to name the associated resources.

  7. In the Resources field, choose the resource type for your application.

  8. In the Advanced options, click on Create a Route to the Application to configure a public URL for your deployed application.

  9. Click Create to deploy the application. The user sees a toast notification notifying that the JAR file is being uploaded and takes a while. The toast notification also includes a link to view the build logs.

    If the user attempts to close the browser tab while the build is running, a web alert would be displayed asking the user if they actually want to leave the page.

After the JAR file is uploaded and the application is deployed, you can see the deployment in the Topology view.

Using the Developer Catalog to add services or components to your application

You use the Developer Catalog to deploy applications and services based on Operator backed services such as Databases, Builder Images, and Helm Charts. The Developer Catalog contains a collection of application components, services, event sources, or source-to-image builders that you can add to your project. Cluster administrators can customize the content made available in the catalog.

Procedure

  1. In the Developer perspective, navigate to the +Add view and from the Developer Catalog tile, click All Services to view all the available services in the Developer Catalog.

  2. Under All Services, select the kind of service or the component you need to add to your project. For this example, select Databases to list all the database services and then click MariaDB to see the details for the service.

  3. Click Instantiate Template to see an automatically populated template with details for the MariaDB service, and then click Create to create and view the MariaDB service in the Topology view.

    odc devcatalog toplogy

    Figure 1. MariaDB in Topology