-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrstudio-server.pp
More file actions
127 lines (116 loc) · 3.27 KB
/
rstudio-server.pp
File metadata and controls
127 lines (116 loc) · 3.27 KB
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
117
118
119
120
121
122
123
124
125
126
include wget
$rstudioserver = 'rstudio-server-0.99.465-amd64.deb'
$urlrstudio = 'http://download2.rstudio.org/'
# $texpkgs = 'hyperref ifxetex ifluatex fixltx2e listings fancyvrb longtable booktabs ulem framed'
# Update system for r install
class update_system {
exec { 'apt_update':
provider => shell,
command => 'apt-get update;',
}
->
package { [
'software-properties-common','libapparmor1',
'libdbd-mysql', 'libmysqlclient-dev','libssl-dev',
'python-software-properties',
'upstart', 'psmisc',
'python', 'g++', 'make','vim', 'whois','mc','libcairo2-dev',
'default-jdk', 'gdebi-core', 'libcurl4-gnutls-dev',
'libxml2-dev']:
ensure => present,
}
->
exec { 'add-cran-repository':
provider => shell,
command =>
'add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/";
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9;
apt-get update;',
}
->
exec { 'upgrade-system':
provider => shell,
timeout => 2000, # On slow machines, this needs some time
command =>'apt-get -y upgrade;apt-get -y autoremove;',
}
->
# Install host additions
# (following https://www.virtualbox.org/manual/ch04.html
# this must be done after upgrading.
package { 'dkms':
ensure => present,
}
}
# Install r base and packages
class install_r {
package { ['r-base', 'r-base-dev']:
ensure => present,
require => Package['dkms'],
}
->
group { 'rstudio_users':
ensure => present,
}
->
user { 'vagrant':
# for R package installs, need:
groups => ['vagrant', 'rstudio_users', 'staff'],
}
->
exec {'install-r-packages':
provider => shell,
timeout => 3000,
command => 'Rscript /vagrant/r-packages.R'
}
}
class install_tex {
package { ['texlive-base', 'texlive-latex-recommended',
'texlive-fonts-recommended', 'texlive-latex-extra' ]:
ensure => present,
}
}
# install rstudio and start service
class install_rstudio_server {
# Download rstudio server
wget::fetch {'rstudio-server-download':
require => Package['r-base'],
timeout => 0,
destination => "${rstudioserver}",
source => "${urlrstudio}${rstudioserver}",
}
->
exec {'rstudio-server-install':
provider => shell,
command => "gdebi -n ${rstudioserver}",
}
->
file { '/etc/rstudio/rsession.conf':
ensure => file,
mode => "a=r,u+w"
}
# ->
# Create rstudio_users group
# group {'rstudio_users':
# ensure => present,
# }
# ->
# Setting password during user creation does not work
# Password is public; this is for local use only
# exec { 'serverpass':
# provider => shell,
# command => 'usermod -p `mkpasswd -H md5 litdata` litdata',
# }
}
# Make sure that both services are running
class check_services {
service {'rstudio-server':
ensure => running,
require => [Exec['rstudio-server-install']],
hasstatus => true,
}
}
include update_system
include install_r
include install_tex
include install_rstudio_server
include check_services