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

Create UBI based images for che-theia #13765

Closed
2 tasks
evidolob opened this issue May 15, 2019 · 29 comments
Closed
2 tasks

Create UBI based images for che-theia #13765

evidolob opened this issue May 15, 2019 · 29 comments
Assignees
Labels
area/editor/theia Issues related to the che-theia IDE of Che severity/P1 Has a major impact to usage or development of the system.
Milestone

Comments

@evidolob
Copy link
Contributor

We need eventually move to UBI images
With this issue we can start creating POC images for che-theia
Currently there are ubi8/nodejs-10, so we can start POC using that image as base image.
I propose to start with:

@mmorhun mmorhun self-assigned this Jun 10, 2019
@mmorhun
Copy link
Contributor

mmorhun commented Jun 14, 2019

To build theia image we need first build theia-dev because it is used for building of Che Theia from sources.

To build theia-dev based on UBI (nodejs-10) we lack at least two packages:

  • jq which is used for github quota analyzing
  • libxkbfile-devel - used to be able to build electron part of Theia

I've tried to leave theia-dev image based on Alpine node, and rework runtime theia image to UBI, but this doesn't work because of differences in system libs against which Theia was compiled and ran (musl libc vs glibc at least).

Using official nodejs image as a base for theia-dev is not a good option, because we need to patch it, at least git, which fails to clone with fatal: Unable to find remote helper for 'https'. Decided not to spend time on that.

The approach which works is to use CentOS as a base for theia-dev image (but in this case we must handle nodejs and yarn installation ourselves). Then use UBI (nodejs-10) for runtime theia image.

@benoitf benoitf transferred this issue from eclipse-che/che-theia Jul 5, 2019
@benoitf benoitf added area/editor/theia Issues related to the che-theia IDE of Che team/ide2 labels Jul 5, 2019
@l0rd l0rd added this to the 7.3.0 milestone Sep 26, 2019
@l0rd l0rd added team/productization severity/P1 Has a major impact to usage or development of the system. labels Sep 26, 2019
@nickboldt
Copy link
Contributor

nickboldt commented Sep 28, 2019

Work in progress started last week here:

https://github.com/redhat-developer/codeready-workspaces/tree/master/dependencies/che-theia

Current TODOs:

Theia-dev

  • do we need to build generator/eclipse-che-theia-generator.tgz ? or can we just get the sources and install the binary during theia build from npm (@eclipse-che/theia-generator), as we do for @theia/generator-plugin ? Yes, need to build it. Changed.

  • why hardcoded version @theia/generator-plugin@0.0.1-1540209403 vs. using latest? Using newer version from use the same version of... che-theia#458

  • find a RHEL 8 or EPEL 8 repo from which we can get libxkbfile-devel and libxkbfile rpms (Solution: use codeready-builder)

  • build theia-dev based on rhel in Jenkins - https://quay.io/repository/crw/theia-dev-rhel8?tab=tags

  • Collect the contents of these for use in Brew:
    . /home/theia-dev/.yarn-global/node_modules/
    . /usr/local/share/.cache/yarn/
    . /opt/app-root/src/.npm-global/ --> works locally and in sync job

  • Build in brew as triggered from Jenkins

  • publish theia-dev to Quay (so we can use it for CI & pre-GA Theia builds)

  • publish theia-dev to RHCC (so we can use it for GA Theia builds)

Theia

  • Figure out what the MONACO_CDN_PREFIX and CDN_PREFIX stuff is about
  • seems we don't care about this for Brew for now
  • fully remove all build ARGs ; use template -> Dockerfile generation instead
  • verify e2e tests can be disabled with --skip-test flag
  • why hardcoded versions @theia/generator-plugin@0.0.1-1562578105 typescript@2.9.2 vs. using latest? Why different from what's in theia-dev?? Fixed in use the same version of... che-theia#458
  • collect all npm deps into a tarball for use in Brew
    . /usr/local/share/.config/yarn/global/node_modules
  • publish theia to Quay (so we can use it for CI & pre-GA CRW builds)

@benoitf
Copy link
Contributor

benoitf commented Sep 30, 2019

generator was in a separated repository (ws-skeleton) and then published to npmjs

as it's now in che-theia repository, it should not be retrieved through npmjs

@benoitf
Copy link
Contributor

benoitf commented Sep 30, 2019

