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

**URL:** <https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995>\
**Category:** Get Help\
**Tags:** question\
**Created:** [October 5, 2023, 3:46pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995 "2023-10-05T15:46:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandonbiggs](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/brandonbiggs/32/1696_2.png) [@brandonbiggs](https://discourse.openondemand.org/u/brandonbiggs)\
**Post date:** [October 5, 2023, 3:46pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/1 "2023-10-05T15:46:56Z")

</div>

I’m trying to setup a new interactive app. I’m looking at using [Open VSCode Server](https://github.com/gitpod-io/openvscode-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:

```auto
#!/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:

```auto
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.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/a/a51e953c6653d727eaf57e7dbaffbcaa4b92b1f1.png)

Any ideas?

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [October 5, 2023, 5:45pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/2 "2023-10-05T17:45:24Z")

</div>

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`:

> <https://github.com/OSC/bc_osc_codeserver/blob/master/view.html.erb>

---

<div class="post-metadata">

**Author:** ![brandonbiggs](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/brandonbiggs/32/1696_2.png) [@brandonbiggs](https://discourse.openondemand.org/u/brandonbiggs)\
**Post date:** [October 5, 2023, 5:54pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/3 "2023-10-05T17:54:42Z")

</div>

Hi Travis,

Thanks for the response. This is a problem I caused and not your fault, so no need to apologize for the trouble 😃 . 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 -

```auto
<%
  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>

```

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [October 6, 2023, 3:27pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/4 "2023-10-06T15:27:49Z")

</div>

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

In your `before.sh.erb` add

```auto
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.

---

<div class="post-metadata">

**Author:** ![brandonbiggs](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/brandonbiggs/32/1696_2.png) [@brandonbiggs](https://discourse.openondemand.org/u/brandonbiggs)\
**Post date:** [October 6, 2023, 9:18pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/5 "2023-10-06T21:18:27Z")

</div>

Yup, that’s absolutely it. Thanks Jeff!

---

<div class="post-metadata">

**Author:** ![brandonbiggs](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/brandonbiggs/32/1696_2.png) [@brandonbiggs](https://discourse.openondemand.org/u/brandonbiggs)\
**Post date:** [October 9, 2023, 5:50pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/6 "2023-10-09T17:50:10Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [October 9, 2023, 6:19pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/7 "2023-10-09T18:19:11Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![brandonbiggs](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/brandonbiggs/32/1696_2.png) [@brandonbiggs](https://discourse.openondemand.org/u/brandonbiggs)\
**Post date:** [October 9, 2023, 6:40pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/8 "2023-10-09T18:40:35Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/4/4c7da971022cf32f574dcb255885d25c11fbd39a.png)

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?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/e/e00d513a8b66117a2952e04a3b40d2a062c23e0f.png)

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [October 9, 2023, 6:46pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/9 "2023-10-09T18:46:03Z")

</div>

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.

> <https://github.com/OSC/ondemand/issues/2311>
>
> From discourse: https://discourse.openondemand.org/t/reverse-proxy-response-body…-substitution/2232
> 
> A quick synopsis of the problem statement is: Apps serve assets without the knowledge of being behind a proxy. 
> 
> So when they serve assets like so:
> 
> 
> \`\`\`xml
> \<link rel="stylesheet" media="all" href="/app/assets/cool.css"\>
> \<script src="/app/assets/cool.js"\>\</script\>
> \`\`\`
> 
> We need to inline edit these links like so:
> 
> 
> \`\`\`xml
> \<link rel="stylesheet" media="all" href="/node/abc/123/app/assets/cool.css"\>
> \<script src="/node/abc/123/app/assets/cool.js"\>\</script\>
> \`\`\`
> 
> Though this is likely not limited to assets. It's likely any relative \`href\` and \`src\`.
> 
> ┆Issue is synchronized with this \[Asana task\](https://app.asana.com/0/1201735133575781/1203792857236562) by \[Unito\](https://www.unito.io)

---

<div class="post-metadata">

**Author:** ![brandonbiggs](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/brandonbiggs/32/1696_2.png) [@brandonbiggs](https://discourse.openondemand.org/u/brandonbiggs)\
**Post date:** [October 9, 2023, 7:27pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/10 "2023-10-09T19:27:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [April 6, 2024, 7:28pm UTC](https://discourse.openondemand.org/t/interactive-app-stuck-on-starting-even-though-it-has-started/2995/11 "2024-04-06T19:28:12Z")

</div>

Closed on April 6, 2024, 7:28pm UTC

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