Skip to content

Commit a99cf9b

Browse files
Fix: Update R Version, Autostop not working with ALB
1 parent 56d249c commit a99cf9b

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

products/RStudio/machine-images/config/infra/files/rstudio/check-idle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def get_activity_count():
2626
for line in access_log:
2727
# nginx sometimes pings the RStudio instance
2828
# which does not indicate user activity
29-
if "POST /events/get_events" not in line:
29+
# Load balancer health check should also be not considered as an activity
30+
if "POST /events/get_events" not in line and "ELB-HealthChecker/2.0" not in line:
3031
non_ping_count += 1
3132
return (non_ping_count)
3233

products/RStudio/machine-images/config/infra/provisioners/provision-rstudio.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ sudo yum install -y libcurl-devel-7.79.* libpng-devel-1.5.* cairo-devel-1.15.* p
99
sudo yum install -y xorg-x11-server-devel-1.20.* libX11-devel-1.6.* libXt-devel-1.1.*
1010

1111
# Install R from source (https://docs.rstudio.com/resources/install-r-source/)
12-
R_VERSION="3.6.3"
12+
R_VERSION="4.1.3"
1313
mkdir -p "/tmp/R/"
14-
curl -s "https://cran.rstudio.com/src/base/R-3/R-${R_VERSION}.tar.gz" > "/tmp/R/R-${R_VERSION}.tar.gz"
14+
curl -s "https://cran.r-project.org/src/base/R-4/R-${R_VERSION}.tar.gz" > "/tmp/R/R-${R_VERSION}.tar.gz"
1515
cd "/tmp/R/"
1616
tar xvf "R-${R_VERSION}.tar.gz"
1717
cd "R-${R_VERSION}/"
18-
./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack
18+
./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack --with-pcre1
1919
sudo make
2020
sudo make install
2121
cd "../../.."
@@ -52,14 +52,6 @@ sudo chmod -R 600 "/etc/nginx"
5252
sudo systemctl enable nginx
5353
sudo systemctl restart nginx
5454

55-
# Install script that checks idle time and shuts down if max idle is reached
56-
sudo mv "/tmp/rstudio/check-idle" "/usr/local/bin/"
57-
sudo chown root: "/usr/local/bin/check-idle"
58-
sudo chmod 775 "/usr/local/bin/check-idle"
59-
sudo crontab -l 2>/dev/null > "/tmp/crontab"
60-
echo '*/2 * * * * /usr/local/bin/check-idle 2>&1 >> /var/log/check-idle.log' >> "/tmp/crontab"
61-
sudo crontab "/tmp/crontab"
62-
6355

6456
# Install system packages necessary for installing R packages through RStudio CRAN [devtools, tidyverse]
6557
sudo yum install -y git-2.23.* openssl-devel-1.0.* libxml2-devel-2.9.*
@@ -95,6 +87,13 @@ sudo su - -c "R -e \"install.packages('MASS', version='7.3.53.1', repos='http://
9587
sudo su - -c "R -e \"install.packages('quantreg', version='5.85', repos='http://cran.rstudio.com/')\""
9688
sudo su - -c "R -e \"install.packages('DescTools', version='0.99.41', repos='http://cran.rstudio.com/')\""
9789

90+
# Install script that checks idle time and shuts down if max idle is reached
91+
sudo mv "/tmp/rstudio/check-idle" "/usr/local/bin/"
92+
sudo chown root: "/usr/local/bin/check-idle"
93+
sudo chmod 775 "/usr/local/bin/check-idle"
94+
sudo crontab -l 2>/dev/null > "/tmp/crontab"
95+
echo '*/2 * * * * /usr/local/bin/check-idle 2>&1 >> /var/log/check-idle.log' >> "/tmp/crontab"
96+
sudo crontab "/tmp/crontab"
9897

9998
# Wipe out all traces of provisioning files
10099
sudo rm -rf "/tmp/rstudio"

0 commit comments

Comments
 (0)