why hardcoded version @theia/generator-plugin@0.0.1-1540209403 vs. using latest?

to be sure that the version used is working as expected.

also let say you run the build 2 months later, it may not work at all

@AndrienkoAleksandr
Copy link
Contributor

AndrienkoAleksandr commented Sep 30, 2019

Collect the contents of these for use in Brew:
. /home/theia-dev/.yarn-global/node_modules/
. /usr/local/share/.cache/yarn/
. /opt/app-root/src/.npm-global/

I think from time to time content these folders changes and become outdated. Also If you want these folders in the some another images I think multi-stage build could help.

@AndrienkoAleksandr
Copy link
Contributor

Figure out what the MONACO_CDN_PREFIX and CDN_PREFIX stuff is about

To speed up che-theia loading we are caching che-theia scripts and push it to the CDN registry like artifact. Then on start theia browser downloads scripts from the closest CDN server, that why theia loading faster.

@nickboldt
Copy link
Contributor

why hardcoded version @theia/generator-plugin@0.0.1-1540209403 vs. using latest?

to be sure that the version used is working as expected.

also let say you run the build 2 months later, it may not work at all

Right but why a DIFFERENT version in che-theia/theia vs che-theia/theia-dev?

theia-dev: @theia/generator-plugin@0.0.1-1540209403
theia: @theia/generator-plugin@0.0.1-1562578105

Surely you want the same version in both? Seems like hardcoding this in the dockerfiles vs. in a package.json or yarn.lock is what's causing the mismatch (update one, forget the other) ?

@nickboldt
Copy link
Contributor

To speed up che-theia loading we are caching che-theia scripts and push it to the CDN registry like artifact. Then on start theia browser downloads scripts from the closest CDN server, that why theia loading faster.

I'm not sure we can do that for the product unless we have a RH-approved repo where we're publishing. What's the full URL of the CDN we're using?

@nickboldt
Copy link
Contributor

I think from time to time content these folders changes and become outdated. Also If you want these folders in the some another images I think multi-stage build could help.

No, I need to pull the contents of these folders so that I can push them into the Dockerfile build inside Brew. Brew can't see the outside world, so I need to tar up these node_modules and then push the tarball into pkgs.devel.redhat.com so we have a stored copy of the sources/binaries from which to build offline.

@nickboldt
Copy link
Contributor

nickboldt commented Sep 30, 2019

generator was in a separated repository (ws-skeleton) and then published to npmjs

as it's now in che-theia repository, it should not be retrieved through npmjs

Do you mean @eclipse-che/theia-generator or @theia/generator-plugin ?

If you mean @eclipse-che/theia-generator... should we also be building @theia/generator-plugin instead of installing it from npm?

Ref:

https://github.com/redhat-developer/codeready-workspaces/blob/master/dependencies/che-theia/dockerfiles/theia/Dockerfile#L127
and
https://github.com/redhat-developer/codeready-workspaces/blob/master/dependencies/che-theia/dockerfiles/theia-dev/Dockerfile#L71

@benoitf
Copy link
Contributor

benoitf commented Sep 30, 2019

@nickboldt

do we need to build generator/eclipse-che-theia-generator.tgz ?

yes it's part of the source code of this project.

should we also be building @theia/generator-plugin instead of installing it from npm?

no, because the source code is external to this repository: https://github.com/eclipse/theia-generator-plugin

@nickboldt
Copy link
Contributor

If "it's in another repo" was a reason not to build something, then the whole che-theia repo wouldn't exist. :P

I'm asking if it's better to use a specific binary, or to build from master. Since the version of the generator plugin is different in theia-dev vs. theia, I'd think at least we should standardize on a single version, if not using latest.

Would you agree? or is there some technical reason to have them different?

@benoitf
Copy link
Contributor

benoitf commented Sep 30, 2019

it should be the same version coming from npmjs for theia-generator-plugin in theia-dev and in theia

@nickboldt
Copy link
Contributor

@benoitf so you mean:

Instead of using
@theia/generator-plugin@0.0.1-1562578105
and
@theia/generator-plugin@0.0.1-1540209403

we should just pull the latest from npm ? or both should be using newer 1562578105 timestamp?

@benoitf
Copy link
Contributor

benoitf commented Sep 30, 2019

1562578105 timestamp

@benoitf
Copy link
Contributor

benoitf commented Sep 30, 2019

