<commit_before>#
# Cookbook Name:: solr
# Recipe:: default
#
# Copyright 2012, RightScale
#
# All rights reserved - Do Not Redistribute
#
rs_utils_marker :begin
 
log "Solr Directory: #{node[:solr][:install_dir]}"

log "Solr Storage Base Directory: /mnt/#{node[:solr][:storage_type]}/solr"
directory "/mnt/#{node[:solr][:storage_type]}/solr" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0755"
  recursive true
end
directory "#{node[:solr][:install_dir]}" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0755"
  recursive true
end

log "Creating Solr Lib Dir: #{node[:solr][:lib_dir]}"
directory "#{node[:solr][:lib_dir]}" do 
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  recursive true
  mode "0644"
end

log "Creating Solr Config Dir: #{node[:solr][:conf_dir]}"
directory "#{node[:solr][:conf_dir]}" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0644"
end

#log "Creating Solr Data Dir: #{node[:solr][:data_dir]}"
#directory "#{node[:solr][:data_dir]}" do
#  action :create
#  owner "#{node[:tomcat][:app_user]}"
#end

directory "/srv/tomcat6/webapps/myapp" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  recursive true
end

log "Copying Solr war file to /srv/tomcat6/webapps/myapp/solr.war"
cookbook_file "/srv/tomcat6/webapps/myapp/solr.war" do
  source "apache-solr-3.5.0.war"
  owner "#{node[:tomcat][:app_user]}" 
  mode "0644"
end

log "Copying Libs to #{node[:solr][:lib_dir]}"
remote_directory "#{node[:solr][:lib_dir]}" do
  source "lib"
  files_backup 0
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0644"
  purge false
end

log "linking /mnt/#{node[:solr][:storage_type]}/solr to #{node[:solr][:data_dir]}"
link "#{node[:solr][:data_dir]}" do 
  action :create
  link_type :symbolic
  to "/mnt/#{node[:solr][:storage_type]}/solr"
  notifies :restart, "service[tomcat6]", :delayed
end

service "tomcat6"
<commit_msg>updating permissions on conf dirs<commit_after>#
# Cookbook Name:: solr
# Recipe:: default
#
# Copyright 2012, RightScale
#
# All rights reserved - Do Not Redistribute
#
rs_utils_marker :begin
 
log "Solr Directory: #{node[:solr][:install_dir]}"

log "Solr Storage Base Directory: /mnt/#{node[:solr][:storage_type]}/solr"
directory "/mnt/#{node[:solr][:storage_type]}/solr" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0755"
  recursive true
  notifies :restart, "service[tomcat6]", :delayed
end
directory "#{node[:solr][:install_dir]}" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0755"
  recursive true
end

log "Creating Solr Lib Dir: #{node[:solr][:lib_dir]}"
directory "#{node[:solr][:lib_dir]}" do 
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  recursive true
  mode "0644"
end

log "Creating Solr Config Dir: #{node[:solr][:conf_dir]}"
directory "#{node[:solr][:conf_dir]}" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0755"
end

#log "Creating Solr Data Dir: #{node[:solr][:data_dir]}"
#directory "#{node[:solr][:data_dir]}" do
#  action :create
#  owner "#{node[:tomcat][:app_user]}"
#end

directory "/srv/tomcat6/webapps/myapp" do
  action :create
  owner "#{node[:tomcat][:app_user]}"
  recursive true
end

log "Copying Solr war file to /srv/tomcat6/webapps/myapp/solr.war"
cookbook_file "/srv/tomcat6/webapps/myapp/solr.war" do
  source "apache-solr-3.5.0.war"
  owner "#{node[:tomcat][:app_user]}" 
  mode "0644"
end

log "Copying Libs to #{node[:solr][:lib_dir]}"
remote_directory "#{node[:solr][:lib_dir]}" do
  source "lib"
  files_backup 0
  owner "#{node[:tomcat][:app_user]}"
  group "#{node[:tomcat][:app_user]}"
  mode "0755"
  purge false
end

log "linking /mnt/#{node[:solr][:storage_type]}/solr to #{node[:solr][:data_dir]}"
link "#{node[:solr][:data_dir]}" do 
  action :create
  link_type :symbolic
  to "/mnt/#{node[:solr][:storage_type]}/solr"
  notifies :restart, "service[tomcat6]", :delayed
end

service "tomcat6"

{'fraction_non_alphanumeric': 0.19756554307116106, 'fraction_numerical': 0.0175561797752809, 'mean_word_length': 5.858747993579454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536684', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1702, 'n_words': 360}