Using ShinyProxy for web development

Hello all,
we are using ShinyProxy for some of our R and Python apps. Now, we would like to also bring some additional dockerized React JS application onto ShinyProxy. However, we receive the following error:

Container unresponsive, trying again (2/50): http://localhost:20000

The container starts via docker:

docker run -p 3838:3838 myname

My ShinyProxy appplication.yml contains the following app-specific part:

- id: myname
  display-name: myname
  container-cmd: ["npm", "start"]
  container-image: myname
  port: 3838

Any help would be highly appreciated!

Hi

First of all, this kind of applications should work. However, this error basically means that either ShinyProxy cannot connect to the container or that the container is returning an error response.
What often happens is that ShinyProxy is not requesting the app on the correct sub-path. In such cases the application returns a 404 and ShinyProxy thinks it’s unreachable.

Unfortunately this kind of issues are a bit harder to debug. To start, I would try to launch the application, and then check whether you can reach the application on http://localhost:20000. Make sure to try this on the host where ShinyProxy/Docker is running.
This should give some insight in why ShinyProxy is unable to reach your application.

You could also have a look at the logs of the Docker container. See the docker ps and docker logs command (e.g. https://docs.docker.com/engine/reference/commandline/logs/)

Hi,
Thank you very for the answer, really much appreciated and helpful! :slight_smile:
I tried to reach the application on http://localhost:20000 which failed. After changing the package.json so that my React app listens on port 20000 it worked. Is this the only way of making it work? Is there no way of using the standard React port (3000) instead?

Additionally, I am facing now an issue with some static files used by the React app i.e. localhost:8080/app/containername/static/js/bundle.js throws me a not found error. The path known by the proxy seems to be http://localhost:8080/app_direct_i/containername/_/static/js/bundle.js. Could you please help me to understand this path and how to fix it?

Thanks once again for your help and sorry if these are very basic questions. :slight_smile:

Hi

You should not have your app listening on port 20000, this port is used by ShinyProxy as a mapping to your application. If your application runs on port 3000, you need to change the configuration of ShinyProxy to use that port:

- id: myname
  display-name: myname
  container-cmd: ["npm", "start"]
  container-image: myname
  port: 3000

Regarding the paths: http://localhost:8080/app/containername/static/js/bundle.js will indeed not work. The app is loaded through http://localhost:8080/app_direct_i/containername/_/static/js/bundle.js, however typically this just works once you fix the issue with the port number.