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/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 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 diff --git a/recipes/shiny.rb b/recipes/shiny.rb index 9a2456a..2f8b1ff 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." @@ -42,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'] != ''