|
3 | 3 |
|
4 | 4 | Keeping this in r.py would lead to cyclic imports. |
5 | 5 | """ |
| 6 | +from distutils.version import LooseVersion as V |
6 | 7 |
|
7 | | -# Via https://rstudio.com/products/rstudio/download-server/debian-ubuntu/ |
8 | | -RSTUDIO_URL = "https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.5001-amd64.deb" |
9 | | -# This is MD5, because that is what RStudio download page provides! |
10 | | -RSTUDIO_CHECKSUM = "d33881b9ab786c09556c410e7dc477de" |
11 | 8 |
|
12 | | -# Via https://www.rstudio.com/products/shiny/download-server/ |
13 | | -SHINY_URL = "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.12.933-amd64.deb" |
14 | | -SHINY_CHECKSUM = "9aeef6613e7f58f21c97a4600921340e" |
15 | | - |
16 | | -# Version of MRAN to pull devtools from. |
17 | | -DEVTOOLS_VERSION = "2018-02-01" |
| 9 | +def rstudio_base_scripts(r_version): |
| 10 | + """Base steps to install RStudio and shiny-server.""" |
18 | 11 |
|
19 | | -# IRKernel version - specified as a tag in the IRKernel repository |
20 | | -IRKERNEL_VERSION = "1.1" |
| 12 | + # Shiny server (not the package!) seems to be the same version for all R versions |
| 13 | + shiny_server_url = "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.17.973-amd64.deb" |
| 14 | + shiny_proxy_version = "1.1" |
| 15 | + shiny_sha256sum = "80f1e48f6c824be7ef9c843bb7911d4981ac7e8a963e0eff823936a8b28476ee" |
21 | 16 |
|
| 17 | + if V(r_version) <= V("4.1"): |
| 18 | + # Older RStudio and jupyter-rsession-proxy for v4.1 and below |
| 19 | + rstudio_url = "https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.3.959-amd64.deb" |
| 20 | + rstudio_sha256sum = ( |
| 21 | + "187af05cab1221282487fdc33f4b161484c3228eaade3d6697b1d41c206ee6d9" |
| 22 | + ) |
| 23 | + rsession_proxy_version = "1.4" |
| 24 | + else: |
| 25 | + rstudio_url = "https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2021.09.1-372-amd64.deb" |
| 26 | + rstudio_sha256sum = ( |
| 27 | + "c58df09468870b89f1796445853dce2dacaa0fc5b7bb1f92b036fa8da1d1f8a3" |
| 28 | + ) |
| 29 | + rsession_proxy_version = "2.0.1" |
22 | 30 |
|
23 | | -def rstudio_base_scripts(): |
24 | | - """Base steps to install RStudio and shiny-server.""" |
25 | 31 | return [ |
26 | 32 | ( |
27 | 33 | "root", |
28 | | - # Install RStudio! |
29 | 34 | r""" |
30 | | - curl --silent --location --fail {rstudio_url} > /tmp/rstudio.deb && \ |
31 | | - echo '{rstudio_checksum} /tmp/rstudio.deb' | md5sum -c - && \ |
32 | | - apt-get update > /dev/null && \ |
33 | | - apt install -y /tmp/rstudio.deb > /dev/null && \ |
34 | | - rm /tmp/rstudio.deb && \ |
35 | | - apt-get -qq purge && \ |
36 | | - apt-get -qq clean && \ |
37 | | - rm -rf /var/lib/apt/lists/* |
38 | | - """.format( |
39 | | - rstudio_url=RSTUDIO_URL, rstudio_checksum=RSTUDIO_CHECKSUM |
| 35 | + curl --silent --location --fail {rstudio_url} > /tmp/rstudio.deb && \ |
| 36 | + curl --silent --location --fail {shiny_server_url} > /tmp/shiny.deb && \ |
| 37 | + echo '{rstudio_sha256sum} /tmp/rstudio.deb' | sha256sum -c - && \ |
| 38 | + echo '{shiny_sha256sum} /tmp/shiny.deb' | sha256sum -c - && \ |
| 39 | + apt-get update > /dev/null && \ |
| 40 | + apt install -y /tmp/rstudio.deb /tmp/shiny.deb > /dev/null && \ |
| 41 | + rm /tmp/rstudio.deb && \ |
| 42 | + apt-get -qq purge && \ |
| 43 | + apt-get -qq clean && \ |
| 44 | + rm -rf /var/lib/apt/lists/* |
| 45 | + """.format( |
| 46 | + rstudio_url=rstudio_url, |
| 47 | + rstudio_sha256sum=rstudio_sha256sum, |
| 48 | + shiny_server_url=shiny_server_url, |
| 49 | + shiny_sha256sum=shiny_sha256sum, |
40 | 50 | ), |
41 | 51 | ), |
42 | 52 | ( |
43 | | - "root", |
44 | | - # Install Shiny Server! |
| 53 | + "${NB_USER}", |
| 54 | + # Install jupyter-rsession-proxy |
45 | 55 | r""" |
46 | | - curl --silent --location --fail {url} > {deb} && \ |
47 | | - echo '{checksum} {deb}' | md5sum -c - && \ |
48 | | - dpkg -i {deb} > /dev/null && \ |
49 | | - rm {deb} |
| 56 | + pip install --no-cache \ |
| 57 | + jupyter-rsession-proxy=={rsession_proxy_version} \ |
| 58 | + jupyter-shiny-proxy=={shiny_proxy_version} |
50 | 59 | """.format( |
51 | | - url=SHINY_URL, checksum=SHINY_CHECKSUM, deb="/tmp/shiny.deb" |
| 60 | + rsession_proxy_version=rsession_proxy_version, |
| 61 | + shiny_proxy_version=shiny_proxy_version, |
52 | 62 | ), |
53 | 63 | ), |
54 | | - ( |
55 | | - "${NB_USER}", |
56 | | - # Install nbrsessionproxy |
57 | | - r""" |
58 | | - pip install --no-cache-dir jupyter-server-proxy==1.4.0 && \ |
59 | | - pip install --no-cache-dir https://github.com/jupyterhub/jupyter-rsession-proxy/archive/d5efed5455870556fc414f30871d0feca675a4b4.zip && \ |
60 | | - pip install --no-cache-dir https://github.com/ryanlovett/jupyter-shiny-proxy/archive/47557dc47e2aeeab490eb5f3eeae414cdde4a6a9.zip && \ |
61 | | - jupyter serverextension enable jupyter_server_proxy --sys-prefix && \ |
62 | | - jupyter nbextension install --py jupyter_server_proxy --sys-prefix && \ |
63 | | - jupyter nbextension enable --py jupyter_server_proxy --sys-prefix |
64 | | - """, |
65 | | - ), |
66 | 64 | ( |
67 | 65 | # Not all of these locations are configurable; so we make sure |
68 | 66 | # they exist and have the correct permissions |
|
0 commit comments