role-model / roleR

R package implementing the RoLE model
https://role-model.github.io/roleR
GNU General Public License v3.0
1 stars 2 forks source link

Docker Install w/ Full RoLE stack (including msprime) #105

Open diazrenata opened 1 year ago

diazrenata commented 1 year ago

What RMD did:

  1. Install Docker Desktop https://www.docker.com/products/docker-desktop/
  2. Launch Docker Desktop, go to Images, and search for rocker/rstudio and select the latest-daily tag. (This is important because the latest-daily build routinely supports both amd64 and arm64 architecture for the host machine. Most of the other builds only support amd64, and M1 Macs want arm.) Pull, then Run.
  3. On 'Run', under Optional parameters set the local port to 8787. You can also set a password for your session by entering the environment variable PASSWORD and choosing something. Otherwise it will be auto-generated.
  4. Once the container is running, click on the 8787:8787 link (or go to http://localhost:8787/ in a browser). Enter the password for the session. The user name is rstudio.
  5. In the R console run install_packages("remotes")
  6. Run remotes::install_github('role-model/roleR@nopika') (The nopika branch has removed the pika dependency, because pika depends on gmp, and installing gmp requires sudo permissions that seem...complicated on Docker. roleR only uses pika to generate a logseries SAD, so I ported the relevant code over from pika and removed it as a dependency).
  7. Now you have roleR running in your container! Hopefully.
diazrenata commented 1 year ago

Possible solution for #64.

Would involve merging #106.

isaacovercast commented 1 year ago

Inside a clean rocker/rstudio latest-daily image do all this:

msprime must be built from source on arm (no aarch64 package in conda-forge):

Works.

isaacovercast commented 1 year ago

I encapsulated all the changes needed into one shell script which is now stored in the roleR git repo inside the 'inst' directory. It should be smart enough to detect and work on arm vs x86. This runs everything and sets the environment so you can run the import(roleR) immediately:

Inside a fresh rocker/rstudio container, in the terminal window do this:

wget https://raw.githubusercontent.com/role-model/roleR/main/inst/role_rocker_intall.sh
bash role_rocker_install.sh
isaacovercast commented 1 year ago

Following this guide for modifying docker images. To get the role docker images pushed up to docker hub do this:

On a mac M1/M2:

Now do the same thing on a linux machine and replace mac-m1 with intel

On a headless box you can do this:

docker pull rocker/rstudio:latest-daily

# Do NOT include `--rm` in the run command or else the container you update will get auto-deleted. FML!
docker run -p 8787:8787 -e PASSWORD=rstudio mess-docker:intel

# Find the container hash of the running container
docker ps -a

docker exec -it <container_hash> /bin/bash

# Then run the install script
wget https://raw.githubusercontent.com/role-model/roleR/main/inst/role_rocker_intall.sh
bash role_rocker_install.sh
isaacovercast commented 1 year ago

FULL DOCKER IMAGE INSTALL AND PUSH INSTRUCTIONS:

docker install script

Following this guide for modifying docker images. To get the role docker images pushed up to docker hub do this:

On a mac M1/M2:

Now pull it and test it.

On intel: