Launch new channels with Contract First Approach - Instructions

1. Objectives

Here is an outline of the activities you will achieve as part of this module.

apim overview flowchart
Figure 1. Activities overview

2. Your lab environment

2.1. Ensure lab readiness

Before your proceed it is critical that your lab environment is completely ready before executing the lab instructions.

  • Access the Workshop Deployer browser tab and check if the Launch new channels using Contract-First approach has turned green. This indicates that the module has been fully deployed and is ready to use.

apim workshop deployer
Figure 2. Module Readiness on Workshop Deployer

3. Setup OpenShift Dev Spaces

You will use OpenShift Dev Spaces for a number of activities. OpenShift Dev Spaces uses Kubernetes and containers to provide a consistent, secure, and zero-configuration development environment, accessible from a browser window.

  1. In a browser window, navigate to the browser tab pointing to the Developer perspective of the OpenShift cluster. If you don’t have a browser tab open on the console, click on {openshift_cluster_console}[OpenShift Console, window="console"] to launch the console. If needed login with your username and password ({user_name}/{user_password}).

  2. On the top menu of the console, click on the openshift application menu icon, and in the drop-down box, select Red Hat OpenShift Dev Spaces.

    openshift application menu 2
    Figure 3. Access Red Hat Dev Spaces
  3. Login in with your OpenShift credentials ({user_name}/{user_password}). If this is the first time you access Dev Spaces, you have to authorize Dev Spaces to access your account. In the Authorize Access window click on Allow selected permissions.

    devspace auth access
    Figure 4. Red Hat Dev Spaces - Allow selected permissions
  4. You are directed to the Dev Spaces overview page, which shows the workspaces you have access to. You should see a single workspace, called cloud-architecture-workshop. The workspace needs a couple of seconds to start up.

    devspaces workspace starting
    Figure 5. Red Hat Dev Spaces - cloud-architecture-workshop
  5. Click on the Open link of the workspace.

    devspaces workspace started 1
    Figure 6. Red Hat Dev Spaces - Open cloud-architecture-workshop
  6. This opens the workspace, which will look pretty familiar if you are used to working with VS Code. Before opening the workspace, a pop-up might appear asking if you trust the contents of the workspace. Click Yes, I trust the authors to continue.

    devspaces trust contents
    Figure 7. Red Hat Dev Spaces - Agree to trust the authors
  7. The workspace contains all the resources you are going to use during the workshop. In the project explorer on the left of the workspace, open the workshop/module-apim folder as shown in the screenshot below

    apim devspaces
    Figure 8. Red Hat Dev Spaces - API Module
  8. You can deploy the various resources needed in this workshop to the OpenShift cluster directly from Dev Spaces. To do so, you will need access to the built-in Terminal. Click on the devspaces menu icon on the top of the left menu, and select Terminal → New Terminal from the drop-down menu.

    apim devspaces menu new terminal
    Figure 9. Red Hat Dev Spaces - New terminal
  9. This opens a terminal in the bottom half of the workspace.

    apim devspaces menu terminal
    Figure 10. Red Hat Dev Spaces - Open terminal
  10. The OpenShift Dev Spaces environment has access to a plethora of command line tools, including oc, the OpenShift command line interface. Through OpenShift Dev Spaces you are automatically logged in into the OpenShift cluster. You can verify this with the command oc whoami.

    oc whoami
    Output
    {user_name}

    If the output of the oc whoami command does not correspond to your username ({user_name}), you need to logout and login again with the correct username.

    oc logout
    oc login -u {user_name} -p {user_password} {openshift_api_internal}
  11. You will be working in the globex-apim-{user_name} namespace. So run this following command to start using that particular project

    oc project globex-apim-{user_name}
    apim terminal setup
    Figure 11. Red Hat Devspace - Verify that you are using the globex-apim-<username> namespace
  12. Keep this browser tab open because you will refer to draft content, scripts and YAML files for creating objects on OpenShift

3.1. Scratchpad

As you work through this Contract First APIs module, there are a few variables and URLs that are needed throughout this activity. To make things easier and manageable we’ve setup a scratchpad within Dev Spaces. You can use this scratchpad up with information needed to help you progress through this activity efficiently.