https://github.com/grst/rstudio-server-conda

Singularity를 사용하여 R studio 서버 실행하기

이 접근 방식을 사용하면 Rstudio 서버는 Singularity 컨테이너( rocker/rstudio 기반 )에서 실행됩니다.

Conda 환경은 컨테이너에 마운트됩니다. 즉, 패키지를 추가하기 위해 컨테이너를 다시 빌드할 필요가 없으며 install.packages문제 없이 사용할 수 있습니다. 컨테이너 기반 접근 방식에는 다음과 같은 이점이 있습니다.

용법

  1. 이 저장소 복제

    git clone [email protected]:grst/rstudio-server-conda.git
    cd rstudio-server-conda/singularity
    
  2. CONDA_PREFIX 대상 conda env를 활성화하거나 conda env의 위치를 가리키도록 환경 변수를 설정합니다 .

  3. 스크립트를 확인하세요 run_singularity.sh. 특히, 추가 바인드 마운트(예: 전역 데이터 디렉터리)를 추가해야 할 수도 있습니다.

  4. 스크립트를 실행합니다 run_singularity.sh. 컨테이너를 사용할 수 없는 경우 자동으로 컨테이너를 빌드합니다.

    PORT=8787 PASSWORD=notsafe ./run_singularity.sh
    
  5. Rstudio에 로그인

Podman/Docker로 Rstudio 서버 실행하기

Podman/Docker로 Rstudio 서버 실행

이 접근 방식은 Singularity 와 유사 하지만 대신 Docker 또는 Podman과 docker-compose.yml파일을 사용합니다.

용법

  1. 이 저장소 복제

    git clone [email protected]:grst/rstudio-server-conda.git
    
  2. rstudio 컨테이너 빌드(최신 버전의 rocker/rstudio를 가져오고 일부 사용자 정의 스크립트 추가)

    cd rstudio-server-conda/docker
    docker-compose build     # or podman-compose
    
  3. docker-compose.yml 파일을 프로젝트 디렉터리에 복사하고 경로를 조정합니다.

    데이터에 추가 볼륨을 추가할 수 있습니다.

    [...]
       ports:
          # port on the host : port in the container (the latter is always 8787)
          - "8889:8787"volumes:
          # mount conda env into exactely the same path as on the host system - some paths are hardcoded in the env.
          - /home/sturm/anaconda3/envs/R400:/home/sturm/anaconda3/envs/R400
          # Share settings between rstudio instances
          - /home/sturm/.local/share/rstudio/monitored/user-settings:/root/.local/share/rstudio/monitored/user-settings
          # mount the working directory containing your R project.
          - /home/sturm/projects:/projects
        environment:
          # password used for authentication
          - PASSWORD=notsafe
          # repeat the path of the conda environment (must be identical to the path in "volumes")
          - CONDAENV=/home/sturm/anaconda3/envs/R400
    
  4. Rstudio-server의 프로젝트별 인스턴스를 실행하세요.

    docker-compose up
    
  5. Rstudio에 로그인