Search

Chapter 6. Upgrading CodeReady Workspaces

download PDF

CodeReady Workspaces 1.2 introduces an operator that uses a controller to watch custom resources. This chapter lists steps to upgrade CodeReady Workspaces 1.1 to CodeReady Workspaces 1.2. For steps to upgrade from CodeReady Workspaces 1.0 to CodeReady Workspaces 1.1, see https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/1.1/html/administration_guide/upgrading-codeready-workspaces.

6.1. Upgrading CodeReady Workspaces using a migration script

The upgrade process using the migrate_*.sh scripts is an automation of the manual steps listed in the following manual section. The downloaded codeready-workspaces-operator-installer archive contains the following two migrate_*.sh scripts:

  • migrate_1.0_to_1.1.sh: Use to upgrade from CodeReady Workspaces 1.0 to CodeReady Workspaces 1.1
  • migrate_1.1_to_1.2.sh: Use to upgrade from CodeReady Workspaces 1.1 to CodeReady Workspaces 1.2

Prerequisites

Procedure

  1. To upgrade from CodeReady Workspaces 1.1 to CodeReady Workspaces 1.2, run the following command (the default project namespace is workspaces):

    $ ./migrate_1.1_to_1.2.sh -n=<OpenShift-project-name>
    Important

    Substitute <OpenShift-project-name> for the project namespace that you are using.

6.2. Running the CodeReady Workspaces migration script in restricted environments

The upgrade process using the migrate_*.sh scripts is an automation of the manual steps listed in the following manual section. The downloaded codeready-workspaces-operator-installer archive contains the following two migrate_*.sh scripts:

  • migrate_1.0_to_1.1.sh: Use to upgrade from CodeReady Workspaces 1.0 to CodeReady Workspaces 1.1
  • migrate_1.1_to_1.2.sh: Use to upgrade from CodeReady Workspaces 1.1 to CodeReady Workspaces 1.2

Prerequisites

  • A local (internal) container registry that can be accessed by the OpenShift instance where CodeReady Workspaces is to be deployed.
  • The following images downloaded from registry.redhat.io:

    • registry.redhat.io/codeready-workspaces/server-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/server-operator-rhel8:1.2
    • registry.redhat.io/rhscl/postgresql-96-rhel7:1-40
    • registry.redhat.io/redhat-sso-7/sso73-openshift:1.0-11
    • registry.redhat.io/ubi8-minimal:8.0-127

      Download any of the following container images, with pre-configured stacks for creating workspaces, as required. Note that for most of the images the container name now contains a -rhel8 suffix, but the Node.js 8 container continues to be based on RHEL 7.

    • registry.redhat.io/codeready-workspaces/stacks-java-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-node-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-php-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-python-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-dotnet-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-golang-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-java-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-cpp-rhel8:1.2
    • registry.redhat.io/codeready-workspaces/stacks-node:1.2
  • To obtain the above images, you must have Red Hat login credentials. For details, see https://access.redhat.com/RegistryAuthentication#getting-a-red-hat-login-2.
  • The OpenShift Origin Client Tools 3.11, oc, is in the path. See Section 2.1, “Downloading the Red Hat OpenShift Origin Client Tools”.
  • To peform the upgrade procedure, you must have a running instance of Red Hat OpenShift Container Platform 3.11 or OpenShift Dedicated 3.11, and must be logged in to the OpenShift instance using the following command:

    $ oc login https://<your-IP-address>:8443 --username <your-username> --password <your-password>

Procedure

Use a tool for container management, such as Podman, to push the images to a local registry within the restricted environment.

Note

The podman tool is available from the podman package in Red Hat Enterprise Linux starting with version 7.6. On earlier versions of Red Hat Enterprise Linux, the docker tool can be used with the same command syntax as suggested below for podman.

  1. Pull the required images from registry.redhat.io. For example, to pull the codeready-workspaces/server-rhel8 image, run:

    # podman pull registry.redhat.io/codeready-workspaces/server-rhel8:1.2

    Repeat the command for all the images that you want to pull.

Note

After pulling images, it may be necessary to re-name and re-tag them so they are accessible from your local registry. For example:

