Deploy Your Shiny App on Saagie

1. Your Shiny App in a Docker Image

Your Dockerfile should look like:

FROM saagie/shiny4saagie
# You can also use saagie/shiny4saagie-supercharged with the pre-installed dependencies, or build your own intermediate layer that meets your needs.

# Install the R packages required by your Shiny app.
RUN R -e 'install.packages(c("DT", "magrittr"), repos="http://cloud.r-project.org")'

# Copy your Shiny app to /srv/shiny-server/myapp.
COPY myapp /srv/shiny-server/myapp

# Launch Shiny Server.
CMD ["/usr/bin/shiny-server.sh"]

Your Shiny app should reside in a folder named myapp next to the Dockerfile. If not, modify the Dockerfile accordingly.
Example of a folder structure: https://github.com/saagie/shiny4saagie-example.

You may build your Docker image either:

  • Locally (requires docker-engine)

  • On https://hub.docker.com (for now, you can only pull public images from the Saagie platform):

    • Upload your manually built Docker image

    • Or automatically build from a GitHub or Bitbucket repository

  • On an internal CI tool, such as https://jenkins.io/.

2. Deploy Your Shiny App on the Platform

2.1. Within the Manager

  • Pull from a public Docker hub repository:

    • The URL is docker-hub-username/docker-image-name:tag-name, where tag-name is optional.

    • The port is 3838.

  • Pull from an internal repository:

    • Example of URL to pull an image built internally with Jenkins: repos:5000/shiny4saagie-example.

    • The port is 3838.

2.2. Within Projects and Jobs

  1. On the The "Apps" page icon is a PC screen with a star in the middle. Apps page of your project, click New app to install a new app.

  2. Select the Docker app technology.

  3. Specify the name of your docker image. Try first with saagie/shiny4saagie:v2.

  4. Specify the expose HTTP port with the following configuration:

    • Port: 80

    • Name: Shiny

    • Inject base path variable: $SAAGIE_BASE_PATH

    • Rewrite mode: NO

    • Persistent storage: none

The URL of the Docker image must be as follows: <repository name>/<image name> and not https://hub.docker.com/r/<repository_name>/<image_name>.