Chapter 1. Installing CodeReady Workspaces on OpenShift Container Platform 4

1.1. Installing CodeReady Workspaces on OpenShift 4 from OperatorHub

Operators are a method of packaging, deploying, and managing a OpenShift application which also provide the following:

  • Repeatability of installation and upgrade.
  • Constant health checks of every system component.
  • Over-the-air (OTA) updates for OpenShift components and ISV content.
  • A place to encapsulate knowledge from field engineers and spread it to all users.

On OpenShift, Red Hat CodeReady Workspaces can be installed using the OperatorHub Catalog present in the OpenShift web console.

Note

It is possible to use the crwctl utility script for deploying CodeReady Workspaces on OpenShift Container Platform and OpenShift Dedicated versions 4.4. This method is considered unofficial and serves as a backup installation method for situations where the installation method using OperatorHub is not available.

For information about how to use the crwctl utility script for deploying CodeReady Workspaces on OpenShift, see the Installing CodeReady Workspaces on OpenShift 3 using the Operator section.

Following steps are described:

1.1.1. Creating the CodeReady Workspaces project in OpenShift 4 web console

This section describes how to create the CodeReady Workspaces project in OpenShift 4 web console.

Prerequisites
  • An administrator account on a running instance of OpenShift 4.
Procedure
  1. Open the OpenShift web console.
  2. In the left panel, navigate to Projects.
  3. Click the Create Project button.
  4. Enter the project details:

    • In the Name field, type codeready.
    • In the Display Name field, type Red Hat CodeReady Workspaces.
  5. Click the Create button.

1.1.2. Installing the CodeReady Workspaces Operator in OpenShift 4 web console

This section describes how to install the CodeReady Workspaces Operator in OpenShift 4 web console.

Prerequisites
Procedure
  1. Open the OpenShift web console.
  2. In the left panel, navigate to the OperatorsOperatorHub section.
  3. In the Search by keyword field, type Red Hat CodeReady Workspaces.
  4. Click on the Red Hat CodeReady Workspaces tile.
  5. Click the Install button in the Red Hat CodeReady Workspaces pop-up window.
  6. In the A specific namespace on the cluster field, in the cluster drop-down list, select the namespace into which the previous version of the CodeReady Workspaces Operator was installed.
  7. Click the Subscribe button.
  8. In the left panel, navigate to the OperatorsInstalled Operators section.
  9. Red Hat CodeReady Workspaces is displayed as an installed Operator having the InstallSucceeded status.
  10. Click on the Red Hat CodeReady Workspaces name in the list of installed operators.
  11. Navigate to the Overview tab.
  12. In the Conditions sections at the bottom of the page, wait for this message: install strategy completed with no errors.
  13. Navigate to the Events tab.
  14. Wait for this message: install strategy completed with no errors.

1.1.3. Installing CodeReady Workspaces using the CodeReady Workspaces Operator in OpenShift 4 web console

This section describes how to install CodeReady Workspaces using the CodeReady Workspaces Operator in OpenShift 4 web console.

Prerequisites
Procedure
  1. Open the OpenShift web console.
  2. Navigate to the OperatorsInstalled Operators section.
  3. Click Red Hat CodeReady Workspaces in the list of installed operators.
  4. Click the Create Instance link in Provided APIs section.
  5. The Create CodeReady Workspaces Cluster page is displayed.
  6. Leave the default values as they are.
  7. Click the Create button in the bottom-left corner of the window.
  8. The codeready cluster is created.

    eclipse che cluster create che cluster

1.1.4. Viewing the state of the CodeReady Workspaces instance deployment in OpenShift 4 web console

This section describes how to view the state of the CodeReady Workspaces instance deployment in OpenShift 4 web console.

Prerequisites

  • An administrator account on a running instance of OpenShift 4.
  • A CodeReady Workspaces is being deployed on this instance of OpenShift 4.

Procedure

  1. Open the OpenShift web console.
  2. Navigate to the OperatorsInstalled Operators section.
  3. Click Red Hat CodeReady Workspaces in the list of installed operators.
  4. Navigate to the CodeReady Workspaces Cluster tab.
  5. Click codeready-workspaces CheCluster in the table.

    The Overview tab is displayed.

  6. Watch the content of the Message field. The field contain error messages, if any. The expected content is None.
  7. Navigate to the Resources tab.

    The screen displays the state of the resources assigned to the CodeReady Workspaces deployment.

    eclipse che resources tab