# podman tag registry.redhat.io/codeready-workspaces/server-rhel8:1.2 registry.yourcompany.com:5000/crw-server-rhel8:1.2
  1. To upgrade from CodeReady Workspaces 1.1 to CodeReady Workspaces 1.2, run a command like the following, using the correct registry and image names used in the previous steps (The default project namespace is workspaces. Your registry, container names, and tag versions may vary.)

    $ ./migrate_1.1_to_1.2.sh --project=<workspaces> \
         --server-image=registry.yourcompany.com:5000/crw-server-rhel8:1.2 \
         --operator-image=registry.yourcompany.com:5000/crw-server-operator-rhel8:1.2 \
         --identity-provider-image=registry.yourcompany.com:5000/redhat-sso73-openshift:1.0-11 \
         --postgres-image=registry.yourcompany.com:5000/rhscl-postgresql-96-rhel7:1-40 \
         --pvc-jobs-image=registry.yourcompany.com:5000/rhel8-ubi8-minimal:8.0-127 \
         --verbose

6.3. Upgrading CodeReady Workspaces manually

Note

This section walks you through the manual upgrade steps from CodeReady Workspaces 1.1 to CodeReady Workspaces 1.2. For steps to manually upgrade from CodeReady Workspaces 1.0 to CodeReady Workspaces 1.1, see https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/1.1/html/administration_guide/upgrading-codeready-workspaces#upgrading-codeready-workspaces-manually.

Prerequisites

Procedure

  1. Log in to the registry.redhat.io registry. For details, see https://access.redhat.com/RegistryAuthentication#using-authentication-3.
  2. To keep your login secret for the registry.redhat.io registry in a separate file, run the following command:

    $ docker --config /tmp/CRW.docker.config.json login https://registry.redhat.io

    If you do not keep the secret in a seperate file, the secret is stored in the ~/.docker/config.json file and all your secrets are imported to OpenShift in the following step.

  3. To add your secret to OpenShift, run the following commands:

    $ oc create secret generic registryredhatio --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=/tmp/CRW.docker.config.json && \
    oc secrets link default registryredhatio --for=pull && \
    oc secrets link builder registryredhatio

    If the secret is added successfully, the following query shows your new secret:

    $ oc get secret registryredhatio

    If unsuccessful, see https://access.redhat.com/RegistryAuthentication#allowing-pods-to-reference-images-from-other-secured-registries-9.

  4. Select your CodeReady Workspaces deployment (the default project namespace is workspaces):

    $ oc project -n=<OpenShift-project-name>
    Important

    Substitute <OpenShift-project-name> for the project namespace that you are using.

  5. Obtain the DB_PASSWORD from the running CodeReady Workspaces instance:

    $ DB_PASSWORD=$(oc get deployment keycloak -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="DB_PASSWORD")].value'})
  6. Create the JSON patch:

    $ PATCH_JSON=$(cat << EOF
    {
     "spec": {
       "database": {
         "postgresImage": "registry.redhat.io/rhscl/postgresql-96-rhel7:1-40"
       },
       "auth": {
         "identityProviderImage": "registry.redhat.io/redhat-sso-7/sso73-openshift:1.0-11",
         "identityProviderPostgresPassword":"${DB_PASSWORD}"
       },
       "server": {
         "cheImage":"registry.redhat.io/codeready-workspaces/server-rhel8",
         "cheImageTag":"1.2"
       }
     }
    }
    EOF
    )
  7. Patch the running cluster:

    $ oc patch checluster codeready -p "${PATCH_JSON}" --type merge
  8. Scale down the running deployments:

    $ oc scale deployment/codeready --replicas=0 && \
    oc scale deployment/keycloak --replicas=0
  9. Update the operator image and wait until the update is complete:

    $ oc set image deployment/codeready-operator *=registry.redhat.io/codeready-workspaces/server-operator-rhel8:1.2
  10. After the operator is redeployed, scale up the keycloak deployment (RH SSO) and wait until the update is complete:

    $ oc scale deployment/keycloak --replicas=1
  11. After keycloak is redeployed, scale up the CodeReady Workspaces deployment (Che Server) and wait until the update is complete:

    $ oc scale deployment/codeready --replicas=1
  12. After CodeReady Workspaces is redeployed, set the new image for PostgreSQL:

    $ oc set image deployment/postgres "*=registry.redhat.io/rhscl/postgresql-96-rhel7:1-40"
  13. Scale down the PostgreSQL deployment and then scale it back up. Wait until the update is complete:

    $ oc scale deployment/postgres --replicas=0 && \
    oc scale deployment/postgres --replicas=1
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.