<commit_before>#
# Cookbook Name:: openaustralia
# Recipe:: default
#

# For capistrano deploy we need at least version 1.5.5 of git
# So, slightly hacky. Going to force install from ports (which we're assuming has been updated)
package "git" do
  source "ports"
end

# Container for all the web applications
directory "/www" do
  owner "matthewl"
  group "matthewl"
  mode 0755
  action :create
end

directory "/www/www.openaustralia.org" do
  owner "matthewl"
  group "matthewl"
  mode 0755
  action :create
end

# Hmmm... I wonder if Apache will start up if the openaustralia app is not installed
link "/www/www.openaustralia.org/html" do
  to "openaustralia/current/twfy/www/docs"
end

# Configuration for OpenAustralia web app
remote_file "/www/www.openaustralia.org/openaustralia/shared/general" do
  source "general"
  owner "matthewl"
  group "matthewl"
end

remote_file "/www/www.openaustralia.org/openaustralia/shared/parser_configuration.yml" do
  source "parser_configuration.yml"
  owner "matthewl"
  group "matthewl"
end

package "apache" do
  source "apache22"
end

# Need to specify the build option for the php5 package below
remote_file "/var/db/ports/php5/options" do
  source "php5.ports.options"
  mode 0644
  owner "root"
  group "wheel"
end

# Need to build php5 from ports to select the option for building mod_php
package "php5" do
  source "ports"
end

package "mysql-server" do
  source "mysql50-server"
end
package "php5-mysql"
package "php5-curl"

service "mysql-server" do
  supports :status => true, :restart => true
  action [:enable, :start]
end

remote_file "/usr/local/etc/apache22/httpd.conf" do
  source "httpd.conf"
  mode 0644
  owner "root"
  group "wheel"
end

service "apache22" do
  supports :status => true, :restart => true, :reload => true
  action [:enable, :start]
  subscribes :reload, resources('remote_file[/usr/local/etc/apache22/httpd.conf]'), :immediately
end

gem_package "activesupport"
# Temporarily installing from ports
package "ruby-iconv" do
  source "ports"
end
package "ImageMagick"
gem_package "rmagick"
gem_package "mechanize" do
  version "0.8.5"
end
package "p5-DBD-mysql50"
package "p5-XML-Twig"
gem_package "htmlentities"
gem_package "log4r"<commit_msg>Added ntpd config for synchronising time on server<commit_after>#
# Cookbook Name:: openaustralia
# Recipe:: default
#

# For capistrano deploy we need at least version 1.5.5 of git
# So, slightly hacky. Going to force install from ports (which we're assuming has been updated)
package "git" do
  source "ports"
end

# Container for all the web applications
directory "/www" do
  owner "matthewl"
  group "matthewl"
  mode 0755
  action :create
end

directory "/www/www.openaustralia.org" do
  owner "matthewl"
  group "matthewl"
  mode 0755
  action :create
end

# Hmmm... I wonder if Apache will start up if the openaustralia app is not installed
link "/www/www.openaustralia.org/html" do
  to "openaustralia/current/twfy/www/docs"
end

# Configuration for OpenAustralia web app
remote_file "/www/www.openaustralia.org/openaustralia/shared/general" do
  source "general"
  owner "matthewl"
  group "matthewl"
end

remote_file "/www/www.openaustralia.org/openaustralia/shared/parser_configuration.yml" do
  source "parser_configuration.yml"
  owner "matthewl"
  group "matthewl"
end

package "apache" do
  source "apache22"
end

# Need to specify the build option for the php5 package below
remote_file "/var/db/ports/php5/options" do
  source "php5.ports.options"
  mode 0644
  owner "root"
  group "wheel"
end

# Need to build php5 from ports to select the option for building mod_php
package "php5" do
  source "ports"
end

package "mysql-server" do
  source "mysql50-server"
end
package "php5-mysql"
package "php5-curl"

service "mysql-server" do
  supports :status => true, :restart => true
  action [:enable, :start]
end

remote_file "/usr/local/etc/apache22/httpd.conf" do
  source "httpd.conf"
  mode 0644
  owner "root"
  group "wheel"
end

service "apache22" do
  supports :status => true, :restart => true, :reload => true
  action [:enable, :start]
  subscribes :reload, resources('remote_file[/usr/local/etc/apache22/httpd.conf]'), :immediately
end

gem_package "activesupport"
# Temporarily installing from ports
package "ruby-iconv" do
  source "ports"
end
package "ImageMagick"
gem_package "rmagick"
gem_package "mechanize" do
  version "0.8.5"
end
package "p5-DBD-mysql50"
package "p5-XML-Twig"
gem_package "htmlentities"
gem_package "log4r"

# Setup clock synchronisation. This isn't necessary on a VPS because this is done for us.
# This is mainly needed for testing on a virtual machine where we want an accurate clock too
remote_file "/etc/ntp.conf" do
  source "ntp.conf"
end

service "ntpd" do
  supports :status => true
  action [:enable, :start]
end

{'fraction_non_alphanumeric': 0.09858274280950396, 'fraction_numerical': 0.01834097540641934, 'mean_word_length': 4.380044843049327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 20, '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': '3392954', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1657, 'n_words': 542}