]> git.openstreetmap.org Git - chef.git/commitdiff
Install the DeviceFeatureWebGL plugin for piwik
authorTom Hughes <tom@compton.nu>
Fri, 29 Jul 2022 09:47:18 +0000 (10:47 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 29 Jul 2022 10:18:33 +0000 (11:18 +0100)
Closes #519

cookbooks/piwik/attributes/default.rb
cookbooks/piwik/recipes/default.rb

index 0c4909260b46c78393c5c1efaf829ddcf998b580..ff933400e99ff6ddf0db6efeeae5c4f650c4de13 100644 (file)
@@ -1,16 +1,70 @@
 default[:piwik][:version] = "4.10.1"
-default[:piwik][:plugins] = %w[
-  Actions Annotations API BulkTracking Contents CoreAdminHome CoreConsole
-  CoreHome CorePluginsAdmin CoreUpdater CoreVisualizations CoreVue
-  CustomJsTracker Dashboard DBStats DevicePlugins DevicesDetection Diagnostics
-  Ecommerce Events Feedback GeoIp2 Goals Heartbeat ImageGraph Insights
-  Installation Intl IntranetMeasurable LanguagesManager Live Login Marketplace
-  MobileAppMeasurable MobileMessaging Monolog Morpheus MultiSites Overlay
-  PagePerformance PrivacyManager ProfessionalServices Proxy Referrers Resolution
-  RssWidget ScheduledReports SegmentEditor SEO SitesManager Tour Transitions
-  TwoFactorAuth UserCountry UserCountryMap UserId UserLanguage UsersManager
-  VisitFrequency VisitorInterest VisitsSummary VisitTime WebsiteMeasurable
-  Widgetize
-]
+default[:piwik][:plugins] = {
+  "Actions" => nil,
+  "Annotations" => nil,
+  "API" => nil,
+  "BulkTracking" => nil,
+  "Contents" => nil,
+  "CoreAdminHome" => nil,
+  "CoreConsole" => nil,
+  "CoreHome" => nil,
+  "CorePluginsAdmin" => nil,
+  "CoreUpdater" => nil,
+  "CoreVisualizations" => nil,
+  "CoreVue" => nil,
+  "CustomJsTracker" => nil,
+  "Dashboard" => nil,
+  "DBStats" => nil,
+  "DeviceFeatureWebGL" => "4.0.1",
+  "DevicePlugins" => nil,
+  "DevicesDetection" => nil,
+  "Diagnostics" => nil,
+  "Ecommerce" => nil,
+  "Events" => nil,
+  "Feedback" => nil,
+  "GeoIp2" => nil,
+  "Goals" => nil,
+  "Heartbeat" => nil,
+  "ImageGraph" => nil,
+  "Insights" => nil,
+  "Installation" => nil,
+  "Intl" => nil,
+  "IntranetMeasurable" => nil,
+  "LanguagesManager" => nil,
+  "Live" => nil,
+  "Login" => nil,
+  "Marketplace" => nil,
+  "MobileAppMeasurable" => nil,
+  "MobileMessaging" => nil,
+  "Monolog" => nil,
+  "Morpheus" => nil,
+  "MultiSites" => nil,
+  "Overlay" => nil,
+  "PagePerformance" => nil,
+  "PrivacyManager" => nil,
+  "ProfessionalServices" => nil,
+  "Proxy" => nil,
+  "Referrers" => nil,
+  "Resolution" => nil,
+  "RssWidget" => nil,
+  "ScheduledReports" => nil,
+  "SegmentEditor" => nil,
+  "SEO" => nil,
+  "SitesManager" => nil,
+  "Tour" => nil,
+  "Transitions" => nil,
+  "TwoFactorAuth" => nil,
+  "UserCountry" => nil,
+  "UserCountryMap" => nil,
+  "UserId" => nil,
+  "UserLanguage" => nil,
+  "UsersManager" => nil,
+  "VisitFrequency" => nil,
+  "VisitorInterest" => nil,
+  "VisitsSummary" => nil,
+  "VisitTime" => nil,
+  "WebsiteMeasurable" => nil,
+  "Widgetize" => nil,
+}
 
 default[:mysql][:settings][:mysqld][:secure_file_priv] = "/opt/piwik-#{node[:piwik][:version]}/piwik/tmp/assets"
index 0a32dda4e6a7fac1ef293ef6c0d3458a55432def..483a348cb5894a443cac55e0dfa150f5ebd7d40e 100644 (file)
@@ -60,6 +60,23 @@ archive_file "#{Chef::Config[:file_cache_path]}/piwik-#{version}.zip" do
   not_if { ::File.exist?("/opt/piwik-#{version}/piwik") }
 end
 
+node[:piwik][:plugins].each do |plugin_name, plugin_version|
+  next if plugin_version.nil?
+
+  remote_file "#{Chef::Config[:file_cache_path]}/piwik-#{plugin_name}-#{plugin_version}.zip" do
+    source "https://plugins.matomo.org/api/2.0/plugins/#{plugin_name}/download/#{plugin_version}"
+  end
+
+  archive_file "#{Chef::Config[:file_cache_path]}/piwik-#{plugin_name}-#{plugin_version}.zip" do
+    action :nothing
+    destination "/opt/piwik-#{version}/piwik/plugins"
+    overwrite true
+    owner "root"
+    group "root"
+    subscribes :extract, "remote_file[#{Chef::Config[:file_cache_path]}/piwik-#{plugin_name}-#{plugin_version}.zip]", :immediately
+  end
+end
+
 execute "/opt/piwik-#{version}/piwik/piwik.js" do
   command "gzip -k -9 /opt/piwik-#{version}/piwik/piwik.js"
   cwd "/opt/piwik-#{version}"
@@ -81,7 +98,7 @@ template "/opt/piwik-#{version}/piwik/config/config.ini.php" do
   mode "0644"
   variables :passwords => passwords,
             :directory => "/opt/piwik-#{version}/piwik",
-            :plugins => node[:piwik][:plugins]
+            :plugins => node[:piwik][:plugins].keys.sort
 end
 
 directory "/opt/piwik-#{version}/piwik/tmp" do