Gitpod: Gitpod doesn't work well with jekyll

Created on 27 May 2020  路  9Comments  路  Source: gitpod-io/gitpod

Describe the bug

Using JEKYLL_ENV=development bundle exec jekyll serve to provide a theia preview of the website causes 404, because gitpod is using localhost:4000 that is not accesible to gitpod user.

This can either be workedaround using:

  • Firefox in noVNC
  • Rewriting the whole repository to accept special gitpod environment
  • Weird hack alike cat _config.yml | sed -E "s#^(url:\s{1})(\").*(\").*#\1\2$(gp url)\3#gm" > _config_gitpod.yml && JEKYLL_ENV=production bundle exec jekyll serve --config _config_gitpod.yml which is not acceptable for gitpod users.

Expected behavior

We need some way to display localhost:4000 in theia's preview, maybe some wrapper for theia's preview that points to $(gp url) everytime localhost is called on it?

Additional information

Blocks gidpodifying of https://github.com/CircuitVerse/Interactive-Book/pull/374

Example repository

https://gitpod.io#snapshot/d3a9516c-4be3-47b2-81dc-df4020ff4f57

networking stale ux

Most helpful comment

This is a problem on Jekyll's end for forcibly using localhost instead of the dynamic public address

All 9 comments

This is a problem on Jekyll's end for forcibly using localhost instead of the dynamic public address

@RDIL Possible i guess, what do you propose then?

cc @ChristinFrohne @uniminin @htes9

Maybe you鈥檝e already tried this, but Jekyll accepts a bind param eg

jekyll serve 鈥攈ost=0.0.0.0

That should listen on all interfaces.

@qnm Already tried.. The host can only point to localhost it seems even when i parsed an IPv4 of the workspace to it.

I don't see how this could be solved in the frontend. As long as the preview is running as an iframe (webview), we would need to intercept the requests to localhost which is not possible.
Therefore running a browser in the remote container and somehow showing the rendered ui in the browser seems to be the only generic solution. There is https://github.com/auchenberg/vscode-browser-preview based on chrome headless but also your VNC proposal seems similar.

FWIW I think patching the config in a gitpod config is not too bad either, but for instance the livereload would not work that way.

Trying the extension which on gitpod results in
image

trying to install chrome..

UPDATE: We can't install google chrome on crap 'o buntu without root

Setting up libappindicator3-1 (12.10.1+20.04.20200408.1-0ubuntu1) ...
Setting up google-chrome-stable (83.0.4103.97-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for libc-bin (2.31-0ubuntu7) ...
N: Download is performed unsandboxed as root as file '/workspace/gitpod-jekyll-test/google-chrome-stable_current_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
gitpod /workspace/gitpod-jekyll-test $ sudo apt-get install ./google-chrome-stable_current_amd64.deb ^C
gitpod /workspace/gitpod-jekyll-test $ chrome
bash: chrome: command not found
gitpod /workspace/gitpod-jekyll-test $ google-chrome-stable
[19580:19580:0607/113948.053323:ERROR:browser_main_loop.cc(1473)] Unable to open X display.
[0607/113948.069215:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
gitpod /workspace/gitpod-jekyll-test $ sudo google-chrome-stable
[19675:19675:0607/113956.872857:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
gitpod /workspace/gitpod-jekyll-test $ sudo google-chrome-stable --no-sandbox
[19749:19749:0607/114005.130425:ERROR:browser_main_loop.cc(1473)] Unable to open X display.
[0607/114005.144311:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
[0607/114005.144462:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

and even with that it doesn't work, because theia wants to use it's preview at all cost
image


Checking if vnc helps~

UPDATE: Seems that i've provided dependencies for the browser preview which now results in:

image

Provided snapshot to staging in developer chat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings