diff --git a/lang/RStudio/README.md b/lang/RStudio/README.md index dad1afe1..22957b6e 100644 --- a/lang/RStudio/README.md +++ b/lang/RStudio/README.md @@ -1,43 +1,54 @@ # RStudio -RStudio is an Integrated Development Environment (IDE) for the R language. By containerizing RStudio, a scientist can leverage the reproducibility and portability of the Singularity platform, allowing them to build data visualizations and analysis tools and ensure that they behave exactly the same in a new environment. +RStudio is an Integrated Development Environment (IDE) for the R language. By containerizing RStudio, a scientist can leverage the reproducibility and portability of the Singularity platform, allowing them to build data visualizations and analysis tools and ensure that they behave exactly the same in a new environment. The definiton file affords some flexibility, allowing you to run RStudio several different ways: -## Instance: +## Instance + This will start up rstudio-server, on default port of 8787 -```$ singularity instance start rstudio.sif rs``` +```bash +singularity instance start \ + --bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server \ + RStudio.sif rs --server-user=$(whoami) --www-address=0.0.0.0 +``` + +## Run -## Run: This will run rstudio IDE -```$ singularity run rstudio.sif``` +```bash +singularity run rstudio.sif +``` + +## Exec -## Exec: Any program in the container, but specifically for running R directly. -```$ singularity exec rstudio.sif R -f myfile.r``` +```bash +singularity exec rstudio.sif R -f myfile.r +``` To build the image run: -```$ sudo singularity build rstudio.sif RStudio.def``` +```bash +sudo singularity build rstudio.sif RStudio.def +``` When you use run for the IDE, you may need to execute it like: +```bash +SINGULARITYENV_DISPLAY=${DISPLAY} \ + singularity run rstudio.sif +``` -```$ SINGULARITYENV_DISPLAY=${DISPLAY} \ - singularity run rstudio.sif``` - -This is needed only if the `DISPLAY` environment variable does not automatically propagate from your host environment to the container. +For a modification of rstudio-server, for example to run on port 9999: -For a modification of rstudio-server, you can create a `rstudio.conf` file, and bind mount it into the container. For example to run on port 9999: - - -```$ echo "www-port=9999" > rserver.conf -$ singularity instance start \ - -B rserver.conf:/etc/rstudio/rserver.conf \ - rstudio.sif rs``` +```bash +singularity instance start \ + --bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server \ + RStudio.sif rs --server-user=$(whoami) --www-address=0.0.0.0 --www-port=9999 +``` You will then access your rstudio-server instance at: [http://localhost:9999](http://localhost:9999) - diff --git a/lang/RStudio/RStudio.def b/lang/RStudio/RStudio.def index a0fdb698..468fbb5f 100644 --- a/lang/RStudio/RStudio.def +++ b/lang/RStudio/RStudio.def @@ -1,21 +1,35 @@ Bootstrap: library -From: debian:9 +From: ubuntu:22.04 %environment - LC_ALL="C" + LANG=en_US.UTF-8 + LC_ALL="en_US.UTF-8" + export LANG export LC_ALL %post - apt-get update - apt-get -y install systemd systemd-sysv gdebi-core procps libssl1.1 ed wget curl libqt5webkit5 libqt5core5a - apt-get -y install r-base r-base-dev + export DEBIAN_FRONTEND=noninteractive + export TZ=Etc/UTC + apt update -qq + apt install -y --no-install-recommends software-properties-common dirmngr wget locales - curl https://download1.rstudio.org/rstudio-xenial-1.1.456-amd64.deb > /rstudio-1.1.456-amd64.deb - apt-get -y install /rstudio-1.1.456-amd64.deb + wget -qO- \ + https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | \ + tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc + add-apt-repository -y "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" + apt install -y --no-install-recommends r-base r-base-dev - wget -O /rstudio-server-stretch-1.1.456-amd64.deb \ - https://download2.rstudio.org/rstudio-server-stretch-1.1.456-amd64.deb - gdebi -n /rstudio-server-stretch-1.1.456-amd64.deb + wget -O /rstudio-2023.03.0-386-amd64.deb \ + https://download1.rstudio.org/electron/jammy/amd64/rstudio-2023.03.0-386-amd64.deb + apt -y install /rstudio-2023.03.0-386-amd64.deb + + wget -O /rstudio-server-2023.03.0-386-amd64.deb \ + https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2023.03.0-386-amd64.deb + apt install -y gdebi-core + gdebi -n /rstudio-server-2023.03.0-386-amd64.deb + + # Log to stderr + echo "[*]\nlog-level=error\nlogger-type=stderr\n" > /etc/rstudio/logging.conf # Setup the "general" CRAN repo echo 'local({ @@ -24,22 +38,14 @@ From: debian:9 options(repos = r) })' >> /etc/R/Rprofile.site - # We are setting up a normal user for access - # Login: rstudio Password: rstudio - useradd -c "RStudio Account" -u 500 -d /home/rstudio -s /bin/bash rstudio - echo "rstudio:rstudio" | /usr/sbin/chpasswd - - # Move systemd service file into place - cp /usr/lib/rstudio-server/extras/systemd/rstudio-server.service /lib/systemd/system/ - systemctl enable rstudio-server + # Prepare system to use UTF-8 + sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen && update-locale # Remove unneeded source packages - rm -f /rstudio-1.1.456-amd64.deb - rm -f /rstudio-server-stretch-1.1.456-amd64.deb + rm -f /rstudio*.deb %runscript /usr/bin/rstudio "$@" %startscript - /usr/lib/rstudio-server/bin/rserver - + /usr/lib/rstudio-server/bin/rserver --server-user=$(whoami)"$@"