Skip to content

Reviewing submitted vignettes using Docker

Zhian N. Kamvar edited this page May 18, 2018 · 1 revision

The website for popgenInfo is built using Docker. It starts with the tidyverse container from rocker (https://www.rocker-project.org/) and builds population genetics packages on top to create the hlapp/rpopgen container.

Because the tidyverse container also contains an instance of RStudio Server, it is possible to test a vignette submission without needing to have an updated version of R or RStudio installed.

What you will need

  1. Docker Community Edition https://www.docker.com/community-edition#/download
  2. A command line utility
  3. The latest hlapp/rpopgen container (docker pull hlapp/rpopgen:latest)
  4. A web browser

Step 1: Download or clone the contributor's repository into a new directory

For this example, assume that we want to download the 2018-new-vignette branch from USER's repository:

If you have git installed

You can follow the steps of cloning a repo from github followed by checking out the correct branch.

$ git clone [email protected]:USER/popgenInfo.git
$ cd popgenInfo
$ git checkout 2018-new-vignette # use the actual branch name here

If you do not have git

You can download the correct branch by navigating to https://github.com/USER/popgenInfo/archive/2018-new-vignette.zip. After you download it to your computer, unzip it and navigate to the new folder on your command line.

Step 2: Start Docker and launch RStudio server

Here, you should pull the latest version of the rpopgen container and launch RStudio server from the Docker container, sharing your current working directory with the home directory of the docker container. This was adapted from the official Rocker documentation: https://www.rocker-project.org/use/shared_volumes/

$ docker pull hlapp/rpopgen:latest
latest: Pulling from hlapp/rpopgen
cc1a78bfd46b: Already exists
0ba218433470: Pull complete
790cfa104320: Pull complete
56b822abe53f: Pull complete
db6bd8d1d602: Pull complete
ca3069d42c5c: Pull complete
cfef6757038b: Pull complete
3e04e0930f8f: Pull complete
6c01da053d32: Pull complete
b81c24c1e740: Pull complete
119ffd8f4c77: Pull complete
d2ae76560fbd: Pull complete
2b4a54dbe9ee: Pull complete
cb419f75b632: Pull complete
Digest: sha256:4b48324b2ad5b2061c1dbf20e01f13deb4b965c3aa66892f94e29f4cd58e44d9
Status: Downloaded newer image for hlapp/rpopgen:latest

$ docker run --rm --name pgi -d -p 8787:8787 -v $(pwd):/home/rstudio/ hlapp/rpopgen:latest
2d9e0aa798aff41c90bcd9e3bc1594ad4e65bf7f1ffef216a81e63808e4814ed

This creates a named container called "pgi" that will automatically be cleaned up once stopped.

Step 3: Open RStudio server from your browser and begin review

Navigate your browser to localhost:8787 and enter the following credentials

Field Entry
User rstudio
Password rstudio

From there, RStudio should start in the directory. To allow for interactive exploration of the vignettes, type setwd("build") into your console. From there, you can either attempt to render the submitted vignette or step through it for your review.

Step 4: Cleanup

Once you are finished with your session, close your browser window and type

$ docker stop pgi

This will stop the container and remove it. Because you have linked your working directory, build artifacts will still be present. To clean them up you can use an incantation of git clean to clean up, or just delete the whole directory if it's not important.