Interactive App stuck on "Starting" even though it has started?

I’m trying to setup a new interactive app. I’m looking at using Open VSCode Server rather than the code-server app. Open VSCode seems to work better with extensions than code-server.

My script.sh.erb with hard coded values to test:

#!/usr/bin/env bash

# Start Code Server.
module load singularity
singularity exec -B /apps /path/to/open-vscode.sif \
/opt/openvscode-server-v1.82.2-linux-x64/bin/openvscode-server \
    --host="0.0.0.0" \
    --port=4567 \
    --disable-telemetry \
    --connection-token=test

in output.log it appears to be running:

Server bound to 0.0.0.0:4567 (IPv4)
Extension host agent listening on 4567

[09:35:37] 

Web UI available at http://localhost:4567/?tkn=test
[09:35:37] Extension host agent started.

If I run the singularity server start command on the command line, it starts and I can connect as expected, but for some reason it doesn’t change from the “starting” status when I run it through ood.

Any ideas?

Hi, sorry for the trouble.

So I make sure I understand, the app will launch but never show a connect button, however if you run from the command line you can connect? Is that right?

The way those cards are handled is a bit tricky, but basically they are generated dynamically by a controller. That controller does in fact check for a session.running? || session.starting? to then change the job to “running” based on some logic which relies on a call to OodCore::Job:Info to figure out what state things are in.

I’m thinking that the call is never returning the info and so OOD doesn’t think the connection is ready, but I want to make sure I understand the flow here first.

Also, does your app have a view file? That should be what populates the actual connect button itself, while the above logic I mentioned handles the status in the upper right corner.

For instance, here’s the view for the bc_osc_codeserver:

1 Like

Hi Travis,

Thanks for the response. This is a problem I caused and not your fault, so no need to apologize for the trouble :smiley: . Thanks for taking the time to help.

The app doesn’t launch, it just sits at “starting”. But the job is running on the server and the “Time remaining” value on the card is ticking down.

I’m thinking that the call is never returning the info and so OOD doesn’t think the connection is ready, but I want to make sure I understand the flow here first.

I think you’re correct. I’m not sure why the call isn’t returning the info to OOD.

Also, does your app have a view file? That should be what populates the actual connect button itself, while the above logic I mentioned handles the status in the upper right corner.

Yes it does. I modified the original view that you posted, but I believe I changed four lines which I mentioned in the code below -

<%
  require 'digest'

  # Generate form id, based on host and port
  form_id = Digest::SHA1.hexdigest("--" + host.to_s + "--" + port.to_s + "--")

  # Generate SHA256 digest of Code Server Password
  cookieValue = Digest::SHA256.hexdigest(password)
%>

<script type="text/javascript">
(function () {
  let date = new Date()
  date.setTime(date.getTime() + (7*24*60*60*1000))
  let expires = "expires=" + date.toUTCString()
  //let cookiePath = "path=/rnode/" + "<%= host.to_s %>" + "/" + "<%= port.to_s %>/";
  // Note from Brandon - The path to the Open VSCode is a little different. it's host.example.com:PORT/tkn=PASSWORD
  let cookiePath = "path=/rnode/" + "<%= host.to_s %>" + ":" + "<%= port.to_s %>/";
  /**
    We have to use "key" as the cookie name since upstream in cdr/code-server
    the authentication cookie is hard coded "key"
  */
  // Commented these out since I didn't think we needed to set a cookie for this different application?
  //let cookie = `key=<%= cookieValue %>;${expires};${cookiePath};secure`;
  //document.cookie = cookie;
})();
</script>

// Changed the below line
<!--<form id="<%= form_id %>" action="/rnode/<%= host %>/<%= port %>/" method="get" target="_blank">-->
<form id="<%= form_id %>" action="/rnode/<%= host %>:<%= port %>/?tkn=test" method="get" target="_blank">
  <button class="btn btn-primary" type="submit">
    <i class="fa fa-cogs"></i> Connect to VS Code
  </button>
</form>

You’re issue is that you’ve never exported your port.

In your before.sh.erb add

export port=4567

Then use the $port environment variable in your command to boot the container.

OOD goes from Starting → Running based on the connection.yml file. Basically if there’s not enough information here in the connection.yml OOD won’t create the buttons to connect to it.

We’re not going to change the state to Running because we don’t know how to connect to the application.

So it’s a simple fix - export the port variable in your before.sh.erb such that the connection.yml does actually get populated with the correct information.

1 Like

Yup, that’s absolutely it. Thanks Jeff!

@jeff.ohrstrom Sorry one more question. Once I exported port I can launch the app, but the new issue I’m running into is the app not being able to access css/javascript. The css/javascript is trying to source example.com/stable-5e932f3b43c571637a183861652b0909ef6da48c/static/out/vs/loader.js

I tried comparing this to Jupyter. Jupyter’s path is example.com/node/compute_node/port/lab and when I inspect the page, the css/javascript is sourced from /node/compute_node/port/static/lab/main....

How does OnDemand fix these paths for CSS/JS? I’m also getting an error about manifest.json not being found? Not sure if that’s related or not?

Yes this has to do with /rnode and /node configurations.

In the one case - /rnode (relative node) - the origin server (the application, code server in this case) doesn’t know it’s behind a proxy server. So apache eats the URL’s relative location. So a request from the client like /rnode/somehost/1234/cool.css gets chewed up and the origin server only sees the request path as /cool.css.

Rstudio is an example of this.

The other - /node - the origin server (the application, code server in this case) does in fact know that it’s behind proxy and the URL paths remain unchanged because the app knows that it has a base path that’s not it’s own.

Juypter does this through a configuration, base_url.

Okay, that makes sense. I’ll need to use /rnode then since code server doesn’t know it’s behind a proxy server.

Looking at the older code-server, it looks like all of the packages are under rnode/HOST/port/... and these can files be found/the app works fine.

But using the open code server, these files don’t seem to be getting shared even though I’m using rnode? I must still be missing something?

Look in your network tab to see the requests being fired and the resulting response codes (most likely 404s).

Then you’ll likley need to turn on verbose logging on the app to see what it’s seeing (specifically what URL path requests are being made).

Lastly - you may just be running into the issue below which we don’t have support for yet.

1 Like

Thanks Jeff. I’ll ask the devs and continue looking into this. I appreciate your responses. Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.