Using ShinyProxy with multi-container app

Hi

I would like to use ShinyProxy for a shiny app that requires a multi-container setup. On my local machine I spin up the application using docker-compose, which launches a modified RStudio server container (based on the ropensci image) linked to neo4j running in in a separate container. Up to now I’ve been launching the shiny app manually from the RStudio web interface, and am now trying to implement this using ShinyProxy.

Pointers in how to specify the application.yml will be appreciated.

Thanks,
Armin

Hi @adeffur,

Here is one way to do it. In your application.yml file you can use a number of optional properties:

 - name: database-app
   display-name: Database App
   description: Shiny App that interacts with Database
   docker-cmd: ["R", "-e databaseApp::runDatabaseApp()"]
   docker-image: openanalytics/database-app
   docker-network-connections: [ "neo4j-net" ]
   docker-env-file: neo4j.env
   groups: [database_app_users]

the docker-network-connections will make sure your Shiny app docker container has a network interface that can connect to the neo4j-net network (i.e. to the container that will run the neo4j database). This is a network you should create in advance (on the Docker host) and within which you can then run the neo4j container. The docker-env-file is optional and allows you to store information that will be available as environment variables.

Hope this helps,
Tobias

Hi Tobias

Thanks for your reply. I think I’m making progress; here is what I have so far:
First, I bring up my neo4j container with docker-compose, and create the network “impi_default”.
The shiny app is run in a container called anima.
I have specified the following in the application.yml file

- name: anima
    display-name: anima
    description: ANIMA GUI interface
    docker-cmd: ["R", "-e shinyproxy::runApp('/home/rstudio/common/ANIMA_Apps/ANIMA_GUI3_new.R')"]
    docker-image: anmiatest/anima:v15
    docker-network-connection: [ "impi-default" ]
    docker-volumes: ["/Users/armindeffur/ANIMA/ANIMA_IMPI/data/source_data:/home/rstudio/source_data","/Users/armindeffur/ANIMA/ANIMA_IMPI/scripts:/home/rstudio/scripts","/Users/armindeffur/ANIMA/ANIMA_IMPI/output:/home/rstudio/output","/Users/armindeffur/ANIMA/common:/home/rstudio/common"]
    #docker-env-file: neo4j.env
    groups: scientists, mathematicians

When I try to launch the shiny app from the web interface this results in

Status code: 500
Message: Container did not respond in time

I suspect I am using the wrong command to launch the shiny app?

Many thanks for your help,

Armin

Hi @adeffur,

Good to hear you are making progress. Could there be a typo in the docker-image name (amniatest probably should be animatest)?

Best,
Tobias

Well spotted; the typo occurred at build time of the docker image and is therefore correctly specified.

Best, Armin

Another issue might be the docker command, e.g. in

you use shinyproxy package, but you probably meant shiny?

You can also try running the application manually (outside shinyproxy) as described in https://www.shinyproxy.io/troubleshooting/ with something like

sudo docker run -p 3838:3838 -v /Users/armindeffur/ANIMA/common:/home/rstudio/common R -e "shiny::runApp('/home/rstudio/common/ANIMA_Apps/ANIMA_GUI3_new.R')"