Deploy Your Shiny App on Saagie
GitHub Projects:
Docker Hub Projects:
To deploy your Shiny apps on Projects and Jobs, you need to use the v2 GitHub branch, and the v2 Docker image tag. |
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
, wheretag-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
-
On the
Apps page of your project, click New app to install a new app.
-
Select the Docker app technology.
-
Specify the name of your docker image. Try first with
saagie/shiny4saagie:v2
. -
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> .
|