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: Section 1.1.1, "Creating the CodeReady Workspaces project in OpenShift 4 web console" . Section 1.1.2, "Installing the CodeReady Workspaces Operator in OpenShift 4 web console" . Section 1.1.3, "Installing CodeReady Workspaces using the CodeReady Workspaces Operator in OpenShift 4 web console" . Section 1.1.4, "Viewing the state of the CodeReady Workspaces instance deployment in OpenShift 4 web console" . Section 1.1.6, "Viewing the state of the CodeReady Workspaces cluster deployment using OpenShift 4 CLI tools" . Section 1.1.5, "Finding CodeReady Workspaces instance URL in OpenShift 4 web console" . Section 1.1.7, "Finding CodeReady Workspaces cluster URL using the OpenShift 4 CLI" . Section 1.1.8, "Enabling SSL on OpenShift 4" . Section 1.1.9, "Logging in to CodeReady Workspaces on OpenShift for the first time using OAuth" . Section 1.1.10, "Logging in to CodeReady Workspaces on OpenShift for the first time registering as a new user" . 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 Open the OpenShift web console. In the left panel, navigate to Projects . Click the Create Project button. Enter the project details: In the Name field, type codeready . In the Display Name field, type Red Hat CodeReady Workspaces . 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 An administrator account on a running instance of OpenShift 4. Administrative rights on an existing project named codeready on this instance of OpenShift 4. See Section 1.1.1, "Creating the CodeReady Workspaces project in OpenShift 4 web console" . The Red Hat CodeReady Workspaces 2.0 Operator is not installed. Procedure Open the OpenShift web console. In the left panel, navigate to the Operators OperatorHub section. In the Search by keyword field, type Red Hat CodeReady Workspaces . Click on the Red Hat CodeReady Workspaces tile. Click the Install button in the Red Hat CodeReady Workspaces pop-up window. In the A specific namespace on the cluster field, in the cluster drop-down list, select the namespace into which the version of the CodeReady Workspaces Operator was installed. Click the Subscribe button. In the left panel, navigate to the Operators Installed Operators section. Red Hat CodeReady Workspaces is displayed as an installed Operator having the InstallSucceeded status. Click on the Red Hat CodeReady Workspaces name in the list of installed operators. Navigate to the Overview tab. In the Conditions sections at the bottom of the page, wait for this message: install strategy completed with no errors . Navigate to the Events tab. 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 An administrator account on a running instance of OpenShift 4. At least one OAuth user provisioned on this instance of OpenShift 4. The CodeReady Workspaces Operator is installed on this instance of OpenShift 4. See Section 1.1.2, "Installing the CodeReady Workspaces Operator in OpenShift 4 web console" Procedure Open the OpenShift web console. Navigate to the Operators Installed Operators section. Click Red Hat CodeReady Workspaces in the list of installed operators. Click the Create Instance link in Provided APIs section. The Create CodeReady Workspaces Cluster page is displayed. Leave the default values as they are. Click the Create button in the bottom-left corner of the window. The codeready cluster is created. 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 Open the OpenShift web console. Navigate to the Operators Installed Operators section. Click Red Hat CodeReady Workspaces in the list of installed operators. Navigate to the CodeReady Workspaces Cluster tab. Click codeready-workspaces CheCluster in the table. The Overview tab is displayed. Watch the content of the Message field. The field contain error messages, if any. The expected content is None . Navigate to the Resources tab. The screen displays the state of the resources assigned to the CodeReady Workspaces deployment. 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. Prerequisites A running Red Hat CodeReady Workspaces instance. See Section 1.1.4, "Viewing the state of the CodeReady Workspaces instance deployment in OpenShift 4 web console" . See Section 1.1.6, "Viewing the state of the CodeReady Workspaces cluster deployment using OpenShift 4 CLI tools" . Procedure Open the OpenShift web console. In the left panel, navigate to the Operators Installed Operators section. Click the Red Hat CodeReady Workspaces Operator tile. Click codeready-workspaces CheCluster in the table. The Overview tab is displayed. 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 An installation of an Red Hat CodeReady Workspaces cluster. See Section 1.1.3, "Installing CodeReady Workspaces using the CodeReady Workspaces Operator in OpenShift 4 web console" . Procedure Run the following commands to select the crw project: Run the following commands to get the name and status of the Pods running in the selected project: 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 To see the state of the CodeReady Workspaces cluster deployment, run: USD 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 To retrieve the CodeReady Workspaces cluster URL from the checluster CR (Custom Resource), run: USD oc get checluster --output jsonpath='{.items[0].status.cheURL}' Alternatively, to retrieve the CodeReady Workspaces cluster URL from the OpenShift logs, run: USD oc logs --tail=10 `(oc get pods -o name | grep operator)` | \ grep "available at" | \ awk -F'available at: ' '{print USD2}' | sed 's/"//' 1.1.8. Enabling SSL on OpenShift 4 Prerequisites A running Red Hat CodeReady Workspaces cluster. See Section 1.1.4, "Viewing the state of the CodeReady Workspaces instance deployment in OpenShift 4 web console" . See Section 1.1.6, "Viewing the state of the CodeReady Workspaces cluster deployment using OpenShift 4 CLI tools" . Procedure Open the OpenShift web console. In the left panel, navigate to the Operators Installed Operators section. Click on the Red Hat CodeReady Workspaces Operator tile. Click on eclipse-che in the table. Navigate to the Overview tab. Toggle the TLS MODE switch to True . Click Confirm change . Navigate to the Resources tab. Wait that the Pods are restarted. Navigate to the Overview tab. Click the Red Hat CodeReady Workspaces URL link. Notice that the link is redirected to HTTPS. 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 Navigate to the Red Hat CodeReady Workspaces URL to display the Red Hat CodeReady Workspaces login page. Choose the OpenShift OAuth option. The Authorize Access page is displayed. Click on the Allow selected permissions button. 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 Navigate to the Red Hat CodeReady Workspaces URL to display the Red Hat CodeReady Workspaces login page. Choose the Register as a new user option. 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 Navigate to https://developers.redhat.com/products/codeready-workspaces/download . Download the CodeReady Workspaces CLI management tool archive for version 2.1. Extract the archive. Place the extracted binary in your USDPATH . 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 Log in to OpenShift Container Platform 4: Run this command to install Red Hat CodeReady Workspaces with defaults settings: 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: 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: Download the default custom resource YAML file . Name the downloaded custom resource org_v1_che_cr.yaml , and copy it into the current directory. Modify the org_v1_che_cr.yaml file to override or add any field. Run the installation using the org_v1_che_cr.yaml file to override the CodeReady Workspaces CLI management tool defaults: Note Some basic installation settings can be overridden in a simpler way by using additional crwctl arguments. To display the list of available arguments:

Commands:
oc project <project_name>
oc get pods
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
oc logs --tail=10 -f `oc get pods -o name | grep operator`
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"
oc get checluster --output jsonpath='{.items[0].status.cheURL}'
oc logs --tail=10 `(oc get pods -o name | grep operator)` | grep "available at" | awk -F'available at: ' '{print USD2}' | sed 's/"//'
oc login USD{OPENSHIFT_API_URL} -u USD{OPENSHIFT_USERNAME} -p USD{OPENSHIFT_PASSWORD}
crwctl server:start
{prod-cli} server:start --chenamespace=codeready-workspaces
crwctl server:start --che-operator-cr-yaml=org_v1_che_cr.yaml
crwctl server:start --help