]> git.openstreetmap.org Git - chef.git/commitdiff
Rework civicrm using wordpress instead of drupal
authorTom Hughes <tom@compton.nu>
Sun, 23 Mar 2014 22:13:00 +0000 (22:13 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 23 Mar 2014 22:21:47 +0000 (22:21 +0000)
cookbooks/civicrm/attributes/default.rb
cookbooks/civicrm/metadata.rb
cookbooks/civicrm/recipes/default.rb
cookbooks/civicrm/templates/default/backup.cron.erb
cookbooks/civicrm/templates/default/settings_location.php.erb [deleted file]
roles/foundation.rb

index 8fefdfcd7ca34f735bba0ab3b44d88455421c078..55ca5003e3e406551de8bc9e82f800afb300d6aa 100644 (file)
@@ -1 +1 @@
-default[:civicrm][:version] = "4.2.7"
+default[:civicrm][:version] = "4.4.4"
index 4c991bc9f6f63a58a96786290b7754e792400a18..ad57baf1e5820c4186ff5991e598dac7babf6cf4 100644 (file)
@@ -5,5 +5,5 @@ license           "Apache 2.0"
 description       "Installs and configures CiviCRM"
 long_description  IO.read(File.join(File.dirname(__FILE__), 'README.md'))
 version           "1.0.0"
 description       "Installs and configures CiviCRM"
 long_description  IO.read(File.join(File.dirname(__FILE__), 'README.md'))
 version           "1.0.0"
-depends           "drupal"
+depends           "wordpress"
 depends           "mysql"
 depends           "mysql"
index 58cea555e2b2cbf9795aa8198741e7482997edbd..93cb3d9ed5da2639986b4f048429c089b0d29e3b 100644 (file)
@@ -17,7 +17,7 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
-include_recipe "drupal"
+include_recipe "wordpress"
 include_recipe "mysql"
 
 passwords = data_bag_item("civicrm", "passwords")
 include_recipe "mysql"
 
 passwords = data_bag_item("civicrm", "passwords")
@@ -34,127 +34,91 @@ mysql_database "civicrm" do
   permissions "civicrm@localhost" => :all
 end
 
   permissions "civicrm@localhost" => :all
 end
 
-drupal_site "crm.osmfoundation.org" do
-  title "CiviCRM"
+wordpress_site "crm.osmfoundation.org" do
+  ssl_enabled true
   database_name "civicrm"
   database_name "civicrm"
-  database_username "civicrm"
+  database_user "civicrm"
   database_password database_password
   database_password database_password
-  admin_password admin_password
-end
-
-directory "/usr/local/share/civicrm" do
-  owner "root"
-  group "root"
-  mode "0755"
 end
 
 civicrm_version = node[:civicrm][:version]
 end
 
 civicrm_version = node[:civicrm][:version]
-civicrm_directory = "/usr/local/share/civicrm/#{civicrm_version}"
+civicrm_directory = "/srv/crm.osmfoundation.org/wp-content/plugins/civicrm"
 
 
-subversion civicrm_directory do
-  action :export
-  repository "http://svn.civicrm.org/civicrm/tags/tarballs/#{node[:civicrm][:version]}"
-  user "root"
+directory "/opt/civicrm-#{civicrm_version}" do
+  owner "root"
   group "root"
   group "root"
+  mode 0755
 end
 
 end
 
-link "/usr/share/drupal7/sites/all/modules/civicrm" do
-  to "/usr/local/share/civicrm/#{node[:civicrm][:version]}"
-end
-
-directory "/data/crm.osmfoundation.org/civicrm" do
-  owner "www-data"
-  group "www-data"
-  mode "0775"
-end
-
-ruby_block "#{civicrm_directory}/civicrm.settings.php" do
-  block do
-    out = File.new("#{civicrm_directory}/civicrm.settings.php", "w")
-
-    File.foreach("#{civicrm_directory}/templates/CRM/common/civicrm.settings.php.tpl") do |line|
-      line.gsub!(/%%cms%%/, "Drupal")
-      line.gsub!(/%%CMSdbUser%%/, "civicrm")
-      line.gsub!(/%%CMSdbPass%%/, database_password)
-      line.gsub!(/%%CMSdbHost%%/, "localhost")
-      line.gsub!(/%%CMSdbName%%/, "civicrm")
-      line.gsub!(/%%dbUser%%/, "civicrm")
-      line.gsub!(/%%dbPass%%/, database_password)
-      line.gsub!(/%%dbHost%%/, "localhost")
-      line.gsub!(/%%dbName%%/, "civicrm")
-      line.gsub!(/%%crmRoot%%/, "/usr/share/drupal7/sites/all/modules/civicrm")
-      line.gsub!(/%%templateCompileDir%%/, "/data/crm.osmfoundation.org/civicrm")
-      line.gsub!(/%%baseURL%%/, "http://crm.osmfoundation.org/")
-      line.gsub!(/%%siteKey%%/, site_key)
-
-      out.print(line)
-    end
-
-    out.close
-  end
-
-  not_if do
-    File.exist?("#{civicrm_directory}/civicrm.settings.php") and
-    File.mtime("#{civicrm_directory}/civicrm.settings.php") >= File.mtime("#{civicrm_directory}/templates/CRM/common/civicrm.settings.php.tpl")
-  end
-end
-
-link "/etc/drupal/7/sites/crm.osmfoundation.org/civicrm.settings.php" do
-  to "#{civicrm_directory}/civicrm.settings.php"
-end
-
-template "#{civicrm_directory}/settings_location.php" do
-  source "settings_location.php.erb"
+remote_file "/var/cache/chef/civicrm-#{civicrm_version}-wordpress.zip" do
+  action :create_if_missing
+  source "http://downloads.sourceforge.net/project/civicrm/civicrm-stable/#{civicrm_version}/civicrm-#{civicrm_version}-wordpress.zip"
   owner "root"
   group "root"
   owner "root"
   group "root"
-  mode "0644"
+  mode 0644
+  backup false
 end
 
 end
 
-execute "civicrm-load-acl" do
-  action :nothing
-  command "mysql --user=civicrm --password=#{database_password} civicrm < sql/civicrm_acl.mysql"
-  cwd "/usr/share/drupal7/sites/all/modules/civicrm"
-  user "root"
+remote_file "/var/cache/chef/civicrm-#{civicrm_version}-l10n.tar.gz" do
+  action :create_if_missing
+  source "http://downloads.sourceforge.net/project/civicrm/civicrm-stable/#{civicrm_version}/civicrm-#{civicrm_version}-l10n.tar.gz"
+  owner "root"
   group "root"
   group "root"
+  mode 0644
+  backup false
 end
 
 end
 
-execute "civicrm-load-data" do
+execute "/var/cache/chef/civicrm-#{civicrm_version}-wordpress.zip" do
   action :nothing
   action :nothing
-  command "mysql --user=civicrm --password=#{database_password} civicrm < sql/civicrm_data.mysql"
-  cwd "/usr/share/drupal7/sites/all/modules/civicrm"
+  command "unzip -qq /var/cache/chef/civicrm-#{civicrm_version}-wordpress.zip"
+  cwd "/opt/civicrm-#{civicrm_version}"
   user "root"
   group "root"
   user "root"
   group "root"
-  notifies :run, "execute[civicrm-load-acl]"
+  subscribes :run, "remote_file[/var/cache/chef/civicrm-#{civicrm_version}-wordpress.zip]"
 end
 
 end
 
-execute "civicrm-load" do
+execute "/var/cache/chef/civicrm-#{civicrm_version}-l10n.tar.gz" do
   action :nothing
   action :nothing
-  command "mysql --user=civicrm --password=#{database_password} civicrm < sql/civicrm.mysql"
-  cwd "/usr/share/drupal7/sites/all/modules/civicrm"
+  command "tar -zxf /var/cache/chef/civicrm-#{civicrm_version}-l10n.tar.gz"
+  cwd "/opt/civicrm-#{civicrm_version}/civicrm"
   user "root"
   group "root"
   user "root"
   group "root"
-  notifies :run, "execute[civicrm-load-data]"
+  subscribes :run, "remote_file[/var/cache/chef/civicrm-#{civicrm_version}-l10n.tar.gz]"
 end
 
 end
 
-execute "civicrm-gencode" do
-  command "php GenCode.php"
-  cwd "#{civicrm_directory}/xml"
-  user "root"
-  group "root"
-  creates "#{civicrm_directory}/civicrm-version.php"
-  notifies :run, "execute[civicrm-load]"
+link civicrm_directory do
+  to "/opt/civicrm-#{civicrm_version}/civicrm"
 end
 
 end
 
-directory "/data/crm.osmfoundation.org/civicrm/en_US" do
+directory "/srv/crm.osmfoundation.org/wp-content/plugins/files" do
   owner "www-data"
   group "www-data"
   owner "www-data"
   group "www-data"
-  mode "0775"
+  mode 0755
 end
 
 end
 
-directory "/data/crm.osmfoundation.org/civicrm/en_US/ConfigAndLog" do
-  owner "www-data"
-  group "www-data"
-  mode "0775"
+settings = edit_file "#{civicrm_directory}/civicrm/templates/CRM/common/civicrm.settings.php.template" do |line|
+  line.gsub!(/%%cms%%/, "WordPress")
+  line.gsub!(/%%CMSdbUser%%/, "civicrm")
+  line.gsub!(/%%CMSdbPass%%/, database_password)
+  line.gsub!(/%%CMSdbHost%%/, "localhost")
+  line.gsub!(/%%CMSdbName%%/, "civicrm")
+  line.gsub!(/%%dbUser%%/, "civicrm")
+  line.gsub!(/%%dbPass%%/, database_password)
+  line.gsub!(/%%dbHost%%/, "localhost")
+  line.gsub!(/%%dbName%%/, "civicrm")
+  line.gsub!(/%%crmRoot%%/, "#{civicrm_directory}/civicrm")
+  line.gsub!(/%%templateCompileDir%%/, "/srv/crm.osmfoundation.org/wp-content/plugins/files/civicrm/templates_c")
+  line.gsub!(/%%baseURL%%/, "http://crm.osmfoundation.org/")
+  line.gsub!(/%%siteKey%%/, site_key)
+
+  line
+end
+
+file "#{civicrm_directory}/civicrm/civicrm.settings.php" do
+  owner "root"
+  group "root"
+  mode 0644
+  content settings
 end
 
 template "/etc/cron.daily/osmf-crm-backup" do
 end
 
 template "/etc/cron.daily/osmf-crm-backup" do
index 4a5469ed421fd74975a74b59e9caaaa6dfd83092..83421ff0ff5fadc983c526aeb1c8f26df2e803f0 100644 (file)
@@ -8,7 +8,7 @@ B=osmf-crm-$D.tar.gz
 
 mkdir $T/osmf-crm-$D
 mysqldump --user=civicrm --password=<%= @passwords["database"] %> --opt --skip-lock-tables civicrm > $T/osmf-crm-$D/civicrm.sql
 
 mkdir $T/osmf-crm-$D
 mysqldump --user=civicrm --password=<%= @passwords["database"] %> --opt --skip-lock-tables civicrm > $T/osmf-crm-$D/civicrm.sql
-ln -s /data/crm.osmfoundation.org $T/osmf-crm-$D/www
+ln -s /srv/crm.osmfoundation.org $T/osmf-crm-$D/www
 
 export GZIP="--rsyncable -9"
 export RSYNC_RSH="ssh -ax -c arcfour"
 
 export GZIP="--rsyncable -9"
 export RSYNC_RSH="ssh -ax -c arcfour"
diff --git a/cookbooks/civicrm/templates/default/settings_location.php.erb b/cookbooks/civicrm/templates/default/settings_location.php.erb
deleted file mode 100644 (file)
index 3e0249d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-// the directory name for your 'sites' location in drupal. We use the below location
-// along with drupal 'conf_init()' function to figure out where the settings files
-// are located. This is primarily used when we hit CiviCRM outside of 'Drupal' (via mail/soap
-// etc)
-
-define( 'CIVICRM_CONFDIR', '/etc/drupal/7/sites/crm.osmfoundation.org' );
-
-?>
index 8e763bfcef71819dfe187c838652febd6d76bfaa..b6a324772ada25f972634d4eab2c0cf53f586f8d 100644 (file)
@@ -8,7 +8,7 @@ default_attributes(
     :keepalive => false
   },
   :apt => {
     :keepalive => false
   },
   :apt => {
-    :sources => [ "brightbox", "aw-drupal" ]
+    :sources => [ "brightbox" ]
   },
   :memcached => {
     :memory_limit => 400,
   },
   :memcached => {
     :memory_limit => 400,