Skip to content

Commit b2b0f75

Browse files
authored
Merge branch 'jupyterhub:main' into test_R_conda
2 parents 8a817eb + 4352535 commit b2b0f75

File tree

21 files changed

+265
-159
lines changed

21 files changed

+265
-159
lines changed

repo2docker/buildpacks/_r_base.py

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,64 @@
33
44
Keeping this in r.py would lead to cyclic imports.
55
"""
6+
from distutils.version import LooseVersion as V
67

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"
118

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."""
1811

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"
2116

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"
2230

23-
def rstudio_base_scripts():
24-
"""Base steps to install RStudio and shiny-server."""
2531
return [
2632
(
2733
"root",
28-
# Install RStudio!
2934
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,
4050
),
4151
),
4252
(
43-
"root",
44-
# Install Shiny Server!
53+
"${NB_USER}",
54+
# Install jupyter-rsession-proxy
4555
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}
5059
""".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,
5262
),
5363
),
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-
),
6664
(
6765
# Not all of these locations are configurable; so we make sure
6866
# they exist and have the correct permissions

repo2docker/buildpacks/conda/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ruamel.yaml import YAML
77

88
from ..base import BaseImage
9-
from .._r_base import rstudio_base_scripts, IRKERNEL_VERSION
9+
from .._r_base import rstudio_base_scripts
1010
from ...utils import is_local_pip_requirement
1111

1212
# pattern for parsing conda dependency line
@@ -356,15 +356,15 @@ def get_env_scripts(self):
356356
(
357357
"${NB_USER}",
358358
r"""
359-
mamba install -p {0} r-base{1} r-irkernel={2} r-devtools -y && \
359+
mamba install -p {0} r-base{1} r-irkernel=1.2 r-devtools -y && \
360360
mamba clean --all -f -y && \
361361
mamba list -p {0}
362362
""".format(
363-
env_prefix, r_pin, IRKERNEL_VERSION
363+
env_prefix, r_pin
364364
),
365365
)
366366
)
367-
scripts += rstudio_base_scripts()
367+
scripts += rstudio_base_scripts(self.r_version)
368368
scripts += [
369369
(
370370
"root",

0 commit comments

Comments
 (0)