RStudio in ShinyProxy (Container unresponsive)

Hi

I read the comments of this topic (A proxy for RStudio Server like ShinyProxy) - it didn’t help.

I will try to describe my situation:

System:
Windows + WSL2 + Ubuntu 20.04 + Docker Desktop (Expose daemon on tcp: // localhost: 2375 without TLS -> ON)

What has been done and is working:

  1. Created the /opt/R folder

  2. Rstudio

    Created the /opt/R/rstudio folder

    Dockerfile for rstudio:

    FROM rocker/rstudio
    
    RUN install2.r --error --skipinstalled \
        renv
    
    RUN echo "www-frame-origin=same" >> /etc/rstudio/disable_auth_rserver.conf
    

    Now if I write the commands:
    docker build -t rstudio .
    and
    docker run --rm -p 127.0.0.1:8787:8787 -e DISABLE_AUTH = true rstudio

    Then the server (itself, without shinyproxy) starts up!

  3. ShinyProxy

    Created a folder /opt/R/shiny-proxy

    Dockerfile for shinyproxy

    FROM openjdk:11-jre
    
    RUN mkdir -pv /opt/R/shiny-proxy
    RUN cd /opt/R/shiny-proxy && wget https://www.shinyproxy.io/downloads/shinyproxy-2.5.0.jar
    
    EXPOSE 8080
    
    WORKDIR /opt/R/shiny-proxy
    CMD ["java", "-noverify", "-jar", "shinyproxy-2.5.0.jar", "--spring.jmx.enabled=false", "--spring.config.location=./config/application.yml"]
    

    Docker-compose (in /opt/R)

    version: '2'
    
    services:
       shiny-proxy:
          build:
             context: ./shiny-proxy/
          image: shiny-proxy
          container_name: shiny-proxy-1
          restart: on-failure
          environment:
             R_USER_PASSWORD: pass
          volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - ./shiny-proxy/config:/opt/R/shiny-proxy/config
          ports:
            - "8080:3838"
    

    And I fill in the application.yml file

    server:
       forward-headers-strategy: native
    
    proxy:
      title: "Analyst module"
      template-path: ./templates
      landing-page: /
      heartbeat-rate: 10000
      heartbeat-timeout: 60000
      port: 3838
      authentication: simple
      container-wait-time: 30000
    
    docker:
       internal-networking: true
     
    admin-groups: admin
    
    users:
     - name: ruser
       password: pwd
       groups: admin
    
     specs:
     - id: "SEPARATOR_DEV"
       display-name: "Develop"
       logo-url: "code"
       
     - id: "rstudio"
       access-groups: [admin]
       display-name: "RStudio IDE"
       logo-url: "r project"
       description: "RStudio"
       container-image: rstudio
       port: 8787
       container-volumes: [ "/home/#{proxy.userId}:/home/#{proxy.userId}" ]
       container-env:
         USER: "#{proxy.userId}"
         DISABLE_AUTH: true
         WWW_ROOT_PATH: "#{proxySpec.containerSpecs[0].env.get('SHINYPROXY_PUBLIC_PATH')}"
    
    

    ShinyProxy has started successfully!

    image

    But RStudio doesn’t want to run in it!!!

    shiny-proxy-1  | 2021-09-12 14:38:43.265  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (2/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:38:45.267  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (3/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:38:47.268  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (4/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:38:49.269  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (5/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:39:01.282  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (6/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:39:03.283  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (7/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:39:05.285  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (8/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:39:07.286  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (9/15): http://7428710c6983:8787
    shiny-proxy-1  | 2021-09-12 14:39:09.287  WARN 1 --- [  XNIO-1 task-2] e.o.shinyproxy.ShinyProxyTestStrategy    : Container unresponsive, trying again (10/15): http://7428710c6983:8787
    

    Question: What do I need to write to make it work?

Hi

When using ShinyProxy with Docker and internal networking, you have to create a dedicated Docker network. See https://github.com/openanalytics/shinyproxy-config-examples/tree/master/02-containerized-docker-engine
Make sure to edit your application.yml file to include the container-network: sp-example-net option for every app (see the repo).

Creating your own docker-network didn’t help.

Solved the problem with colleagues. We created an .env-file, wrote the COMPOSE_PROJECT_NAME=test variable to it

Further in the docker-compose indicated: SHINY_PROXY_DOCKER_NETWORK: ${COMPOSE_PROJECT_NAME}_default

And in application.yml after port: 8787:
container-network: ${SHINY_PROXY_DOCKER_NETWORK}

1 Like

Same here still stuck while trying to figure out how to run RStudio in ShinyProxy.

Everything went fine for creating the image based on an renv.lock file.
I can access RStudio easily when launched with docker run.
But it’s still tricky to me how to configure the application.yml file.
I read a bunch of online posts but still fail (being stuck with ShinyProxy 2.3.0 surely do not help to try to launch an image based on rocker/rstudio:4.1.0).

Any updated guidelines on this topic ?

Best regards

Hi @Erwann_SCAON

I just did a test with ShinyProxy 2.3.0 and the rocker/rstudio:3.2.0 docker image, and everything works fine here.

Here is a minimal application.yml file that you can start with:

proxy:
  title: Open Analytics Shiny Proxy
  logo-url: https://www.openanalytics.eu/shinyproxy/logo.png
  landing-page: /
  heartbeat-rate: 10000
  heartbeat-timeout: 60000
  port: 8080
  authentication: simple
  admin-groups: scientists
  users:
  - name: jack
    password: password
    groups: scientists
  docker:
    cert-path: /home/none
    url: http://localhost:2375
    port-range-start: 20000
  specs:
  - id: rstudio
    container-image: rocker/rstudio:3.2.0
    container-env:
      DISABLE_AUTH: true
    port: 8787

I would advise to start testing with this configuration and then applying your modifications on top of it. Let us know if you get stuck somewhere and then we can further discuss.
Please note that we have a demo with rstudio: https://github.com/openanalytics/shinyproxy-rstudio-ide-demo . This version is only compatible with 2.5.0 and 2.6.0, but you can use older version of Rstudio as described here: https://github.com/openanalytics/shinyproxy-rstudio-ide-demo/tree/1.2.1335__3.6.0

Thanks for your reply, I’ll try it.

Ps: My previous post had a typo, I’m trying to use rocker/rstudio:4.1.0 (not 3.2.0)

Hi @Erwann_SCAON

With RStudio 4.1.0 you will have to use at least ShinyProxy 2.5.0. There may be some workarounds to make it work with 2.3.1, but I guess that would be more effort than using ShinyProxy 2.5.0

I don’t think there is an RStudio 4.1.0.

See https://support.rstudio.com/hc/en-us/articles/200716783-RStudio-IDE-Release-History