eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.95k stars 1.19k forks source link

Add support for devfiles with popular images e.g. ubuntu, debian #22862

Open olexii4 opened 6 months ago

olexii4 commented 6 months ago

Describe the bug

We cannot start a workspace with the che-code editor and a vanilla ubuntu or debian container.

Che version

7.82@latest

Steps to reproduce

  1. Create a gist with one of the standard images as a dev-container:
    schemaVersion: 2.2.0
    metadata:
    generateName: empty-ubuntu-
    components:
    - name: runtime
    container:
      image: docker.io/ubuntu:20.04
      args:
        - tail
        - '-f'
        - /dev/null

    or use the created one.

  2. Create a new workspace from the gist:
    {che-server}#https://gist.githubusercontent.com/olexii4/aafcb34e0a396a03f3e1bc644f10f624/raw/9386bac1621e7320c14c8b09163fd40cc68e1d16/devfile.yaml
  3. You will see an infinity loop after the workspace starts:

Empty ubuntu with Eclipse CHE

Nodejs starter with Eclipse CHE

Expected behavior

A new workspace should be started without any issues.

Runtime

OpenShift

Screenshots

Знімок екрана 2024-03-04 о 16 09 27 Знімок екрана 2024-03-04 о 16 11 05

Installation method

chectl/latest, chectl/next

Environment

Linux, macOS

Eclipse Che Logs

No response

Additional context

Empty ubuntu with Eclipse CHE

Nodejs starter with Eclipse CHE

ibuziuk commented 6 months ago

сс: @RomanNikitenko

RomanNikitenko commented 6 months ago

@ibuziuk I provided support for ubi9-based containers, but no one worked on ubuntu support.

So, I would say:

monaka commented 6 months ago

How about images provided by us PizzaFactory project ? We bake Debian, Ubuntu, and Alpine based images almost everyday.

https://github.com/pizzafactory-contorno

They are not UBI-like but only specific tools are contained (similar to ancient versions of che-images).

Even though I suppose you can make your swiss-army-knife from our base images. https://hub.docker.com/r/pizzafactory0contorno/piatto

RomanNikitenko commented 6 months ago

@monaka Hello!

We bake Debian, Ubuntu, and Alpine based images almost everyday. They are not UBI-like but only specific tools are contained

I think @olexii4 means that Che-Code should start in a vanilla ubuntu container, so like Che-Code should bring Node.js and all required libraries to a user's container.

olexii4 commented 6 months ago

The quick fix for bringing Node.js and all required libraries:

FROM docker.io/debian:buster

USER 0

RUN apt-get update && apt-get install -y curl && apt-get clean

ENV NODE_VERSION=v18.18.2
ENV NODE_DISTRO=linux-x64
ENV NODE_BASE_URL=[https://nodejs.org/dist/${NODE_VERSION}](https://nodejs.org/dist/$%7BNODE_VERSION%7D)

RUN curl -fsSL ${NODE_BASE_URL}/node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz -o node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz \
  && mkdir -p /usr/local/lib/nodejs \
  && tar -xzf node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz -C /usr/local/lib/nodejs \
  && rm node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz

ENV VSCODE_NODEJS_RUNTIME_DIR=/usr/local/lib/nodejs/node-${NODE_VERSION}-${NODE_DISTRO}/bin
ENV PATH=${VSCODE_NODEJS_RUNTIME_DIR}:$PATH
RomanNikitenko commented 6 months ago

Something similar I described in another issue for ubuntu https://github.com/eclipse/che/issues/22183#issuecomment-1527121963

monaka commented 6 months ago

I think @olexii4 means that Che-Code should start in a vanilla ubuntu container,

Hmm, but the quick fix that is shown by @olexii4 isn't a vanilla image...

so like Che-Code should bring Node.js and all required libraries to a user's container.

I'm not sure why this plan fixes the issue... It might be that I should dig a little deeper.

RomanNikitenko commented 6 months ago

but the quick fix that is shown by @olexii4 isn't a vanilla image...

I would say - it's a workaround

monaka commented 5 months ago

@RomanNikitenko I think I see the point of this issue. che-code should provide /checode/checode-linux-libc/{ubuntu|deibian|brah-brah}, right?

RomanNikitenko commented 5 months ago

@monaka

che-code should provide /checode/checode-linux-libc/{ubuntu|deibian|brah-brah}, right?

We use that approach for ubi8/ubi9.

In fact, to run Che-Code in a user's container we need:

At starting a workspace we copy Node.js + Che-Code assembly to a user's container. The problem is: Node.js relies on some shared libraries:

image

For example, it's possible to start a workspace for docker.io/ubuntu: 22.04 as a user's container. It means that docker.io/ubuntu: 22.04 has required libraries. At the same time it's impossible to start a workspace for the docker.io/ubuntu:20.04 based container - some libraries are absent in the image/container.

Node.js can not be run if a library is absent in a user's container.
So, we need a solution that will provide all required libraries to a user's container.

monaka commented 5 months ago

So, we need a solution that will provide all required libraries to a user's container.

Well. And it can be solved by ...

RomanNikitenko commented 5 months ago

@monaka We use such approach: https://github.com/che-incubator/che-code/blob/a711ca09a1e0a6e0ac3c2a88f17be2e5f6de679a/build/scripts/entrypoint-volume.sh#L94

monaka commented 5 months ago

I read https://github.com/che-incubator/che-code/pull/332 also. I suppose I can add some contributions to che-code, as some of my customers will want to use Ubuntu based images.

BTW... I guess there are similar issues in jetbrains-editor-images potentially, right?

RomanNikitenko commented 5 months ago

I suppose I can add some contributions to che-code, as some of my customers will want to use Ubuntu based images.

You are very welcome!

BTW... I guess there are similar issues in jetbrains-editor-images potentially, right?

If I'm not mistaken, it's an example of such problem: https://github.com/eclipse/che/issues/22847#issuecomment-1964310789

ibuziuk commented 2 months ago

@RomanNikitenko PTAL - https://github.com/jart/cosmopolitan/releases/tag/3.5.0

RomanNikitenko commented 2 months ago

@ibuziuk will explore it when come back to the current issue, thank you!

monaka commented 1 month ago

I checked to build Node with CosmoCC. I couldn't build the master branch of Node. Because the version of gcc/g++ in CosmoCC is too fresh to build Node. I suppose we need to build our CosmoCC with downgraded gcc/g++. (Or to send PR to nodejs/node, ... of course, it's a harder way...)