-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_mec-shiny-apps.sh
116 lines (96 loc) · 2.97 KB
/
install_mec-shiny-apps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
set -e
SHINY_SERVER_VERSION=${1:-${SHINY_SERVER_VERSION:-latest}}
# Run dependency scripts
. /rocker_scripts/install_s6init.sh
. /rocker_scripts/install_pandoc.sh
if [ "$SHINY_SERVER_VERSION" = "latest" ]; then
SHINY_SERVER_VERSION=$(wget -qO- https://download3.rstudio.org/ubuntu-14.04/x86_64/VERSION)
fi
# Get apt packages
apt-get update
apt-get install -y --no-install-recommends \
sudo \
gdebi-core \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
xtail \
wget \
make \
zlib1g-dev
# Install Shiny server
wget --no-verbose "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-${SHINY_SERVER_VERSION}-amd64.deb" -O ss-latest.deb
gdebi -n ss-latest.deb
rm ss-latest.deb
# Get R packages
install2.r --error --skipinstalled -r "https://packagemanager.rstudio.com/cran/__linux__/focal/2022-01-28" shiny rmarkdown
# Set up directories and permissions
#if [ -x "$(command -v rstudio-server)" ]; then
# DEFAULT_USER=${DEFAULT_USER:-rstudio}
# adduser ${DEFAULT_USER} shiny
#fi
cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/
chown shiny:shiny /var/lib/shiny-server
mkdir -p /var/log/shiny-server
chown shiny:shiny /var/log/shiny-server
# Doesn't work: Make standard linux truefonts available to shiny user
# chown shiny:shiny /usr/share/fonts/truetype
# Make truefonts available to shiny user as a copy
mkdir -p /var/fonts/truetype
cp -R /usr/share/fonts/truetype/* /var/fonts/truetype
chown shiny:shiny /var/fonts/truetype
# create init scripts
mkdir -p /etc/services.d/shiny-server
cat > /etc/services.d/shiny-server/run << 'EOF'
#!/usr/bin/with-contenv bash
## load /etc/environment vars first:
for line in $( cat /etc/environment ) ; do export $line > /dev/null; done
if [ "$APPLICATION_LOGS_TO_STDOUT" != "false" ]; then
exec xtail /var/log/shiny-server/ &
fi
exec shiny-server 2>&1
EOF
chmod +x /etc/services.d/shiny-server/run
# Clean up
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/downloaded_packages
## build ARGs
##NCPUS=${NCPUS:-1}
##apt-get update -qq && apt-get -y --no-install-recommends install \
## libxml2-dev \
## libcairo2-dev \
## libgit2-dev \
## default-libmysqlclient-dev \
## libpq-dev \
## libsasl2-dev \
## libsqlite3-dev \
## libssh2-1-dev \
## libxtst6 \
## libcurl4-openssl-dev \
## unixodbc-dev && \
## rm -rf /var/lib/apt/lists/*
#r packages
install2.r --error --skipinstalled -r "https://packagemanager.rstudio.com/cran/__linux__/focal/2020-06-04" \
Rttf2pt1
install2.r --error --skipinstalled -r "https://packagemanager.rstudio.com/cran/__linux__/focal/2022-01-28" \
remotes \
shinyFeedback \
shinyjs \
shinyFiles \
DT \
colourpicker \
here \
vroom \
forcats \
dplyr \
tibble \
readr \
tidyr \
extrafont \
extrafontdb \
ggplot2
# a bridge to far? -- brings in another 60 packages
# install2.r --error --skipinstalled -n $NCPUS tidymodels
r -e 'library(extrafont)'
rm -rf /tmp/downloaded_packages