Creating a new workspace from the dashboard

This procedure describes how to create and edit a new Che 7.3 devfile using the Dashboard.

Prerequisites
  • A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che 'quick-starts'.

Procedure

To edit the devfile:

  1. In the Workspaces window, click the Add Workspace button.

  2. In the SELECT STACK list, select one of the default stacks.

    che stack list
  3. Click the Create & Proceed Editing button. The Workspaces → Configs page is shown.

    workspaces config page
  4. Change the workspace name and click the Devfile tab.

    workspace devfile tab
  5. Delete all the components and commands in the devfile to get an empty devfile.

    workspace empty devfile

Adding projects to your workspace

Prerequisites
Procedure

To add a project to your workspace:

  1. Click the Projects tab, and then click the Add Project button.

  2. Select the type of the project. Choose from: Samples, Blank, Git, GitHub, or Zip.

  3. Fill in the required details for the project type that you selected, and click the Add button.

    projects add project
  4. To add another project to the workspace, click the Add Project button.

  5. After configuring the project for the workspace, check the change in the devfile, which is the configuration file of the workspace, by opening the Devfile tab.

    devfile tab to view

Configuring the workspace and adding tooling

Adding plug-ins

Che 7.3 plug-ins replace Che 6.x installers. The following table lists the Che 7.3 plug-ins that have replaced Che 6.x installers.

Table 1. Che 7.3 plug-ins that have replaced Che 6.x installers
Che 6.x installer Che 7.3 plug-in

org.eclipse.che.ws-agent

Deprecated and not necessary

org.eclipse.che.terminal

Deprecated and not necessary anymore-

org.eclipse.che.exec

Che machine-exec Service

org.eclipse.che.ls.java

Language Support for Java

Prerequisites
Procedure

To add plug-ins to your workspace:

  1. Click the Plugins tab.

  2. Enable the plug-in that you want to add and click the Save button.

Defining the workspace editor

Prerequisites
Procedure

To define the editor to use with the workspace:

  1. Click the Editors tab.

    The recommended editor for Che 7.3 is Che-Theia.
  2. Enable the editor to add and click the Save button.

  3. Click the Devfile tab to view the changes.

    workspace devfile

Defining specific container images

Procedure

To add a new container image:

  1. Copy the following section from the devfile into components:

    - mountSources: true
       command:
         - sleep
       args:
         - infinity
       memoryLimit: 1Gi
       alias: maven3-jdk11
       type: dockerimage
       endpoints:
         - name: 8080/tcp
           port: 8080
       volumes:
         - name: projects
           containerPath: /projects
       image: 'maven:3.6.0-jdk-11'
  2. When using type: kubernetes or type: openshift, you must:

    • Use seperate recipe files.

      To use separate recipe files, the paths can be relative or absolute. For example:

      ...
          type: kubernetes
          reference: deploy_k8s.yaml
      ...
      ...
          type: openshift
          reference: deploy_openshift.yaml
      ...
    • Alternatively, add the content as referenceContent (the referenceContent field replaces the Che 6.x recipe content).

      che 6 workspace configuration
  3. Add a Che 6.x recipe content to the Che 7.3 devfile as referenceContent:

    1. Click the Containers tab (WorkspaceDetailsContainers).

      edit the container
    2. Copy the Che 6.x recipe, and paste it into the separate Che 7.3 component as a referenceContent.

      component as a referenceContent
    3. Set the type from the original Che 6.x configuration. The following is an example of the resulting file:

        type: kubernetes
        referenceContent: |
          apiVersion: v1
          kind: Pod
          metadata:
           name: ws
          spec:
           containers:
            -
             image: 'rhche/centos_jdk8:latest'
             name: dev
             resources:
             limits:
               memory: 512Mi
  4. Copy the required fields from the old workspace (image, volumes, endpoints). For example:

    workspace configuration che 6
    workspace devfile che 7
    Table 2. Сhe 6 and Сhe 7 equivalence table
    Che 6.x workspace configuration Che 7.3 workspace devfile

    environments['defaultEnv'].machines['target'].servers

    components[n].endpoints

    environments['defaultEnv'].machines['machineName'].volumes

    components[n].volumes

    environments['defaultEnv'].recipe.type

    components[n].type

    environments['defaultEnv'].recipe.content

    components[n].image

  5. Change the memoryLimit and alias variables, if needed. Here, the field alias is used to set a name for the component. It is generated automatically from the image field, if not set.

      image: 'maven:3.6.0-jdk-11'
      alias: maven3-jdk11
  6. Change the memoryLimit field to specify the RAM required for the component.

      alias: maven3-jdk11
      memoryLimit: 256M
  7. Open the Devfile tab to see the changes.

    devfile tab
  8. Repeat the steps to add additional container images.

Adding commands to your workspace

The following is a comparison between workspace configuration commands in Che 6.x (Figure 1) and Che 7.3 (Figure 2):

che 6 workspace configuration
Figure 1. An example of the Workspace configuration commands in Che 6.x
workspace devfile
Figure 2. An example of the Workspace configuration commands in Che 7.3
Table 3. Сhe 6 and Сhe 7 equivalence table
Che 6.x workspace configuration Che 7.3 workspace devfile

environments['defaultEnv'].commands[n].name

commands[n].name

environments['defaultEnv'].commands[n].actions.command

components[n].commandLine

Procedure

To define commands to your workspace, edit the workspace devfile:

  1. Add (or replace) the commands section with the first command. Change the name and the command fields from the original workspace configuration (see the preceding equivalence table).

    commands:
      - name: build
        actions:
          - type: exec
            command: mvn clean install
  2. Copy the following YAML code into the commands section to add a new command. Change the name and the command fields from the original workspace configuration (see the preceding equivalence table).

      - name: build and run
        actions:
          - type: exec
            command: mvn clean install && java -jar
  3. Optionally, add the component field into actions. This indicates the component alias where the command will be performed.

  4. Repeat step 2 to add more commands to the devfile.

  5. Click the Devfile tab to view the changes.

    workspace devfile changes
  6. Save changes and start the new Che 7.3 workspace.

    save and start the new che workspace
Tags: