datelife
is a software that gets all available information on time of
divergence of a group of lineages, and uses this information to date a
phylogenetic tree. Its functionalities can be accessed via the
datelife
R package, or
through datelife
’s
website, which is
constructed as an R shiny
application and is
containerized with
Docker,
i.e. “dockerized”, as explained
here.
This repository hosts the instructions for “dockerizing” datelife
,
which we whipped up by following diverse valuable
resources. The datelife
Docker allows anyone to set up
their own server for the datelife
web app anywhere. There are a few
alternative ways to do this. For all of them you require Docker Desktop
installed.
Table of Contents:
1. Setting up a prebuilt datelife
image
• Docker image datelife v0.5.0 about
2. Building a local datelife
image
3. Running multiple instances of the datelife
shiny
app
Ideally, the latest datelife
Docker image automatically builds and
uploads to bomeara/datelife’s Docker Hub (the Docker
cloud) with
pushes to this repository (the GitHub phylotastic/datelifedocker
repo). However, due to
changes on Docker’s product subscriptions, automatic builds are not
available for the moment (last updated on Oct 22, 2021). datelife v0.5.0
is the latest, locally built, manually uploaded Docker image,
and is hosted at lunasare/datelife’s Docker
Hub.
-
1.1. To download the prebuilt
datelife
Docker image from Docker Hub you need Docker desktop installed. Then, from terminal use thedocker pull
command: -
1.2. Now, you can start the image using
docker run
. You can do this in “bash mode” so you can look around (i.e., in the /srv dir for the shiny app): -
1.3. To start the image just in serve mode, do:
# docker pull bomeara/datelife
docker pull lunasare/datelife:v0.5.0
# docker run -t -i -p 80:3838 bomeara/datelife sh -c '/bin/bash'
docker run -t -i -p 80:3838 lunasare/datelife:v0.5.0 sh -c '/bin/bash'
Once you’ve finished looking around, just type exit
and you will be
logged out.
# docker run -t -i -d -p 80:3838 bomeara/datelife
docker run -t -i -d -p 80:3838 lunasare/datelife:v0.5.0
Go to http://localhost on any browser to checkout your Datelife website and shiny app running.
Argument -d
is optional, it stands for --detach
, allowing you to
keep on using your terminal while the DateLife website is being served.
Information on R packages used
Obtained with R by running the following from the datelifeweb project in RStudio:
renv::init()
deps <- unique(renv::dependencies()[,"Package"])
vers <- structure(lapply(deps[order(deps)], packageVersion), names = deps[order(deps)])
vers
$ape
[1] ‘5.5’
$datelife
[1] ‘0.5.0’
$datelifeplot
[1] ‘0.1.0’
$devtools
[1] ‘2.4.2’
$future
[1] ‘1.22.1’
$phangorn
[1] ‘2.7.1’
$phyloch
[1] ‘1.5.5’
$promises
[1] ‘1.2.0.1’
$renv
[1] ‘0.14.0’
$shiny
[1] ‘1.6.0’
$shinycssloaders
[1] ‘1.0.0’
$strap
[1] ‘1.4’
$stringr
[1] ‘1.4.0’
$utils
[1] ‘4.1.0’
Information on Docker software
Obtained with docker version
command from the terminal:
Client: Docker Engine - Community
Cloud integration: 1.0.7
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:12:42 2020
OS/Arch: darwin/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:15:28 2020
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
This is the option for developers, and local debugging. If you tried setting up a prebuilt Docker image and it fails, you should try this.
-
2.1. Make sure you have Docker desktop installed. Then, download the datelifedocker repository to your computer. One way is to type from the terminal:
-
2.2. Change directories to your newly created datelifedocker directory using
cd your_path/datelifedocker
, and build the DateLife Docker image with: -
2.3 Now you can start the DateLife server from your newly created Docker image with:
-
2.4. To explore the contents of the DateLife Docker image on terminal, you can do:
-
2.5. After building and making changes, you can push (if you have permissions) the new
datelife
Docker image to Docker hub with:
git clone https://github.com/phylotastic/datelifedocker.git
docker build -t datelife:[optional tag] .
To build with no cache (that is, rebuilding the image from scratch)
type docker build -t datelife --no-cache .
Note! Building with no cache will take about 2hrs and 36 min to run.
docker run -t -i -p 80:3838 datelife:[optional tag]
Go to http://localhost on any browser to checkout your Datelife shiny app running.
To stop serving, type Ctrl + c
or exit
docker run -t -i datelife:[optional tag] sh -c '/bin/bash'
If you want to explore a particular container, first list them all with
docker container ls
, and identify the container-name
of the one you
are interested in.
Then restart your container and execute it with:
docker container restart <container-name>
docker exec -it <container-name> sh -c '/bin/bash'
For more tips see how-do-i-get-into-a-docker-containers-shell and 15-docker-commands-you-should-know.
docker tag datelife:[version number] lunasare/datelife:[version number]
docker login
docker push lunasare/datelife:[version number]
Note! If you make any important changes to the dockerfile
, please
bump its version and document the changes on the section Docker image
DateLife of this README.
You can run multiple shiny app instances with:
docker-compose up -d --scale datelife=10 # for ten instances
-
4.1. Go to node where swarm is being managed. You can change the number of workers in replicas in the
docker-compose-swarm.yml
file. -
4.2. See how it’s doing with
-
4.3. And stop it with
sudo docker stack deploy --compose-file docker-compose-swarm.yml datelife
sudo docker stack services datelife
sudo docker stack rm datelife
For domain, *, @, www all resolve to datelife19.campus.utk.edu.
(yes,
with a period after edu) using CNAME
- https://www.r-bloggers.com/2021/05/dockerizing-shiny-applications/
- https://github.com/flaviobarros/shiny-wordcloud/blob/master/Dockerfile
- https://www.statworx.com/at/blog/how-to-dockerize-shinyapps/
- https://www.youtube.com/watch?v=ARd5IldVFUs
- https://hub.docker.com/u/rocker
- https://www.dabbleofdevops.com/blog/deploy-rshiny-with-the-rocker-shiny-docker-image
- https://blog.sellorm.com/2021/04/25/shiny-app-in-docker/
- https://juanitorduz.github.io/dockerize-a-shinyapp/
- https://bhoom.wordpress.com/2020/06/18/using-multiple-r-versions-with-docker-rocker-rstudio-project/
- https://githubmemory.com/repo/rocker-org/shiny/issues/92
- https://stackoverflow.com/questions/30172605/how-do-i-get-into-a-docker-containers-shell