From 0734e8be15aca642bdcb84c5d442274455a1e32a Mon Sep 17 00:00:00 2001 From: Alessandro Grassi Date: Thu, 26 Jun 2014 18:33:50 +0200 Subject: [PATCH 1/4] Use gdebi to install rstudio rather than APT, as the mirror apparently doesn't feature rstudio anymore --- Berksfile | 1 + metadata.rb | 1 + recipes/server.rb | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/Berksfile b/Berksfile index ac7ae16..e9a09fc 100644 --- a/Berksfile +++ b/Berksfile @@ -4,3 +4,4 @@ metadata cookbook 'apt', github: 'opscode-cookbooks/apt', tag: 'v2.3.0' cookbook 'nginx', github: 'opscode-cookbooks/nginx', tag: 'v2.2.0' cookbook 'r', github: 'stevendanna/cookbook-r' +cookbook 'gdebi', github: 'bakins/cookbook-gdebi' diff --git a/metadata.rb b/metadata.rb index 2713003..b4e1207 100644 --- a/metadata.rb +++ b/metadata.rb @@ -9,3 +9,4 @@ depends "apt" depends "nginx" depends "r" +depends "gdebi" diff --git a/recipes/server.rb b/recipes/server.rb index bef50a9..7d8b56b 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -14,8 +14,19 @@ action :install end + execute 'download-server-package' do + command 'wget http://download2.rstudio.org/rstudio-server-0.97.336-amd64.deb -O /tmp/rstudio.deb' + retries 20 + retry_delay 10 + creates '/tmp/rstudio.deb' + end + + package 'gdebi' + package "rstudio-server" do action :install + source '/tmp/rstudio.deb' + provider Chef::Provider::Package::Gdebi end end From 98ac2b3cf53b81f1b0fbac8f20efdb2b42975fc4 Mon Sep 17 00:00:00 2001 From: Alessandro Grassi Date: Thu, 26 Jun 2014 18:39:01 +0200 Subject: [PATCH 2/4] Fix shiny.rb to work properly under chef-solo --- recipes/shiny.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/shiny.rb b/recipes/shiny.rb index 9a2456a..157e962 100644 --- a/recipes/shiny.rb +++ b/recipes/shiny.rb @@ -1,4 +1,6 @@ -if default['rstudio']['shiny']['arch'] == 'amd64' +include_recipe 'r' + +if node['rstudio']['shiny']['arch'] == 'amd64' base_download_url = 'http://download3.rstudio.org/ubuntu-12.04/x86_64' else raise Exception, "This cookbook doesn't work with i386." From bbc98c7cdc45fa42adee3360497a94b7b6534e02 Mon Sep 17 00:00:00 2001 From: Alessandro Grassi Date: Thu, 26 Jun 2014 18:39:27 +0200 Subject: [PATCH 3/4] Update nginx_site under nginx.rb to properly specify server_name and use the template --- recipes/nginx.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/nginx.rb b/recipes/nginx.rb index 25e4754..9e80107 100644 --- a/recipes/nginx.rb +++ b/recipes/nginx.rb @@ -27,4 +27,8 @@ notifies :reload, "service[nginx]" end -nginx_site server_name +nginx_site server_name do + server_name server_name + default_server true + template "etc/nginx/rstudio.conf.erb" +end From fc58a0e2c2d6de93e27f8439883b1d86c04f2f19 Mon Sep 17 00:00:00 2001 From: Alessandro Grassi Date: Thu, 26 Jun 2014 18:41:58 +0200 Subject: [PATCH 4/4] Change shiny handling so that it is restarted rather than reloaded, as a simple reload wouldn't notice the configuration path change on first run --- recipes/shiny.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/recipes/shiny.rb b/recipes/shiny.rb index 157e962..2f8b1ff 100644 --- a/recipes/shiny.rb +++ b/recipes/shiny.rb @@ -44,16 +44,23 @@ service "shiny-server" do provider Chef::Provider::Service::Upstart - supports :start => true, :stop => true, :restart => true, :reload => true + supports :start => true, :stop => true action [:enable, :start] end +directory '/etc/shiny-server' do + action :create + mode "0755" + owner "root" + group "root" +end + template "/etc/shiny-server/shiny-server.conf" do source "etc/shiny-server/shiny-server.conf.erb" mode "0644" owner "root" group "root" - notifies :reload, "service[shiny-server]" + notifies :restart, "service[shiny-server]" end if node['rstudio']['shiny']['htpasswd_file'] != ''