Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default-host - Some resources (css, js, images) in IDE does not work #14883

Closed
3 tasks done
sparkoo opened this issue Oct 14, 2019 · 6 comments
Closed
3 tasks done

Default-host - Some resources (css, js, images) in IDE does not work #14883

sparkoo opened this issue Oct 14, 2019 · 6 comments
Assignees
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.

Comments

@sparkoo
Copy link
Member

sparkoo commented Oct 14, 2019

Describe the bug

When running Che in default host, some resources, like images or css, do not work. I've found these affected components - welcome page, preview panel, about dialogue. Probably there is some more.

Url of affected resources does not include path part of the ingress.

As an example take logo image from help > about. It points to /webview/home/theia/node_modules/@eclipse-che/theia-plugin-ext/src/resource/che-logo-dark.svg, which does not exist. If I check theia-ide ingress for port 3100, I can see:

spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: serverb1jyhrrt-theia-ideejo
          servicePort: server-3100
        path: /serverb1jyhrrt-theia-ideejo/server-3100/(.*)

So the correct path here is /serverb1jyhrrt-theia-ideejo/server-3100/webview/home/theia/node_modules/@eclipse-che/theia-plugin-ext/src/resource/che-logo-dark.svg.

Che version

  • latest

Steps to reproduce

  1. deploy che in default-host mode
  2. start workspace
  3. go to help > about
  4. image is not loaded

Expected behavior

Resources should have correct paths and should be properly loaded. Server is sending this url in workspace config so Theia should be able to construct it:

{
  "runtime": {
    "machines": {
      "theia-ideejo": {
        "servers": {
          "theia": {
            "url": "http://192.168.122.66/serverb1jyhrrt-theia-ideejo/server-3100/",
            "attributes": {
              "internal": "false",
              "port": "3100",
              "discoverable": "false",
              "cookiesAuthEnabled": "true",
              "type": "ide",
              "secure": "true"
            }
          }
          ...

Runtime

  • minikube (include output of minikube version and kubectl version)

Screenshots

defaulthost

Installation method

helm upgrade --install che --force --namespace che \
--set global.ingressDomain=$(minikube ip) --set global.serverStrategy=default-host --set cheImage=eclipse/che-server:nightly \
--set cheDevfileRegistry.deploy=false --set che.workspace.devfileRegistryUrl=${DEVFILE_REGISTRY_URL} \
--set chePluginRegistry.deploy=false --set che.workspace.pluginRegistryUrl=${PLUGIN_REGISTRY_URL} \
deploy/kubernetes/helm/che/

Environment

   - [x] Linux

Additional context

#13647

@sparkoo sparkoo added the kind/bug Outline of a bug - must adhere to the bug report template. label Oct 14, 2019
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Oct 14, 2019
@ibuziuk ibuziuk added severity/P1 Has a major impact to usage or development of the system. team/platform and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Oct 14, 2019
@mmorhun mmorhun self-assigned this Nov 11, 2019
@mmorhun
Copy link
Contributor

mmorhun commented Nov 14, 2019

All missing objects on UI are supposed to be retrieved via webview mechanism.
At the moment all webview resources paths are absolute. Firstly I tried to change all paths to be relative and it worked for all the use-cases I've tested, but when I created PR in Eclipse Theia repo it turned out that such approach has pitfalls in some cases and has been tried (and then reverted) before.
Also there is PR in Eclipse Theia which reimplements webview plugin API according to the changes in VSCode spec and security requirements. So, after the PR is merged, by default, each webview instance will have a separate host ({{uuid}}.webview.{{hostname}} if be more specific) which is not compatible with single host strategy.
However, webviews hosts are configurable by env variable and it is possible to make everything work on single host (despite requires changes in Che Theia meta.yaml, because at the moment we cannot set env variables for IDE container from devfile). But it is not a way to go, because such approach completely looses security and any plugin would be able to access main Theia (and other plugins) data like cookies, local storage, etc.
For now I do not see a good solution for the current situation. @evidolob @l0rd @skabashnyuk do you have some ideas how we can deal with it?

@skabashnyuk
Copy link
Contributor

However, webviews hosts are configurable by env variable and it is possible to make everything work on single hos

How do you see that?

@mmorhun
Copy link
Contributor

mmorhun commented Nov 14, 2019

@skabashnyuk there is a small doc in the PR.

@skabashnyuk
Copy link
Contributor

So how THEIA_WEBVIEW_EXTERNAL_ENDPOINT will look like in devfile on plugin.yaml?

@mmorhun
Copy link
Contributor

mmorhun commented Nov 14, 2019

For now the only way is to edit meta.yaml of Che Theia.
When I tested it, I set THEIA_WEBVIEW_EXTERNAL_ENDPOINT to 192.168.99.103.nip.io (what is the 'single host').

@mmorhun
Copy link
Contributor

mmorhun commented Jan 20, 2020

Issue with logo in about dialog has been fixed.

For webview resources we have more specific issues:

@mmorhun mmorhun closed this as completed Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

5 participants