├── Berksfile ├── files ├── basePackages.R ├── annotationPackages.R ├── dataExperimentPackages.R └── softwarePackages.R ├── metadata.rb ├── README.md ├── chefignore ├── attributes └── default.rb └── recipes └── default.rb /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | -------------------------------------------------------------------------------- /files/basePackages.R: -------------------------------------------------------------------------------- 1 | ## ubuntu writable library 2 | dir.create(Sys.getenv("R_LIBS_USER"), recursive=TRUE) 3 | lib <- Sys.getenv("R_LIBS_USER") 4 | 5 | ## ubuntu copy of BiocManager 6 | library(BiocManager) 7 | install("BiocManager", lib=lib, lib.loc=lib, ask=FALSE) 8 | 9 | ## base packages 10 | library(BiocManager, lib.loc=lib) 11 | install(lib=lib, lib.loc=lib, ask=FALSE) 12 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'AMI_cookbook' 2 | maintainer 'Bioconductor Maintainer' 3 | maintainer_email 'maintainer@bioconductor.org' 4 | license 'Artistic 2.0' 5 | description 'Installs R and Bioconductor on an AWS EC2 instace' 6 | long_description 'Installs R and Bioconductor on an AWS EC2 instance' 7 | source_url 'https://github.com/Bioconductor/AMI_cookbook' if respond_to?(:source_url) 8 | version '0.1.58' 9 | 10 | supports 'ubuntu' 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Description 2 | =========== 3 | This cookbook installs / configures R and a select number of Bioconductor 4 | packages on an Amazon EC2 instance. Installed packages are those identified 5 | on the download stats at http://www.bioconductor.org/packages/stats/ and 6 | as of version 0.1.11 include the top 75 software, 30 annotation and 15 7 | experimental data packages. The full install (system dependencies and 8 | Bioconductor packages) occupies 19GB of disk space. 9 | 10 | Requirements 11 | ============ 12 | 13 | This recipe was written for an Ubuntu 16.04 AWS EC2 instance with 4 cores, 14 | 16 GB RAM and 40 GB disk space. 15 | 16 | Usage 17 | ===== 18 | See instructions at https://github.com/Bioconductor/AWS_management/blob/master/docs/Configure_AMI_from_Chef.md 19 | 20 | Additional Docs 21 | ================ 22 | 23 | See https://docs.chef.io/resource_execute.html 24 | -------------------------------------------------------------------------------- /files/annotationPackages.R: -------------------------------------------------------------------------------- 1 | library(BiocManager) 2 | ubuntu_lib <- .libPaths()[1] 3 | 4 | ## Top 30 annotation downloads: 5 | url <- "http://www.bioconductor.org/packages/stats/data-annotation/annotation_pkg_scores.tab" 6 | tbl <- read.table(url, header=TRUE, stringsAsFactors=FALSE) 7 | sorted <- tbl[with(tbl, order(-Download_score, Package)), ] 8 | pkgs <- sorted[1:30, "Package"] 9 | 10 | installed <- rownames(installed.packages(lib.loc=ubuntu_lib)) 11 | try <- setdiff(pkgs, installed) 12 | 13 | for (xx in try) { 14 | print(paste0("TRYING: ", xx)) 15 | tryCatch({ 16 | BiocManager::install(xx, lib=ubuntu_lib, lib.loc=ubuntu_lib, ask=FALSE) 17 | print(paste0("INSTALLED: ", xx)) 18 | }, error=function(err) { 19 | print(paste0("FAILED: ", xx)) 20 | }) 21 | } 22 | 23 | success <- rownames(installed.packages(lib.loc=ubuntu_lib)) 24 | if (!all(try %in% success)) { 25 | failed <- try[!try %in% installed] 26 | msg <- strwrap(paste0("'", failed, "'", collapse=", ")) 27 | print(paste0("Annotation package NOT installed: ", msg)) 28 | } else { 29 | print("All annotation packages were installed.") 30 | return 31 | } 32 | -------------------------------------------------------------------------------- /files/dataExperimentPackages.R: -------------------------------------------------------------------------------- 1 | library(BiocManager) 2 | ubuntu_lib <- .libPaths()[1] 3 | 4 | ## Top 15 experiment data downloads: 5 | url <- "http://www.bioconductor.org/packages/stats/data-experiment/experiment_pkg_scores.tab" 6 | tbl <- read.table(url, header=TRUE, stringsAsFactors=FALSE) 7 | sorted <- tbl[with(tbl, order(-Download_score, Package)), ] 8 | pkgs <- sorted[1:15, "Package"] 9 | 10 | installed <- rownames(installed.packages(lib.loc=ubuntu_lib)) 11 | try <- setdiff(pkgs, installed) 12 | 13 | for (xx in try) { 14 | print(paste0("TRYING: ", xx)) 15 | tryCatch({ 16 | BiocManager::install(xx, lib=ubuntu_lib, lib.loc=ubuntu_lib, ask=FALSE) 17 | print(paste0("INSTALLED: ", xx)) 18 | }, error=function(err) { 19 | print(paste0("FAILED: ", xx)) 20 | }) 21 | } 22 | 23 | success <- rownames(installed.packages(lib.loc=ubuntu_lib)) 24 | if (!all(try %in% success)) { 25 | failed <- try[!try %in% installed] 26 | msg <- strwrap(paste0("'", failed, "'", collapse=", ")) 27 | print(paste0("Data experiment package NOT installed: ", msg)) 28 | } else { 29 | print("All data experiment packages were installed.") 30 | return 31 | } 32 | -------------------------------------------------------------------------------- /files/softwarePackages.R: -------------------------------------------------------------------------------- 1 | library(BiocManager) 2 | ubuntu_lib <- .libPaths()[1] 3 | 4 | ## Top 75 software downloads: 5 | url <- "http://www.bioconductor.org/packages/stats/bioc/bioc_pkg_scores.tab" 6 | tbl <- read.table(url, header=TRUE, stringsAsFactors=FALSE) 7 | sorted <- tbl[with(tbl, order(-Download_score, Package)), ] 8 | pkgs <- unique(c(sorted[1:75, "Package"], 9 | "devtools", "knitr", "caTools", "rmarkdown", "BiocStyle")) 10 | 11 | installed <- rownames(installed.packages(lib.loc=ubuntu_lib)) 12 | try <- setdiff(pkgs, c(installed, "BiocInstaller", "xps", "DESeq")) 13 | 14 | for (xx in try) { 15 | print(paste0("TRYING: ", xx)) 16 | tryCatch({ 17 | BiocManager::install(xx, lib=ubuntu_lib, lib.loc=ubuntu_lib, ask=FALSE) 18 | print(paste0("INSTALLED: ", xx)) 19 | }, error=function(err) { 20 | print(paste0("FAILED: ", xx)) 21 | }) 22 | } 23 | 24 | success <- rownames(installed.packages(lib.loc=ubuntu_lib)) 25 | if (!all(try %in% success)) { 26 | failed <- try[!try %in% installed] 27 | msg <- strwrap(paste0("'", failed, "'", collapse=", ")) 28 | print(paste0("Software package NOT installed: ", msg)) 29 | } else { 30 | print("All software packages were installed.") 31 | return 32 | } 33 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | examples/* 55 | Guardfile 56 | Procfile 57 | .kitchen* 58 | .rubocop.yml 59 | 60 | # SCM # 61 | ####### 62 | .git 63 | */.git 64 | .gitignore 65 | .gitmodules 66 | .gitconfig 67 | .gitattributes 68 | .svn 69 | */.bzr/* 70 | */.hg/* 71 | */.svn/* 72 | 73 | # Berkshelf # 74 | ############# 75 | Berksfile 76 | Berksfile.lock 77 | cookbooks/* 78 | tmp 79 | 80 | # Cookbooks # 81 | ############# 82 | CONTRIBUTING* 83 | CHANGELOG* 84 | TESTING* 85 | 86 | # Strainer # 87 | ############ 88 | Colanderfile 89 | Strainerfile 90 | .colander 91 | .strainer 92 | 93 | # Vagrant # 94 | ########### 95 | .vagrant 96 | Vagrantfile 97 | 98 | # Travis # 99 | ########## 100 | .travis.yml 101 | -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | default['time_zone'] = "America/New_York" 2 | 3 | ## At release time these 4 need to be modified: 4 | ## 'r_version', 'bioc_version', 'r_url' and 'r_src_dir' 5 | default['r_version'] = {rel: '4.0', dev: '4.1'} 6 | default['bioc_version'] = {rel: '3.12', dev: '3.13'} 7 | default['r_url'] = {rel: 'https://cran.rstudio.com/src/base/R-4/R-4.0.5.tar.gz', 8 | dev: 'https://stat.ethz.ch/R/daily/R-devel.tar.gz'} 9 | default['r_src_dir'] = {rel: 'R-4.0.3', dev: 'R-devel'} 10 | 11 | ## System dependencies for R / BioC packages 12 | default['jags_url'] = {dev: "https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.2.0.tar.gz/download", 13 | rel: "https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.2.0.tar.gz/download"} 14 | default['jags_dir'] = {dev: "JAGS-4.2.0", rel: "JAGS-4.2.0"} 15 | #default['libsbml_url'] = "https://s3.amazonaws.com/linux-provisioning/libSBML-5.10.2-core-src.tar.gz" 16 | default['libsbml_url'] = "http://downloads.sourceforge.net/project/sbml/libsbml/5.10.2/stable/libSBML-5.10.2-core-src.tar.gz" 17 | default['libsbml_dir'] = "libsbml-5.10.2" 18 | default['vienna_rna_url'] = "https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_2_x/ViennaRNA-2.2.7.tar.gz" 19 | default['vienna_rna_dir'] = "ViennaRNA-2.2.7" 20 | default['argtable_url'] = "http://prdownloads.sourceforge.net/argtable/argtable2-13.tar.gz" 21 | default['clustalo_url'] = "http://www.clustal.org/omega/clustal-omega-1.2.4.tar.gz" 22 | 23 | ## vignettes and rstudio 24 | default['pandoc_url'] = "https://github.com/jgm/pandoc/releases/download/1.19.1/pandoc-1.19.1-1-amd64.deb" 25 | default['rstudio_url'] = "https://download2.rstudio.org/rstudio-server-1.1.463-amd64.deb" 26 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | ## Any Ubuntu 16.04 image brought up from EC2 Quickstart or AWS Marketplace 2 | ## after March 29, 2017 will running on the AWS-tuned kernel: 3 | ## https://insights.ubuntu.com/2017/04/05/ubuntu-on-aws-gets-serious-performance-boost-with-aws-tuned-kernel/ 4 | ## grub update: 5 | ## Old grub config is different from new - dpkg pulls up GUI to select 6 | ## options. Pass flag to accept new config. 7 | 8 | execute "system updates" do 9 | command "apt-get update" 10 | action :run 11 | end 12 | 13 | execute "system upgrades" do 14 | command 'DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade' 15 | action :run 16 | end 17 | 18 | ## The node attribute node["reldev"] is defined in the code that creates 19 | ## the roles: AMI_release_linux and AMI_devel_linux. 20 | if node["reldev"] == "devel" 21 | reldev = :dev 22 | elsif node["reldev"] == "release" 23 | reldev = :rel 24 | else 25 | raise "are the AMI_devel and AMI_release roles defined?" 26 | end 27 | bioc_version = node['bioc_version'][reldev] 28 | r_version = node['r_version'][reldev] 29 | 30 | ## --------------------------------------------------------------------------- 31 | ## Repo packages 32 | ## --------------------------------------------------------------------------- 33 | 34 | ## NOTE: If apache is installed some configuration must be done to 35 | ## play nice with RStudio which is running on port 80. 36 | pkgs = %w(ack-grep libnetcdf-dev libhdf5-serial-dev sqlite libfftw3-dev 37 | libfftw3-doc libopenbabel-dev fftw3 fftw3-dev pkg-config 38 | xfonts-100dpi xfonts-75dpi 39 | libopenmpi-dev openmpi-bin mpi-default-bin openmpi-common 40 | libexempi3 openmpi-doc texlive-science python-mpi4py 41 | texlive-bibtex-extra texlive-fonts-extra fortran77-compiler gfortran 42 | libreadline-dev libx11-dev libxt-dev texinfo libxml2-dev 43 | libcurl4-openssl-dev xvfb libpng-dev 44 | libjpeg-dev libcairo2-dev libtiff5-dev 45 | tcl8.5-dev tk8.5-dev libicu-dev libgsl0-dev 46 | libgtk2.0-dev gcc-4.8 default-jre openjdk-8-jdk texlive-latex-extra 47 | texlive-fonts-recommended libgl1-mesa-dev libglu1-mesa-dev 48 | htop libgmp3-dev imagemagick unzip libncurses-dev 49 | libbz2-dev libxpm-dev liblapack-dev libv8-3.14-dev libperl-dev 50 | libarchive-extract-perl libfile-copy-recursive-perl libcgi-pm-perl 51 | tabix libdbi-perl libdbd-mysql-perl ggobi libgtkmm-2.4-dev 52 | libssl-dev byacc 53 | automake libmysqlclient-dev postgresql-server-dev-all 54 | firefox graphviz python-pip libxml-simple-perl texlive-lang-european 55 | libmpfr-dev libudunits2-dev tree python-yaml libmodule-build-perl 56 | gdb biber git python-sklearn python-numpy python-pandas python-h5py 57 | libprotoc-dev libprotobuf-dev protobuf-compiler libapparmor-dev 58 | libgeos-dev libmagick++-dev libsasl2-dev libpcre2-dev 59 | gdebi-core) 60 | package pkgs do 61 | action :install 62 | end 63 | 64 | ## --------------------------------------------------------------------------- 65 | ## Non-repo packages 66 | 67 | ## pandoc: newer version than available from the Ubuntu package repo 68 | pandoc_deb = node['pandoc_url'].split("/").last 69 | 70 | remote_file "/tmp/#{pandoc_deb}" do 71 | source node['pandoc_url'] 72 | end 73 | 74 | dpkg_package "pandoc" do 75 | source "/tmp/#{pandoc_deb}" 76 | end 77 | 78 | ## Python 79 | 80 | execute "update pip" do 81 | command "pip install --upgrade pip" 82 | end 83 | 84 | execute "install jupyter" do 85 | command "pip install jupyter" 86 | not_if "which jupyter | grep -q jupyter" 87 | end 88 | 89 | execute "install ipython" do 90 | command "pip install ipython==4.1.2" 91 | not_if "pip freeze | grep -q ipython" 92 | end 93 | 94 | execute "install nbconvert" do 95 | command "pip install nbconvert==4.1.0" 96 | not_if "pip freeze | grep -q nbconvert" 97 | end 98 | 99 | ## Clustal Omega: multiple sequence alignment 100 | 101 | # required for clustalo 102 | argtable_tarball = node['argtable_url'].split('/').last 103 | argtable_dir = argtable_tarball.sub(".tar.gz", "") 104 | 105 | remote_file "/tmp/#{argtable_tarball}" do 106 | source node['argtable_url'] 107 | end 108 | 109 | execute "build argtable" do 110 | command "tar zxf #{argtable_tarball.split('/').last} && cd #{argtable_dir} && ./configure && make && make install" 111 | cwd "/tmp" 112 | not_if {File.exists? "/tmp/#{argtable_dir}/config.log"} 113 | end 114 | 115 | clustalo_tarball = node['clustalo_url'].split('/').last 116 | clustalo_dir = clustalo_tarball.sub(".tar.gz", "") 117 | 118 | remote_file "/tmp/#{clustalo_tarball}" do 119 | source node['clustalo_url'] 120 | end 121 | 122 | execute "build clustalo" do 123 | command "tar zxf #{clustalo_tarball} && cd #{clustalo_dir} && ./configure && make && make install" 124 | not_if "which clustalo | grep -q clustalo" 125 | cwd "/tmp" 126 | end 127 | 128 | 129 | ## JAGS 130 | 131 | remote_file "/tmp/#{node['jags_url'][reldev].split('/').last}" do 132 | source node['jags_url'][reldev] 133 | end 134 | 135 | execute "build jags" do 136 | command "tar zxf #{node['jags_url'][reldev].split('/').last} && cd #{node['jags_dir'][reldev]} && ./configure && make && make install" 137 | cwd "/tmp" 138 | not_if {File.exists? "/tmp/#{node['jags_dir'][reldev]}/config.log"} 139 | end 140 | 141 | ## libsbml 142 | 143 | remote_file "/tmp/#{node['libsbml_url'].split('/').last}" do 144 | source node['libsbml_url'] 145 | end 146 | 147 | execute "build libsbml" do 148 | command "tar zxf #{node['libsbml_url'].split('/').last} && cd #{node['libsbml_dir']} && ./configure --enable-layout && make && make install" 149 | cwd "/tmp" 150 | not_if {File.exists? "/tmp/#{node['libsbml_dir']}/config.log"} 151 | end 152 | 153 | ## Vienna RNA 154 | 155 | remote_file "/tmp/#{node['vienna_rna_dir']}.tar.gz" do 156 | source node["vienna_rna_url"] 157 | end 158 | 159 | execute "build ViennaRNA" do 160 | command "tar zxf #{node['vienna_rna_dir']}.tar.gz && cd #{node['vienna_rna_dir']}/ && ./configure && make && make install" 161 | cwd "/tmp" 162 | not_if {File.exists? "/tmp/#{node['vienna_rna_dir']}/config.log"} 163 | end 164 | 165 | ## --------------------------------------------------------------------------- 166 | ## Install R as root without recommended packages: 167 | ## AFAICT rstudio server must run R as root because it calls setuid when a 168 | ## user's session starts. The server assumes root right before it calls setuid 169 | ## for a new session and at all other times runs as rstudio-server. If R 170 | ## is installed as ubuntu PATHs must be manipulated so rstudio-server can 171 | ## find R when necessary. Here R is installed as root but all (non-base) 172 | ## packages are installed as the ubuntu user. 173 | 174 | directory "/downloads" do 175 | owner "root" 176 | mode "0755" 177 | action :create 178 | not_if {Dir.exists? "/downloads"} 179 | end 180 | 181 | remote_file "/downloads/#{node['r_url'][reldev].split("/").last}" do 182 | source node['r_url'][reldev] 183 | owner 'root' 184 | end 185 | 186 | execute "untar R" do 187 | command "tar zxf #{node['r_url'][reldev].split("/").last}" 188 | user "root" 189 | cwd "/downloads" 190 | not_if {File.exists? "/downloads/#{node['r_src_dir'][reldev]}"} 191 | end 192 | 193 | execute "configure R" do 194 | command "./configure --without-recommended-packages --enable-R-shlib --prefix=/usr/local" 195 | user "root" 196 | cwd "/downloads/#{node['r_src_dir'][reldev]}" 197 | not_if {File.exists? "/downloads/#{node['r_src_dir'][reldev]}/config.log"} 198 | end 199 | 200 | execute "make R" do 201 | command "make > /downloads/R-make.out 2>&1" 202 | user "root" 203 | cwd "/downloads/#{node['r_src_dir'][reldev]}" 204 | not_if {File.exists? "/usr/local/bin/R"} 205 | end 206 | 207 | execute "install R" do 208 | command "make install" 209 | user "root" 210 | cwd "/downloads/#{node['r_src_dir'][reldev]}" 211 | not_if {File.exists? "/usr/local/bin/R"} 212 | end 213 | 214 | execute "install BiocManager as root" do 215 | user "root" 216 | command %Q(R -e "install.packages('BiocManager', repos = 'http://cran.us.r-project.org')" > /tmp/BiocManagerInstall.log) 217 | not_if {File.exists? "/usr/local/lib/R/library/BiocManager"} 218 | end 219 | 220 | if reldev == :dev 221 | execute "make devel if necessary" do 222 | command %Q(R -e "BiocManager::install(version='devel', ask=FALSE)" >> /tmp/BiocManagerInstall.log) 223 | user "root" 224 | not_if %Q(R --slave -q -e "!BiocManager:::isDevel()" | grep -q FALSE) 225 | end 226 | end 227 | 228 | ## Install Bioconductor packages as ubuntu: 229 | 230 | ubuntu_dir = "/home/ubuntu" 231 | 232 | %w(bin tmp).each do |dir| 233 | directory "#{ubuntu_dir}/#{dir}" do 234 | owner "ubuntu" 235 | group "ubuntu" 236 | mode "0755" 237 | action :create 238 | end 239 | end 240 | 241 | 242 | ## variables for persistent hub caching 243 | execute "persistent ah cache" do 244 | user "ubuntu" 245 | command "echo 'export ANNOTATION_HUB_ASK=FALSE' >> /home/ubuntu/.bashrc" 246 | end 247 | execute "persistent eh cache" do 248 | user "ubuntu" 249 | command "echo 'export EXPERIMENT_HUB_ASK=FALSE' >> /home/ubuntu/.bashrc" 250 | end 251 | 252 | ## directories for default hub/bfc caching 253 | caching_dir = "home/ubuntu/.cache" 254 | %w(AnnotationHub ExperimentHub BiocFileCache).each do |dir| 255 | directory "#{caching_dir}/#{dir}" do 256 | owner "ubuntu" 257 | group "ubuntu" 258 | mode "0775" 259 | action :create 260 | end 261 | end 262 | 263 | 264 | ## Install base, software, data experiment and annotation packages 265 | 266 | cookbook_file "/tmp/basePackages.R" do 267 | source "basePackages.R" 268 | mode "0755" 269 | end 270 | 271 | execute "install base Bioconductor packages" do 272 | command %q(R -e "source('/tmp/basePackages.R')" > /tmp/basePackages.log) 273 | user "ubuntu" 274 | group "ubuntu" 275 | end 276 | 277 | ## FIXME: Not clean; does not remove dependencies 278 | execute "remove root BiocManager" do 279 | only_if {File.exists? "/usr/local/lib/R/library/BiocManager"} 280 | command %q(R --slave -q -e "remove.packages('BiocManager', lib='/usr/local/lib/R/library')") 281 | end 282 | 283 | cookbook_file "/tmp/softwarePackages.R" do 284 | source "softwarePackages.R" 285 | mode "0755" 286 | end 287 | 288 | execute "install software Bioconductor packages" do 289 | command %q(R -e "source('/tmp/softwarePackages.R')" > /tmp/softwarePackages.log) 290 | user "ubuntu" 291 | group "ubuntu" 292 | timeout 7200 293 | not_if {File.exists? "/usr/local/lib/R/library/BiocGenerics"} 294 | end 295 | 296 | cookbook_file "/tmp/dataExperimentPackages.R" do 297 | source "dataExperimentPackages.R" 298 | mode "0755" 299 | end 300 | 301 | execute "install data experiment Bioconductor packages" do 302 | command %q(R -e "source('/tmp/dataExperimentPackages.R')" > /tmp/dataExperimentPackages.log) 303 | user "ubuntu" 304 | group "ubuntu" 305 | end 306 | 307 | cookbook_file "/tmp/annotationPackages.R" do 308 | source "annotationPackages.R" 309 | mode "0755" 310 | end 311 | 312 | execute "install annotation Bioconductor packages" do 313 | command %q(R -e "source('/tmp/annotationPackages.R')" > /tmp/annotationPackages.log) 314 | user "ubuntu" 315 | group "ubuntu" 316 | end 317 | 318 | ## latex settings 319 | 320 | file "/etc/texmf/texmf.d/01bioc.cnf" do 321 | content "shell_escape=t" 322 | owner "root" 323 | group "root" 324 | mode "0644" 325 | end 326 | 327 | execute "update-texmf" do 328 | action :run 329 | user "root" 330 | command "update-texmf" 331 | end 332 | 333 | ## --------------------------------------------------------------------------- 334 | ## rstudio server 335 | 336 | execute "disable password lock in cloud.cfg" do 337 | command %Q(sed -i.bak "s/lock_passwd: True/lock_passwd: False/" cloud.cfg) 338 | user "root" 339 | cwd "/etc/cloud" 340 | not_if "grep -q 'lock_passwd: False' /etc/cloud/cloud.cfg" 341 | end 342 | 343 | ## set ubuntu user password 'bioc' for rstudio 344 | user "ubuntu" do 345 | action :modify 346 | password "$6$K48WcQTl$j.DAQ7gxSEOP.VJoJXBlb.xn8GZ/wNHrLXvppMYsca/LsorkWrTYp13FEvNLJ/ghW6QIZdospdU9KilUtkBaX0" 347 | end 348 | 349 | ## download, install rstudio-server 350 | rstudio_file = node['rstudio_url'].split('/').last 351 | remote_file "/tmp/#{rstudio_file}" do 352 | source node['rstudio_url'] 353 | end 354 | 355 | dpkg = `dpkg -s rstudio-server` 356 | execute "install rstudio" do 357 | command "sudo gdebi -n #{rstudio_file}" 358 | cwd "/tmp" 359 | only_if {dpkg.empty?} 360 | end 361 | 362 | execute "verify rstudio-server installation" do 363 | command "rstudio-server verify-installation" 364 | end 365 | 366 | execute "switch rstudio-server to port 80" do 367 | user "root" 368 | not_if "grep -q www-port /etc/rstudio/rserver.conf" 369 | command "echo 'www-port=80' > /etc/rstudio/rserver.conf" 370 | end 371 | 372 | execute "restart rstudio server" do 373 | user "root" 374 | command "rstudio-server restart" 375 | ignore_failure true 376 | end 377 | --------------------------------------------------------------------------------