Skip to content

Latest commit

 

History

History

shinyproxy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

ShinyProxy

ShinyProxy is open-source and allows to deploy R/Shiny and Python apps via Docker images.

Add new apps to ShinyProxy

1. Create a Docker image of your app

First of all, create a Docker image of your app in your own computer and check if the web app launches in your own computer before continuing.

Afterwards, you need to move the Docker image to the app server. I suggest uploading your Docker image to DockerHub and tag it with its app version for future reference (e.g. nunoagostinho/psichomics:1.18.6). After being available in DockerHub, simply enter the app server via SSH and pull your Docker image there:

docker pull nunoagostinho/psichomics:1.18.6

2. Configure ShinyProxy in application.yml

Include a block of text related to your app in the app section, for instance:

  - id: psichomics
    description: Alternative splicing quantification, visualisation and analysis
    container-image: nunoagostinho/psichomics:1.18.6
    container-cmd: ["R", "-e", "psichomics::psichomics(host='0.0.0.0', port=3838)"]
    container-network: "${proxy.docker.container-network}"
    container-volumes: [ "/srv/apps/psichomics/data:/root/Downloads" ]
    template-properties:
      startup-time: 15s

Each app can have multiple configuration fields:

Field Description
id App identifier
display_name App display name (optional; display_name is id by default)
description App description
container-image Docker image of the app
container-cmd Command to start the Shiny/Python app (optional; use host 0.0.0.0 and port 3838)
container-network "${proxy.docker.container-network}" to pass Docker Compose network to Docker images
container-volumes Volumes/folders to mount in the Docker image
template-properties Custom properties defined in this project
startup-time Time taken to fill progress bar displayed while loading the app (optional; 5 seconds by default)
... Many more fields are available for ShinyProxy app configuration

After editing the file, restart ShinyProxy:

docker compose restart shinyproxy

3. Redirect from an URL location via Nginx (optional)

All apps in ShinyProxy are served via an intermediary path:

  • /app/appID: application with the site-wide navigation bar on top
  • /app_direct/appID: only the application itself

For an app to be available from /appID, use Nginx to redirect the path /appID to /app/appID using a 307 Temporary Redirect status code. To do so, open ../nginx/location_apps.conf and add the following command at the end of the file:

location = /appID { return 307 /app/appID; }

After saving the file, restart Nginx to test out your new link:

docker compose restart nginx

Update apps in ShinyProxy

  1. Pull the latest Docker image available to the app server
  2. Modify the container-image in application.yml to include the latest version of the Docker image (if applicable)
  3. Restart ShinyProxy: docker compose restart shinyproxy

Custom ShinyProxy HTML

Custom HTML pages are available in templates:

File Description
index.html Landing page with app list
app.html Apps
error.html Errors (e.g. 404 page not found)
fragments Reusable HTML code (page headers and navigation bar)
assets/shinyproxy.css CSS code

Error pages are shown when ShinyProxy is working. Otherwise, if ShinyProxy is down/unresponsive, a custom Nginx error is shown.

More HTML pages can be customised from ShinyProxy if needed: read ShinyProxy's custom HTML template.