Merge pull request #320 from ryanlovett/master

Support shiny apps
pull/323/head
Tim Head 2018-05-26 06:09:46 +02:00 zatwierdzone przez GitHub
commit d4c9c8858a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 38 dodań i 1 usunięć

Wyświetl plik

@ -129,6 +129,10 @@ class RBuildPack(PythonBuildPack):
# This is MD5, because that is what RStudio download page provides!
rstudio_checksum = '24cd11f0405d8372b4168fc9956e0386'
# Via https://www.rstudio.com/products/shiny/download-server/
shiny_url = 'https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb'
shiny_checksum = '78371a8361ba0e7fec44edd2b8e425ac'
# Version of MRAN to pull devtools from.
devtools_version = '2018-02-01'
@ -156,6 +160,20 @@ class RBuildPack(PythonBuildPack):
rstudio_checksum=rstudio_checksum
)
),
(
"root",
# Install Shiny Server!
r"""
curl --silent --location --fail {url} > {deb} && \
echo '{checksum} {deb}' | md5sum -c - && \
dpkg -i {deb} && \
rm {deb}
""".format(
url=shiny_url,
checksum=shiny_checksum,
deb='/tmp/shiny.deb'
)
),
(
"root",
# Set paths so that RStudio shares libraries with base R
@ -187,7 +205,16 @@ class RBuildPack(PythonBuildPack):
devtools_version=devtools_version,
irkernel_version=irkernel_version
)
)
),
(
"${NB_USER}",
# Install shiny library
r"""
R --quiet -e "install.packages('shiny', repos='https://mran.microsoft.com/snapshot/{}', method='libcurl')"
""".format(
self.checkpoint_date.isoformat()
)
),
]
def get_assemble_scripts(self):
@ -209,6 +236,16 @@ class RBuildPack(PythonBuildPack):
echo "options(repos = c(CRAN='{mran_url}'), download.file.method = 'libcurl')" > /etc/R/Rprofile.site
""".format(mran_url=mran_url)
),
(
# Not all of these locations are configurable; log_dir is
"root",
r"""
install -o ${NB_USER} -g ${NB_USER} -d /var/log/shiny-server && \
install -o ${NB_USER} -g ${NB_USER} -d /var/lib/shiny-server && \
install -o ${NB_USER} -g ${NB_USER} /dev/null /var/log/shiny-server.log && \
install -o ${NB_USER} -g ${NB_USER} /dev/null /var/run/shiny-server.pid
"""
),
]
installR_path = self.binder_path('install.R')