latest may pull unwanted versions and is not tagged/ reproducible build

@nickboldt
Copy link
Contributor

@nickboldt
Copy link
Contributor

nickboldt commented Oct 6, 2019

Sync/trigger job for theia: https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/crw-theia_sync-github-to-pkgs.devel/ is now working.

Latest tags (built locally, pushed manually): https://quay.io/repository/crw/theia-rhel8?tag=latest&tab=tags

However the build is still dying in Brew because node-gyp is trying to download stuff:

2019-10-06 03:54:41,669 - atomic_reactor.plugins.imagebuilder - INFO - --> RUN if [ -z $GITHUB_TOKEN ]; then unset GITHUB_TOKEN; fi &&     yarn
2019-10-06 03:54:42,190 - atomic_reactor.plugins.imagebuilder - INFO - yarn install v1.17.3
2019-10-06 03:54:42,279 - atomic_reactor.plugins.imagebuilder - INFO - $ node-gyp install
2019-10-06 03:54:42,543 - atomic_reactor.plugins.imagebuilder - INFO - gyp http GET https://nodejs.org/download/release/v10.14.1/node-v10.14.1-headers.tar.gz
2019-10-06 03:54:42,591 - atomic_reactor.plugins.imagebuilder - INFO - gyp WARN install got an error, rolling back install
2019-10-06 03:54:42,596 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! stack Error: connect ECONNREFUSED 104.20.22.46:443
2019-10-06 03:54:42,596 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
2019-10-06 03:54:42,596 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! System Linux 3.10.0-957.21.2.el7.x86_64
2019-10-06 03:54:42,596 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install"
2019-10-06 03:54:42,596 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! cwd /home/theia-dev/theia-source-code
2019-10-06 03:54:42,597 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! node -v v10.14.1
2019-10-06 03:54:42,597 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! node-gyp -v v3.8.0
2019-10-06 03:54:42,597 - atomic_reactor.plugins.imagebuilder - INFO - gyp ERR! not ok
2019-10-06 03:54:42,614 - atomic_reactor.plugins.imagebuilder - INFO - error Command failed with exit code 1.

-- http://download.eng.bos.redhat.com/brewroot/work/tasks/3375/23873375/x86_64.log

So probably have to prefetch https://nodejs.org/download/release/v10.14.1/node-v10.14.1-headers.tar.gz and use

npm config set nodedir /abs/path/to/node/sources
  or
npm config set tarball /abs/path/to/headers.tgz

Unless there's a better way, @benoitf ?

@nickboldt
Copy link
Contributor

nickboldt commented Oct 6, 2019

OK, got past the node-gyp download problem.

Next issue:

Couldn't find package "axios@0.18.1" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "clean-webpack-plugin@^0.1.19" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/api@^7.0.0-beta-4.0-80162ea6d2" required by "@eclipse-che/theia-preferences-provider-extension@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/api@latest" required by "@eclipse-che/che-theia-hosted-plugin-manager-extension@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/api@latest" required by "@eclipse-che/plugin@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/api@latest" required by "@eclipse-che/theia-dashboard-extension@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/api@latest" required by "@eclipse-che/theia-terminal@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/workspace-client@latest" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "@eclipse-che/workspace-client@latest" required by "@eclipse-che/theia-terminal@7.2.0" on the "npm" registry.
Couldn't find package "html-webpack-plugin@^3.2.0" required by "@eclipse-che/theia-assembly@0.11.0" on the "npm" registry.
Couldn't find package "ini@^1.3.5" required by "@eclipse-che/theia-git-provisioner@7.2.0" on the "npm" registry.
Couldn't find package "js-yaml@3.13.1" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "ts-loader@^4.1.0" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "typescript-formatter@7.2.2" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "typescript-formatter@7.2.2" required by "@eclipse-che/theia-remote@7.2.0" on the "npm" registry.
Couldn't find package "typescript-formatter@7.2.2" required by "@eclipse-che/theia-terminal@7.2.0" on the "npm" registry.
Couldn't find package "@types/js-yaml@3.11.2" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "webpack@^4.20.2" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "webpack-cli@^3.1.1" required by "@eclipse-che/theia-plugin-ext@7.2.0" on the "npm" registry.
Couldn't find package "xterm@3.9.2" required by "@eclipse-che/theia-terminal@7.2.0" on the "npm" registry.

