Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Add devfile and doc for developing of Che Theia remote plugin mechani…
Browse files Browse the repository at this point in the history
…sm (#413)

* Add devfile and doc for developing of Che Theia remote plugin mechanism
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>

* chore(CONTRIBUTING.md): improve toc and title
  • Loading branch information
mmorhun authored and dmytro-ndp committed Sep 11, 2019
1 parent 843ac92 commit 3e39bf5
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 3 deletions.
39 changes: 36 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Contribute to Che-Theia
================

Table of contents

- [Introduction](#introduction)
- [Devfiles](#devfiles)
- [Contribute to Theia or Che-Theia extensions or built-in Che-Theia plugins](#contribute-to-theia-or-che-theia-extensions-or-built-in-che-theia-plugins)
- [Just want to build the plugin and run with the existing Theia image](#just-want-to-build-the-plugin-and-run-with-the-existing-theia-image)
- [How to develop Che Theia remote plugin mechanism](#how-to-develop-che-theia-remote-plugin-mechanism)

## Introduction

There are 3 contribution points:
- Theia
- Che-Theia extensions
Expand All @@ -19,7 +29,7 @@ Devfile could be launched through a factory or [chectl](https://github.com/che-i
$ chectl workspace:start -f devfiles/che-theia-all.devfile.yaml
```

## Devfile for contributing to Theia or Che-Theia extensions or Che-plugins
## Contribute to Theia or Che-Theia extensions or built-in Che-Theia plugins
> Note that this devfile is going to evolve very soon and be splitted into multiple devfiles.
The devfile: [<this.repo>/devfiles/che-theia-all.devfile.yaml](./devfiles/che-theia-all.devfile.yaml)
Expand Down Expand Up @@ -129,10 +139,33 @@ To start che-theia in `dev-mode` with yarn (not using the production che-theia g
Running dev theia would be located in the che-dev container and `theia-dev-flow` endpoint:
![Che-Theia-dev-endpoint](https://raw.githubusercontent.com/eclipse/che-theia/assets/theia-dev-flow-endpoint.png)



### Just want to build the plugin and run with the existing Theia image
If you do not have any changes on Theia or Che-theia extension, you could just build the plugins with `build ... containers-plugin` or `build ... factory-plugin`
and run these plugins with the existing che-theia app:
`run ... HOSTED che-theia + container-plugin` or `run ... HOSTED che-theia + factory-plugin`


## How to develop Che Theia remote plugin mechanism

_Please note, this section provides a flow how to develop remote plugin mechanism in Che Theia, but not a remote plugin._

First, create a workspace from prepared [devfile](https://github.com/eclipse/che-theia/blob/master/extensions/eclipse-che-theia-plugin-remote/devfile.yaml), which could be found in the `eclipse-che-theia-plugin-remote` extension folder.
When workspace is ready:
- Init Che Theia. This could be done with `che:theia init` command in `/projects/theia` folder or run the init command.
Che Theia sources will be awailable at `/projects/theia/che/che-theia`.
- Now one may make changes in Che Theia remote plugin mechanism in both (Che Theia and Remote plugin) sides.
- Build Che Theia from `theia-dev` container by executing `yarn` in `/projects/theia` folder or by running corresponding command.
- Put binaries (*.theia or *.vsix) of your remote plugin(s) into `/projects/remote-plugins/` directory.
Note that the plugin(s) shouldn't have any external dependencies.
For example, [this sample plugin](https://github.com/eclipse/che-theia-samples/tree/master/samples/hello-world-backend-plugin) might be used.
Or a user may generate one using `Generate Hello World plugin package` command.
- Run dev Che Theia and Remote plugins endpoint in `theia-dev` and `theia-remote-runtime-dev` containers correspondingly.
One may use predefined commands to start them.
- Open `theia-dev` route from `My Workspace` panel and test chenges.

Also it is possible to run watchers for remote plugin mechanism.
In `theia-dev` container run `npx run watch @eclipse-che/theia-remote` from `/projects/theia` folder to recompile the extension on changes made.
Also run `yarn watch` in `/projects/theia/examples/assembly` to bring the changes to Che Theia binaries.
If needed one may start watchers in plugin API extension: `npx run watch @theia/plugin-ext` from `/projects/theia` directory.
The commands for these actions are also available.
But please note, you have to restart server to which changes is made.
100 changes: 100 additions & 0 deletions extensions/eclipse-che-theia-plugin-remote/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: 1.0.0
metadata:
name: che-theia-remote-dev
projects:
- name: theia
source:
type: git
location: 'https://github.com/theia-ide/theia.git'
components:
- type: cheEditor
id: eclipse/che-theia/next
alias: theia-editor
- type: chePlugin
id: eclipse/che-machine-exec-plugin/next
- type: chePlugin
id: che-incubator/typescript/latest
memoryLimit: 2Gi
- type: dockerimage
image: eclipse/che-theia-dev:next
alias: theia-dev
mountSources: true
env:
- name: THEIA_PLUGIN_ENDPOINT_DISCOVERY_PORT
value: '2504'
memoryLimit: 3Gi
- type: dockerimage
image: eclipse/che-theia-dev:next
alias: theia-remote-runtime-dev
mountSources: true
env:
- name: THEIA_PLUGIN_ENDPOINT_DISCOVERY_PORT
value: '2504'
- name: THEIA_PLUGINS
value: 'local-dir:///projects/remote-plugins/'
memoryLimit: 1Gi
commands:
- name: Init Che Theia
actions:
- type: exec
component: theia-dev
command: 'che:theia init'
workdir: /projects/theia
- name: Clean Che Theia
actions:
- type: exec
component: theia-dev
command: 'che:theia clean'
workdir: /projects/theia
- name: Generate Hello World plugin package
actions:
- type: exec
component: theia-dev
command: 'yes | yo @theia/plugin && cp y/y.theia /projects/remote-plugins/hello-world-plugin.theia && rm -rf /tmp/y'
workdir: /tmp
- name: Build Che Theia
actions:
- type: exec
component: theia-dev
command: 'yarn'
workdir: /projects/theia
- name: Watch changes in Theia Remote Extension
actions:
- type: exec
component: theia-dev
command: 'npx run watch @eclipse-che/theia-remote'
workdir: /projects/theia
- name: Watch changes in Theia Plugin API Extension
actions:
- type: exec
component: theia-dev
command: 'npx run watch @theia/plugin-ext'
workdir: /projects/theia
- name: Watch changes in Theia assembly
actions:
- type: exec
component: theia-dev
command: 'yarn watch'
workdir: /projects/theia/examples/assembly
- name: Run Dev Theia
actions:
- type: exec
component: theia-dev
command: 'yarn theia start --hostname=0.0.0.0 --port=3130'
workdir: /projects/theia/examples/assembly
- name: Run Remote Theia Plugin Endpoint
actions:
- type: exec
component: theia-remote-runtime-dev
command: 'node plugin-remote.js'
workdir: /projects/theia/che/che-theia/extensions/eclipse-che-theia-plugin-remote/lib/node
- name: Terminate all in Dev Theia
actions:
- type: exec
component: theia-dev
command: 'killall node'
- name: Terminate all in Remote Theia Plugin Endpoint
actions:
- type: exec
component: theia-remote-runtime-dev
command: 'killall node'

0 comments on commit 3e39bf5

Please sign in to comment.