How to define a custom IDE in a devfile
See original GitHub issueIs there a current documentation for running a custom IDE? I only found an old version: https://www.eclipse.org/che/docs/che-7/end-user-guide/support-for-theia-based-ides/
I created an own devfile like mentioned in the docs with a reference URL. The editor auto insertes a pastebin url, which looks pretty empty: https://pastebin.com/raw/kYprWiNB
So I used the file from the docs an hosted my own file on pastebin. https://pastebin.com/raw/4YdE6DiT
When starting the workspace I get the error
Workspace emfcloud failed to start. Failed to start the workspace emfcloud, reason: Internal Server Error occurred, error time
Starting in verbose mode gives me the same. The dockerimage of the ide works locally without problems.
Possible reasons I found:
- For me it’s not 100% clear how the specify the image url, when it’s not a quay.io URL. I tried docker.io, registry.hub.docker.com but always get the error above, maybe the issues lays somewhere else?
At the moment I have a docker hub image from: https://hub.docker.com/repository/docker/browork/ide linked as registry.hub.docker.com/browork/ide
If I remove my changes
- type: cheEditor reference: ‘https://pastebin.com/raw/QFYWXJc0’
the workspace starts without a problem. If just use the 2 lines as a devfile I get the error above.
I’m testing this at the moment on Codeready Workspaces, but the issue above should be independent from it.
My devfile file:
metadata:
name: emfcloud
projects:
- name: nodejs-web-app
source:
location: 'https://codeready-codeready-workspaces-operator.apps.sandbox.x8i5.p1.openshiftapps.com/devfile-registry/resources/nodejs-nodejs-web-app-master.zip'
type: zip
components:
- type: cheEditor
reference: 'https://pastebin.com/raw/QFYWXJc0'
- id: vscode/typescript-language-features/latest
type: chePlugin
- id: ms-vscode/node-debug2/latest
type: chePlugin
- mountSources: true
endpoints:
- name: nodejs
port: 3100
memoryLimit: 512Mi
type: dockerimage
alias: nodejs
image: 'registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:4845d417584375398127969c06e42ad41cb22db21329eaf3fdf8ee99ed723b2b'
commands:
- name: 1. Run the web app (and download dependencies)
actions:
- workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
type: exec
command: npm install; nodemon app.js
component: nodejs
- name: 2. Download dependencies
actions:
- workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
type: exec
command: npm install
component: nodejs
- name: 3. Run the web app
actions:
- workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
type: exec
command: nodemon app.js
component: nodejs
- name: 4. Run the web app (debugging enabled)
actions:
- workdir: '${CHE_PROJECTS_ROOT}/nodejs-web-app/app'
type: exec
command: nodemon --inspect app.js
component: nodejs
- name: 5. Stop the web app
actions:
- type: exec
command: 'node_server_pids=$(pgrep -fx ''.*nodemon (--inspect )?app.js'' | tr "\\n" " ") && echo "Stopping node server with PIDs: ${node_server_pids}" && kill -15 ${node_server_pids} &>/dev/null && echo ''Done.'''
component: nodejs
- name: Attach remote debugger
actions:
- referenceContent: |
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Remote",
"address": "localhost",
"port": 9229,
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
type: vscode-launch
FROM ubuntu:18.04 AS cpp-theia-base
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y default-jdk maven && \
apt-get install wget build-essential cmake libopenblas-dev gnupg curl make git g++-multilib clangd-10 gdb -y
RUN update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-10 100
RUN curl -fsSL https://deb.nodesource.com/setup_10.x | bash - && \
apt-get install nodejs -y && \
npm install -g yarn
# Make readable for root only
RUN chmod -R 750 /var/run/
RUN useradd -ms /bin/bash theia
WORKDIR /coffee-editor
COPY --chown=theia:theia . .
USER theia
ENV test=2
RUN ./run.sh -bcf
WORKDIR /coffee-editor/web/browser-app
EXPOSE 3000
CMD yarn start --hostname 0.0.0.0
Issue Analytics
- State:
- Created a year ago
- Comments:26 (13 by maintainers)
Top GitHub Comments
Okay I found the problem. 512 MB for the container I took from vanilla che-theia was not enough for my custom ide since it also contains language servers. Sadly no errors pointed me this way. Maybe showing that a container is running close to its allowed ressources may be a nice feature. @azatsarynnyy Thank you so much for the help. I learned a lot about che in this issue and while debugging the problem. I have some more questions, but these are out of scope of this ticket.
Best Regards
@davidxwwang (1) - yes, it should be enough in most the cases (2) - you should expose the port your Theia editor is listening to. For Che-Theia, it’s set here (3) - there are a couple of options:
che-editor
URL parameter or.che/che-editor.yaml
file in the repo. See more details in the docs here (4) - when you start a Che Workspace, Che looks for a custom editor definition defined in the places mentioned in (3). Then, the custom editor Devfile becomes a part of the entire DevWorkspace custom resource definition used by the DevWorkspace Operator to deploy all the needed resources to a cluster. The endpoint withtype: main
is used for opening an IDE.