question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to define a custom IDE in a devfile

See original GitHub issue

Is 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

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
The dockerfile I use

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:closed
  • Created a year ago
  • Comments:26 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
Deel96commented, Aug 29, 2022

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

0reactions
azatsarynnyycommented, Dec 7, 2022

@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 with type: main is used for opening an IDE.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize Your Own Online IDE with a Devfile - YouTube
Eclipse Che is an online IDE running in the cloud that can use VS Code ... What is Devfile and how do you...
Read more >
Devfile v2 and IDE plug-ins - Eclipse Che Blog
DevWorkspaces are custom Kubernetes resources and can be created/listed/deleted using any Kubernetes client like kubectl . A DevWorkspace is a ...
Read more >
DonSchenck/devfile-tutorial - GitHub
A tutorial to guide the user through the process of creating and using a custom devfile in Eclipse Che 7+ - GitHub ...
Read more >
Chapter 1. Customizing the devfile and plug-in registries
This section describes how to build a custom devfiles registry. Following operations are covered: Getting a copy of the source code necessary to...
Read more >
Devfile v2 and IDE plug-ins in Eclipse Che - Medium
To allow other projects to use a common definition, devfile has moved out of ... DevWorkspaces are custom kubernetes resources and can be ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found