Can we predeclare these dependencies in a yarn.lock or package.json and use that when setting up theia-dev so these will already be in the dev env? Or add them to the theia package.json and prefetch them before building theia?

For easier pasting, here's the uniq'd sort'd list:

 "axios@0.18.1" 
 "clean-webpack-plugin@^0.1.19" 
 "@eclipse-che/api@^7.0.0-beta-4.0-80162ea6d2" 
 "@eclipse-che/api@latest" 
 "@eclipse-che/workspace-client@latest" 
 "html-webpack-plugin@^3.2.0" 
 "ini@^1.3.5" 
 "js-yaml@3.13.1" 
 "ts-loader@^4.1.0" 
 "typescript-formatter@7.2.2" 
 "@types/js-yaml@3.11.2" 
 "webpack@^4.20.2" 
 "webpack-cli@^3.1.1" 
 "xterm@3.9.2" 

@nickboldt
Copy link
Contributor

Also can we use a version other than @latest ? That's great for CI but terrible for products. :) If so, how do we override that, and where?

@benoitf
Copy link
Contributor

benoitf commented Oct 6, 2019

I think it's solved with yarn offline / cache

@nickboldt
Copy link
Contributor

when/where do I have to run yarn to perform the caching? and from what folder do I then need to tar up the results? I know it's the weekend ... but your answers are not helpful :(

@benoitf
Copy link
Contributor

benoitf commented Oct 6, 2019

the yarn cache folder: https://github.com/benoitf/che-theia-brew/blob/master/build.sh#L70
(or yarn cache dir command)

for yarn offline:
https://github.com/benoitf/che-theia-brew/blob/master/conf/theia-dev/ubi8-brew/setup-extra.env

it will append --offline on every yarn commands

@benoitf
Copy link
Contributor

benoitf commented Oct 8, 2019

I've reworked che-theia docker image builds:
eclipse-che/che-theia#474

Found this issue with offline mode:
#14804

Here is a script to generate 'offline/ubi8 / brew compliant (hopefully) images'
https://github.com/benoitf/che-theia-brew

The build script is mostly composed of 3 parts:

  1. we clone che-theia repository (for now it’s my branch) and run yarn

  2. then, theia-dev, we generate a dry-run and use TMP_BUILDER_NAME to build an image “online” with ubi8. Once it is built, we extract cache/downloaded stuff and create assets. Then we create “real image” for ubi8 (ubi8-brew) with the name CHE_THEIA_DEV_IMAGE_NAME=“quay.io/codeready-workspaces/che-theia-dev:next” (configured at the top of the file)

  3. then theia: again, dry run. then two builds: one for the builder target, one for the runtime target. Extract assets from builder and runtime, generate offline/ubi8-brew image and build it with CHE_THEIA_IMAGE_NAME=“quay.io/codeready-workspaces/che-theia:next”

@nickboldt
Copy link
Contributor

nickboldt commented Oct 9, 2019

Thanks to Florent's hard work we have theia, theia-dev, theia-endpoint images now for CRW 2.0:

  • quay.io/crw/theia-rhel8:2.0-3 286.7 MB
  • quay.io/crw/theia-dev-rhel8:2.0-46 288.7M
  • quay.io/crw/theia-endpoint-rhel8:2.0-1 275.4 MB

@l0rd
Copy link
Contributor

l0rd commented Oct 10, 2019

@nickboldt @benoitf is there still something missing or we can close this issue?

@nickboldt
Copy link
Contributor

nickboldt commented Oct 11, 2019

Once Florent's code is in https://github.com/redhat-developer/codeready-workspaces-theia (including whatever magic is used to produce the Dockerfile and asset*.gz files for the theia-endpoint), we can resolve this. Currently the code in https://github.com/benoitf/che-theia-brew/tree/master/conf only covers Theia and Theia dev. Need all three.

Followup work in #14797

@nickboldt
Copy link
Contributor

Code is live in https://github.com/redhat-developer/codeready-workspaces-theia but not synced with pkgs.devel repos yet

@nickboldt
Copy link
Contributor

https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/view/CRW_CI/view/Pipelines/job/crw-theia_master/ builds theia-dev, theia, and the endpoint runtime binary, then triggers three brew builds and pushed them to brew. Resolving.

@nickboldt nickboldt modified the milestones: 7.3.0, 7.3.1 Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/theia Issues related to the che-theia IDE of Che severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

6 participants