From: Tom Hughes Date: Fri, 29 Jul 2022 09:47:18 +0000 (+0100) Subject: Install the DeviceFeatureWebGL plugin for piwik X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/bf96ed36324669a5c261a34fd7903663ff11c2aa Install the DeviceFeatureWebGL plugin for piwik Closes #519 --- diff --git a/cookbooks/piwik/attributes/default.rb b/cookbooks/piwik/attributes/default.rb index 0c4909260..ff933400e 100644 --- a/cookbooks/piwik/attributes/default.rb +++ b/cookbooks/piwik/attributes/default.rb @@ -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" diff --git a/cookbooks/piwik/recipes/default.rb b/cookbooks/piwik/recipes/default.rb index 0a32dda4e..483a348cb 100644 --- a/cookbooks/piwik/recipes/default.rb +++ b/cookbooks/piwik/recipes/default.rb @@ -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