Skip to content

Instantly share code, notes, and snippets.

@nickboldt
Last active August 13, 2019 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickboldt/81853dd9f791238a7c9968bd10d0fee3 to your computer and use it in GitHub Desktop.
Save nickboldt/81853dd9f791238a7c9968bd10d0fee3 to your computer and use it in GitHub Desktop.
Che 7 IDE in CRW 1.2 - RHDEVDOCS-1249
  1. Deploy CRW 1.2 to OCP using OperatorHub.

  2. Or, use the Operator-based deploy script:

    git clone https://github.com/redhat-developer/codeready-workspaces-deprecated && cd codeready-workspaces-deprecated/operator-installer && git checkout 6.19.x
    ./deploy.sh -d --server-image=quay.io/crw/server-rhel8 -v=1.2-35 --operator-image=quay.io/crw/operator-rhel8:1.2-13 --verbose -p=crw-che7d
  3. Get the che plugin registry sources that include the v1 and v2 registries:

    git clone https://github.com/eclipse/che-plugin-registry.git && \
    cd che-plugin-registry && \
    git checkout registry-v2
  4. Build it & push to quay (or use my image)

    docker build . -t quay.io/nickboldt/che-plugin-registry-v2:nightly && \
    docker push quay.io/nickboldt/che-plugin-registry-v2:nightly
  5. If you deployed your own, go to the Settings tab for your quay repo, eg., https://quay.io/repository/nickboldt/che-plugin-registry-v2?tab=settings. Mark the image public.

  6. Deploy the new registry to your cluster, in the same project as CRW deployment, using the image you built above.

    oc login <my cluster>
    oc project <my crw deployment>
    
    cd che-plugin-registry; oc new-app --name=che-plugin-registry -f openshift/che-plugin-registry.yml \
               -p IMAGE="quay.io/nickboldt/che-plugin-registry-v2" \
               -p IMAGE_TAG="nightly" \
               -p PULL_POLICY="Always"
  7. Update the CRW deployment to use the new registry:

    routebits=$(oc get routes | grep plugin-registry) && \
    route=( $routebits ) && regurl=${route[1]} && echo $regurl
    
    for d in codeready-operator codeready; do
      oc set env deployment/${d} \
      CHE_WORKSPACE_PLUGIN__REGISTRY__URL=${regurl} && \
      oc scale deployment/${d} --replicas=0 && \
      oc scale deployment/${d} --replicas=1
    done
  8. Verify the correct registry is defined in the CodeReady Workspaces server pod:

    oc rsh $(oc get pods | grep codeready | grep -v operator | grep Running | sed -e "s# \+1/1.\+##") /bin/bash -c "env | grep CHE_WORKSPACE_PLUGIN__REGISTRY__URL"
  9. Browse to your CRW dashboard, eg., at http://codeready-crw-che7d.apps.crw.codereadyqe.com/dashboard/#/

  10. Create a new workspace, eg. the Java 8 one. Instead of starting the workspace, click the menu next to Create & Open and select Create & Proceed Editing. Select the Config tab and edit the default config to remove the installers and add these plugins/editors:

    "attributes": {
          "editor": "org.eclipse.che.editor.theia:next",
          "plugins": "che-machine-exec-plugin:0.0.1,ms-vscode.node-debug2:1.31.6,redhat.vscode-yaml:0.4.0,redhat.vscode-openshift-connector:0.0.19"
        },

    The result should be something like this:

    {
      "defaultEnv": "default",
      "environments": {
        "default": {
          "machines": {
            "dev-machine": {
              "attributes": {
                "memoryLimitBytes": "2147483648"
              },
              "servers": {
                "eap": {
                  "port": "8080",
                  "attributes": {},
                  "protocol": "http"
                },
                "eap-debug": {
                  "port": "8000",
                  "attributes": {},
                  "protocol": "http"
                }
              },
              "volumes": {
                "m2": {
                  "path": "/home/jboss/.m2"
                },
                "javadata": {
                  "path": "/home/jboss/jdtls/data"
                }
              },
              "installers": [],
              "env": {}
            }
          },
          "recipe": {
            "type": "dockerimage",
            "content": "registry.redhat.io/codeready-workspaces/stacks-java-rhel8"
          }
        }
      },
      "projects": [],
      "name": "wksp-e1wz",
      "attributes": {
        "editor": "org.eclipse.che.editor.theia:next",
        "plugins": "che-machine-exec-plugin:0.0.1,ms-vscode.node-debug2:1.31.6,redhat.vscode-yaml:0.4.0,redhat.vscode-openshift-connector:0.0.19"
      },
      "commands": [
        {
          "commandLine": "mvn clean install -f ${current.project.path}/pom.xml",
          "name": "build",
          "attributes": {
            "goal": "Build",
            "previewUrl": ""
          },
          "type": "mvn"
        },
        {
          "commandLine": "${HOME}/stack-analysis.sh -f ${current.project.path}/pom.xml -p ${current.project.path}",
          "name": "dependency_analysis",
          "attributes": {
            "goal": "Run",
            "previewUrl": ""
          },
          "type": "custom"
        }
      ],
      "links": []
    }
  11. Open the new workspace. Voila, Che 7 IDE in CRW 1.2!

@MichalMaler
Copy link

I love that Voila! +5 points for Nick

@nickboldt
Copy link
Author

Haha, thanks. Now we just need to actually figure out the steps for this to work. :(

The walkthru above doesn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment