Hi, I’m trying to run VSCode 4.9.1 (and also tried 4.6.0 to match existing threads about VSCode), but the issue I’m having isn’t a URL rewrite (as far as I know). It seems to be a password issue.
I won’t post all of the internal application files, but I am creating/setting a password in the before.sh.erb file, that password is being recognized in the script.sh.erb file (I print out the password to stdout just so I can see it being set).
The VSCode server launches, but when I click on the connection link in OOD, I’m taken to the ‘Welcome to code-server, Please log in below password was set from $PASSWORD’ screen. If I paste in the password that was printed in the output, I’m logged in and it seems to work.
Does anyone know how to get past the welcome screen and just have VSCode launch without that extra step?
It may be that you just need to ensure that password is posted to the app at launch.
You’ll have to edit the view.html.erb to have something like
<form id="<%= form_id %>" action="/rnode/<%= host %>/<%= port %>/login?to=" method="post" target="_blank">
<input type="hidden" name="password" value="<%= password %>">
<button class="btn btn-primary" type="submit">
<i class="fa fa-cogs"></i> Connect to VS Code
</button>
</form>
And I think that should do it.
If you’re using more than one version of codeserver and want to select that in the form there are some extra steps needed as well, but I’m reading this as just one version is used, is that correct?
well, step 1 is to see if the newer version works, then I’m going to see about making a multi-version app…but right now just trying to get the one working. Let me see what I find.
Hmm, ok, let me do some testing on my end. I’ve had to deal with this previously and the app can be finicky in these later version due to some upstream changes they made, sorry about the trouble.
Could I see the template/script.sh.erb file? Specifically the call to codeserver itself that is used and what options are being passed is what I am looking to see.
As a quick test I just manually started up vscode and got the login screen at the url:
localhost:9999 (it auto-redirects me to /login). I enter the password, and the URL changes to localhost:9999/?key=12345
However, if I try to directly use that URL on a new session, I still get the login screen, so that makes me think it’s a cookie being used. The URL gets rewritten when I do this to: localhost:9999/login?key=12345&to=, so that password can’t be entered directly on the URL.
I noticed there were a couple of extra lines in the view.html.erb that may have been the trick. Modifying the config files for our cluster, I was able to bring up code server 4.11 with no issue.
Side question, for installing extensions, the web page load that has the extension description won’t display. Does anyone have that working? I just get a ‘firefox can’t load this page’, then has a button to launch in a new window, and that doesn’t work either.
There is different logic VSCode uses to login. Here’s the if block we use for our different versions. That may fix the redirect issues too. If it doesn’t let me know what OnDemand version you’re on - we may have patched that issue (you see that there are duplicate rnode items in the URL).
You can hot patch your system if you need, but I don’t know if it’s suggestible or what side affects you’d have. If you do, please back up all the files you edit.
You’d probably need to edit the template (/opt/ood/ood-portal-generator/templates/ood-portal.conf.erb), not the resulting file (/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf).
You’d want to apply this patch that accounts for relative paths.
Those are just test files. Files we use to run and validate tests against, so there’s no issue there. /opt/ood/ood-portal-generator/templates/ood-portal.conf.erb the only file you should need to update.