1.1.5. Finding CodeReady Workspaces instance URL in OpenShift 4 web console

This section descibes how to find the CodeReady Workspaces instance URL in OpenShift 4 web console.

Procedure

  1. Open the OpenShift web console.
  2. In the left panel, navigate to the OperatorsInstalled Operators section.
  3. Click the Red Hat CodeReady Workspaces Operator tile.
  4. Click codeready-workspaces CheCluster in the table.

    The Overview tab is displayed.

  5. Read the value of the CodeReady Workspaces URL field.

1.1.6. Viewing the state of the CodeReady Workspaces cluster deployment using OpenShift 4 CLI tools

This section describes how to view the state of the CodeReady Workspaces cluster deployment using OpenShift 4 CLI tools.

Prerequisites

Procedure

  1. Run the following commands to select the crw project:

    $ oc project <project_name>
  2. Run the following commands to get the name and status of the Pods running in the selected project:

    $ oc get pods
  3. Check that the status of all the Pods is Running.

    NAME                            READY     STATUS    RESTARTS   AGE
    codeready-8495f4946b-jrzdc            0/1       Running   0          86s
    codeready-operator-578765d954-99szc   1/1       Running   0          42m
    keycloak-74fbfb9654-g9vp5       1/1       Running   0          4m32s
    postgres-5d579c6847-w6wx5       1/1       Running   0          5m14s
  4. To see the state of the CodeReady Workspaces cluster deployment, run:

    $ oc logs --tail=10 -f `oc get pods -o name | grep operator`

    Example output of the command:

    time="2019-07-12T09:48:29Z" level=info msg="Exec successfully completed"
    time="2019-07-12T09:48:29Z" level=info msg="Updating eclipse-che CR with status: provisioned with OpenShift identity provider: true"
    time="2019-07-12T09:48:29Z" level=info msg="Custom resource eclipse-che updated"
    time="2019-07-12T09:48:29Z" level=info msg="Creating a new object: ConfigMap, name: che"
    time="2019-07-12T09:48:29Z" level=info msg="Creating a new object: ConfigMap, name: custom"
    time="2019-07-12T09:48:29Z" level=info msg="Creating a new object: Deployment, name: che"
    time="2019-07-12T09:48:30Z" level=info msg="Updating eclipse-che CR with status: CodeReady Workspaces API: Unavailable"
    time="2019-07-12T09:48:30Z" level=info msg="Custom resource eclipse-che updated"
    time="2019-07-12T09:48:30Z" level=info msg="Waiting for deployment che. Default timeout: 420 seconds"

1.1.7. Finding CodeReady Workspaces cluster URL using the OpenShift 4 CLI

This section describes how to obtain the CodeReady Workspaces cluster URL using the OpenShift 4 CLI (command line interface). The URL can be retrieved from the OpenShift logs or from the checluster Custom Resource.

Prerequisites

  • An instance of Red Hat CodeReady Workspaces running on OpenShift.
  • User is located in a CodeReady Workspaces installation namespace.

Procedure

  1. To retrieve the CodeReady Workspaces cluster URL from the checluster CR (Custom Resource), run:

    $ oc get checluster --output jsonpath='{.items[0].status.cheURL}'
  2. Alternatively, to retrieve the CodeReady Workspaces cluster URL from the OpenShift logs, run:

    $ oc logs --tail=10 `(oc get pods -o name | grep operator)` | \
      grep "available at" | \
      awk -F'available at: ' '{print $2}' | sed 's/"//'

1.1.8. Enabling SSL on OpenShift 4

Prerequisites
Procedure
  1. Open the OpenShift web console.
  2. In the left panel, navigate to the OperatorsInstalled Operators section.
  3. Click on the Red Hat CodeReady Workspaces Operator tile.
  4. Click on eclipse-che in the table.
  5. Navigate to the Overview tab.
  6. Toggle the TLS MODE switch to True.
  7. Click Confirm change.

    tls mode true
  8. Navigate to the Resources tab.
  9. Wait that the Pods are restarted.
  10. Navigate to the Overview tab.
  11. Click the Red Hat CodeReady Workspaces URL link.
  12. Notice that the link is redirected to HTTPS.
  13. The browser displays the Red Hat CodeReady Workspaces Dashboard using a valid Let’s Encrypt certificate.

1.1.9. Logging in to CodeReady Workspaces on OpenShift for the first time using OAuth

This section describes how to log in to CodeReady Workspaces on OpenShift for the first time using OAuth.

Prerequisites

  • Contact the administrator of the OpenShift instance to obtain the Red Hat CodeReady Workspaces URL.

Procedure

  1. Navigate to the Red Hat CodeReady Workspaces URL to display the Red Hat CodeReady Workspaces login page.
  2. Choose the OpenShift OAuth option.
  3. The Authorize Access page is displayed.
  4. Click on the Allow selected permissions button.
  5. Update the account information: specify the Username, Email, First name and Last name fields and click the Submit button.

Validation steps

  • The browser displays the Red Hat CodeReady Workspaces Dashboard.

1.1.10. Logging in to CodeReady Workspaces on OpenShift for the first time registering as a new user

This section describes how to log in to CodeReady Workspaces on OpenShift for the first time registering as a new user.

Prerequisites

  • Contact the administrator of the OpenShift instance to obtain the Red Hat CodeReady Workspaces URL.

Procedure

  1. Navigate to the Red Hat CodeReady Workspaces URL to display the Red Hat CodeReady Workspaces login page.
  2. Choose the Register as a new user option.
  3. Update the account information: specify the Username, Email, First name and Last name field and click the Submit button.

Validation steps

  • The browser displays the Red Hat CodeReady Workspaces Dashboard.

1.2. Installing CodeReady Workspaces using CLI management tool

1.2.1. Installing the crwctl CLI management tool

This section describes how to install crwctl, the CodeReady Workspaces CLI management tool.

Procedure

  1. Navigate to https://developers.redhat.com/products/codeready-workspaces/download.
  2. Download the CodeReady Workspaces CLI management tool archive for version 2.1.
  3. Extract the archive.
  4. Place the extracted binary in your $PATH.

1.2.2. Installing CodeReady Workspaces using CodeReady Workspaces CLI management tool

This sections describes how to install CodeReady Workspaces using the CodeReady Workspaces CLI management tool.

Note

Use CodeReady Workspaces CLI management tool to install CodeReady Workspaces only if OperatorHub is not available. This method is not oficially supported for OpenShift Container Platform 4.1 or later.

Prerequisites

  • CodeReady Workspaces CLI management tool is installed.
  • OpenShift Container Platform 4 CLI is installed.
  • Access to an OpenShift Container Platform instance

1.2.2.1. Installing with default settings

Procedure

  1. Log in to OpenShift Container Platform 4:

    $ oc login ${OPENSHIFT_API_URL} -u ${OPENSHIFT_USERNAME} -p ${OPENSHIFT_PASSWORD}
  2. Run this command to install Red Hat CodeReady Workspaces with defaults settings:

    $ crwctl server:start
    Note

    crwctl default namespace is workspaces. If you use a namespace with a different name, run the command with the --chenamespace=your namespace flag, for example:

    $ {prod-cli} server:start --chenamespace=codeready-workspaces

1.2.2.2. Installing with custom settings

Procedure

To override specific settings of the red-hat-codeready-workspaces installation, provide a dedicated custom resource when running the above crwctl command:

  1. Download the default custom resource YAML file.
  2. Name the downloaded custom resource org_v1_che_cr.yaml, and copy it into the current directory.
  3. Modify the org_v1_che_cr.yaml file to override or add any field.
  4. Run the installation using the org_v1_che_cr.yaml file to override the CodeReady Workspaces CLI management tool defaults:

    $ crwctl server:start --che-operator-cr-yaml=org_v1_che_cr.yaml
    Note

    Some basic installation settings can be overridden in a simpler way by using additional crwctl arguments. To display the list of available arguments:

    $ crwctl server:start --help