From b9d51677823f73ee9251cd9b10aac569ec346883 Mon Sep 17 00:00:00 2001 From: davidski Date: Sun, 8 Jun 2014 12:22:24 -0700 Subject: [PATCH 1/3] Retrieve rstudio-server pkg direct from rstudio.com --- .gitignore | 1 + attributes/default.rb | 3 +++ recipes/server.rb | 20 +++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8de318a..f97cbbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Berksfile.lock Gemfile.lock *.swp +*.bak diff --git a/attributes/default.rb b/attributes/default.rb index 80a32f5..511a018 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,11 +18,14 @@ default['rstudio']['cran']['packages'] = [] # RStudio Server +default['rstudio']['server']['base_download_url'] = 'http://download2.rstudio.org' default['rstudio']['server']['www_port'] = '8787' default['rstudio']['server']['www_address'] = '127.0.0.1' default['rstudio']['server']['ld_library_path'] = '' default['rstudio']['server']['r_binary_path'] = '' default['rstudio']['server']['user_group'] = '' +default['rstudio']['server']['version'] = '0.98.507' +default['rstudio']['server']['arch'] = node['kernel']['machine'] =~ /x86_64/ ? "amd64" : "i386" # RStudio Session default['rstudio']['session']['timeout'] = '30' diff --git a/recipes/server.rb b/recipes/server.rb index bef50a9..1824d39 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -14,9 +14,27 @@ action :install end - package "rstudio-server" do + package "libssl0.9.8" do action :install end + + Chef::Log.info('Retrieving RStudio Server file.') + remote_rstudio_server_file = "#{node['rstudio']['server']['base_download_url']}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" + local_rstudio_server_file = "#{Chef::Config[:file_cache_path]}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" + remote_file local_rstudio_server_file do + source remote_rstudio_server_file + action :create_if_missing + not_if { ::File.exists?('/etc/init/shiny-server.conf') } + end + + Chef::Log.info('Installing RStudio Server via dpkg.') + dpkg_package "rstudio-server" do + source local_rstudio_server_file + action :upgrade + end + +when "redhat", "centos", "fedora" + Chef::Application.fatal!("Redhat based platforms are not yet supported") end service "rstudio-server" do From 3fae05801656dd708b9ce9dd7c2517cc78902fae Mon Sep 17 00:00:00 2001 From: davidski Date: Sun, 17 Aug 2014 10:51:36 -0700 Subject: [PATCH 2/3] Fix foodcritic complaints --- recipes/server.rb | 120 +++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 1824d39..2f1f39a 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -1,60 +1,60 @@ -# Set up the package repository. -case node["platform"].downcase -when "ubuntu", "debian" - include_recipe "apt" - - apt_repository "rstudio-cran" do - uri node['rstudio']['apt']['uri'] - keyserver node['rstudio']['apt']['keyserver'] - key node['rstudio']['apt']['key'] - distribution "#{node['lsb']['codename']}/" - end - - package "r-base" do - action :install - end - - package "libssl0.9.8" do - action :install - end - - Chef::Log.info('Retrieving RStudio Server file.') - remote_rstudio_server_file = "#{node['rstudio']['server']['base_download_url']}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" - local_rstudio_server_file = "#{Chef::Config[:file_cache_path]}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" - remote_file local_rstudio_server_file do - source remote_rstudio_server_file - action :create_if_missing - not_if { ::File.exists?('/etc/init/shiny-server.conf') } - end - - Chef::Log.info('Installing RStudio Server via dpkg.') - dpkg_package "rstudio-server" do - source local_rstudio_server_file - action :upgrade - end - -when "redhat", "centos", "fedora" - Chef::Application.fatal!("Redhat based platforms are not yet supported") -end - -service "rstudio-server" do - provider Chef::Provider::Service::Upstart - supports :start => true, :stop => true, :restart => true - action :start -end - -template "/etc/rstudio/rserver.conf" do - source "etc/rstudio/rserver.conf.erb" - mode 0644 - owner "root" - group "root" - notifies :restart, "service[rstudio-server]" -end - -template "/etc/rstudio/rsession.conf" do - source "etc/rstudio/rsession.conf.erb" - mode 0644 - owner "root" - group "root" - notifies :restart, "service[rstudio-server]" -end +# Set up the package repository. +case platform_family +when "debian" + include_recipe "apt" + + apt_repository "rstudio-cran" do + uri node['rstudio']['apt']['uri'] + keyserver node['rstudio']['apt']['keyserver'] + key node['rstudio']['apt']['key'] + distribution "#{node['lsb']['codename']}/" + end + + package "r-base" do + action :install + end + + package "libssl0.9.8" do + action :install + end + + Chef::Log.info('Retrieving RStudio Server file.') + remote_rstudio_server_file = "#{node['rstudio']['server']['base_download_url']}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" + local_rstudio_server_file = "#{Chef::Config[:file_cache_path]}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" + remote_file local_rstudio_server_file do + source remote_rstudio_server_file + action :create_if_missing + not_if { ::File.exists?('/etc/init/shiny-server.conf') } + end + + Chef::Log.info('Installing RStudio Server via dpkg.') + dpkg_package "rstudio-server" do + source local_rstudio_server_file + action :upgrade + end + +when "rhel" + Chef::Application.fatal!("Redhat based platforms are not yet supported") +end + +service "rstudio-server" do + provider Chef::Provider::Service::Upstart + supports :start => true, :stop => true, :restart => true + action :start +end + +template "/etc/rstudio/rserver.conf" do + source "etc/rstudio/rserver.conf.erb" + mode 0644 + owner "root" + group "root" + notifies :restart, "service[rstudio-server]" +end + +template "/etc/rstudio/rsession.conf" do + source "etc/rstudio/rsession.conf.erb" + mode 0644 + owner "root" + group "root" + notifies :restart, "service[rstudio-server]" +end From f141e5c876a1156fc6b7ca0e16b70f99853dc81c Mon Sep 17 00:00:00 2001 From: Nikolay Murga Date: Sat, 13 Dec 2014 16:11:16 +0200 Subject: [PATCH 3/3] fix server recipe --- recipes/server.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 2f1f39a..62b747e 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -1,5 +1,5 @@ # Set up the package repository. -case platform_family +case node['platform_family'].downcase when "debian" include_recipe "apt" @@ -22,7 +22,7 @@ remote_rstudio_server_file = "#{node['rstudio']['server']['base_download_url']}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" local_rstudio_server_file = "#{Chef::Config[:file_cache_path]}/rstudio-server-#{node['rstudio']['server']['version']}-#{node['rstudio']['server']['arch']}.deb" remote_file local_rstudio_server_file do - source remote_rstudio_server_file + source remote_rstudio_server_file action :create_if_missing not_if { ::File.exists?('/etc/init/shiny-server.conf') } end @@ -30,7 +30,7 @@ Chef::Log.info('Installing RStudio Server via dpkg.') dpkg_package "rstudio-server" do source local_rstudio_server_file - action :upgrade + action :install end when "rhel"