Much ado about scripting, Linux & Eclipse: card subject to change

2019-07-04

Creating your own devfile registry

Third in this series... how to create and deploy your own custom devfile registry, so you can include your own stacks out of the box inside Che 7.

Creating your own devfile registry

Prerequisites

You need a Kubernetes or OpenShift cluster (eg., minikube or minishift), into which you have installed Che. Follow the steps in this document to deploy Che.
Steps below can then be done to deploy a custom devfile registry to your cluster, and use it with Che.

Procedure

  1. git clone https://github.com/eclipse/che-devfile-registry/
    cd che-devfile-registry
  2. Make changes in the devfiles/ folder to add new or remove existing devfile folders from the registry.
  3. Build the image.
    This example uses a personal quay repository and an arbitrary tag ubi8-2, but you can use another image registry and path as needed.
    docker build . -f Dockerfile --no-cache \
      -t quay.io/nickboldt/che-devfile-registry:ubi8-2
  4. Push it to quay (or your image registry of choice)
    docker push quay.io/nickboldt/che-devfile-registry:ubi8-2
    Verify the image and tag you pushed are published, eg.,
    Verify the Repository Visibility is public, eg.,
  5. Remove any existing che-devfile-registry deployments.
    oc delete dc che-devfile-registry; \
    oc delete svc che-devfile-registry; \
    oc delete route che-devfile-registry; \
    sleep 5s
  6. Deploy the new che-devfile-registry.
    oc new-app -f deploy/openshift/che-devfile-registry.yaml \
      -p PULL_POLICY="Always" \
      -p IMAGE="quay.io/nickboldt/che-devfile-registry" \
      -p IMAGE_TAG="ubi8-2"; \
    sleep 5s
     
  7. You can browse the registry’s devfiles/index.json file to verify your new devfile is included.
  8. Update your config map to point to the new registry.
    oc set env dc/che CHE_WORKSPACE_DEVFILE__REGISTRY__URL=http://che-devfile-registry-che.192.168.99.112.nip.io/
  9. Check your Che deployment to see if the changes are live by creating a new workspace from your devfile registry:

    2019-06-29

    Discovering containers loaded by Che 7

    Second in this series... more tips for Che 7 on Minishift.

    Discovering containers loaded by Che 7

    Prerequisites

    You need a Kubernetes or OpenShift cluster (eg., minikube or minishift), into which you have installed Che.
    Follow the steps in this document to deploy Che. Steps below can be done in parallel to collect a list of containers involved in deployment.

    Procedure

    1. Once you have started your cluster, you can watch events and see which images are pulled. Start this in a console window before deploying Che to your cluster.
      oc project che
      oc get po
      oc get events -w | tee /tmp/minishift.log.txt
    2. Watch for lines containing the following lines to see what containers are pulled.
      Successfully pulled image "..."
        and
      Container image "..." already present on machine
    3. For example, this should extract just a list of pulled containers, including any duplicate re-pulls:
      cat /tmp/minishift.log.txt | \
        egrep "Successfully pulled image|Container image" | \
        sed -e 's#.*\(Successfully pulled image\|Container image\) "\(.\+\)\".*#\2#g'
    4. You can also look at the available images in the minishift docker context:
      eval $(minishift docker-env)
      docker images
    5. Next, using chectldeploy Che to your cluster and watch the events get logged.
    6. You can also see container events at this URL:
      • https://192.168.YOUR.IP:8443/console/project/che/browse/events

    Deploying Che 7 to Minishift with chectl

    With the Che 7 just around the corner, and the realisation that I miss writing, I've decided to resurrect this blog from the dead and start a series of Che 7 tips. 

    First up, the handful of steps required to get Che 7 running on Minishift 1.34 (OKD 3.11).

    ----

    Deploying Che 7 to Minishift with chectl

    Prerequisites

    You need the latest Minishift and chectl releases.
    Fetch them like this (or similar):
    cd ~/bin
    curl -sSL  https://github.com/che-incubator/chectl/releases/download/20190628062929/chectl-linux -o chectl
    chmod +x chectl
    cd /tmp
    curl -sSL https://github.com/minishift/minishift/releases/download/v1.34.0/minishift-1.34.0-linux-amd64.tgz -o minishift.tgz
    tar xvzf minishift.tgz
    mv minishift*/minishift ~/bin/
    chmod +x ~/bin/minishift

    Procedure

    1. Start up minishift.
      minishift
    2. Log in once startup is complete. NOTE: you need cluster admin priviledges.
      oc login 192.168.MY.IP:8433 -u system -p admin
    3. To watch the events and see which images are pulled, see this document.
    4. Deploy Che to minishift:
      chectl server:start -a minishift-addon -p minishift
    5. Fix the plugin registry URL to use the latest version:
      oc set env dc/che CHE_WORKSPACE_PLUGIN__REGISTRY__URL=https://che-plugin-registry.openshift.io/v3
      You can open the console for the che deployment to verify your change has been applied:
      • https://192.168.YOUR.IP:8443/console/project/che/edit/dc/che
      You should see:
      CHE_WORKSPACE_PLUGIN__REGISTRY__URL = https://che-plugin-registry.openshift.io/v3
    6. Wait for redeployment to complete.
    7. Once running, you can see your Che instance here:
      • http://che-che.192.168.YOUR.IP.nip.io/
    8. If you then add a new workspace, you can see even more images pulled in the openshift event log.