- logstash-forwarder
- mail
- mailman
+ - matomo
- memcached
- munin
- munin-plugins
- php
- php-apache
- php-fpm
- - piwik
- planet
- planet-current
- planet-dump
- name: mailman
run_list:
- recipe[mailman::default]
+ - name: matomo
+ run_list:
+ - recipe[matomo::default]
- name: memcached
run_list:
- recipe[memcached::default]
- name: php-fpm
run_list:
- recipe[php::fpm]
- - name: piwik
- run_list:
- - recipe[piwik::default]
- name: planet
run_list:
- recipe[planet::default]
--- /dev/null
+# Matomo Cookbook
+
+This cookbook installs and configures the Matomo server-side software used for
+analytics on openstreetmap.org
-default[:piwik][:version] = "4.10.1"
-default[:piwik][:plugins] = {
+default[:matomo][:version] = "4.10.1"
+default[:matomo][:plugins] = {
"Actions" => nil,
"Annotations" => nil,
"API" => nil,
"Widgetize" => nil,
}
-default[:mysql][:settings][:mysqld][:secure_file_priv] = "/opt/piwik-#{node[:piwik][:version]}/piwik/tmp/assets"
+default[:mysql][:settings][:mysqld][:secure_file_priv] = "/opt/matomo-#{node[:matomo][:version]}/matomo/tmp/assets"
-name "piwik"
+name "matomo"
maintainer "OpenStreetMap Administrators"
maintainer_email "admins@openstreetmap.org"
license "Apache-2.0"
-description "Installs and configures Piwik"
+description "Installs and configures Matomo"
version "1.0.0"
supports "ubuntu"
--- /dev/null
+#
+# Cookbook:: matomo
+# Recipe:: default
+#
+# Copyright:: 2011, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "apache"
+include_recipe "geoipupdate"
+include_recipe "mysql"
+include_recipe "php::fpm"
+
+passwords = data_bag_item("matomo", "passwords")
+
+package %w[
+ php-cli
+ php-curl
+ php-mbstring
+ php-mysql
+ php-gd
+ php-xml
+ php-apcu
+]
+
+apache_module "expires"
+apache_module "rewrite"
+
+version = node[:matomo][:version]
+
+geoip_directory = node[:geoipupdate][:directory]
+
+directory "/opt/matomo-#{version}" do
+ owner "root"
+ group "root"
+ mode "0755"
+end
+
+remote_file "#{Chef::Config[:file_cache_path]}/matomo-#{version}.zip" do
+ source "https://builds.matomo.org/matomo-#{version}.zip"
+ not_if { ::File.exist?("/opt/matomo-#{version}/matomo") }
+end
+
+archive_file "#{Chef::Config[:file_cache_path]}/matomo-#{version}.zip" do
+ destination "/opt/matomo-#{version}"
+ overwrite true
+ owner "root"
+ group "root"
+ not_if { ::File.exist?("/opt/matomo-#{version}/matomo") }
+end
+
+node[:matomo][:plugins].each do |plugin_name, plugin_version|
+ next if plugin_version.nil?
+
+ remote_file "#{Chef::Config[:file_cache_path]}/matomo-#{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]}/matomo-#{plugin_name}-#{plugin_version}.zip" do
+ action :nothing
+ destination "/opt/matomo-#{version}/matomo/plugins"
+ overwrite true
+ owner "root"
+ group "root"
+ subscribes :extract, "remote_file[#{Chef::Config[:file_cache_path]}/matomo-#{plugin_name}-#{plugin_version}.zip]", :immediately
+ end
+end
+
+execute "/opt/matomo-#{version}/matomo/matomo.js" do
+ command "gzip -k -9 /opt/matomo-#{version}/matomo/matomo.js"
+ cwd "/opt/matomo-#{version}"
+ user "root"
+ group "root"
+ not_if { ::File.exist?("/opt/matomo-#{version}/matomo/matomo.js.gz") }
+end
+
+execute "/opt/matomo-#{version}/matomo/piwik.js" do
+ command "gzip -k -9 /opt/matomo-#{version}/matomo/piwik.js"
+ cwd "/opt/matomo-#{version}"
+ user "root"
+ group "root"
+ not_if { ::File.exist?("/opt/matomo-#{version}/matomo/piwik.js.gz") }
+end
+
+directory "/opt/matomo-#{version}/matomo/config" do
+ owner "www-data"
+ group "www-data"
+ mode "0755"
+end
+
+template "/opt/matomo-#{version}/matomo/config/config.ini.php" do
+ source "config.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ variables :passwords => passwords,
+ :directory => "/opt/matomo-#{version}/matomo",
+ :plugins => node[:matomo][:plugins].keys.sort
+end
+
+directory "/opt/matomo-#{version}/matomo/tmp" do
+ owner "www-data"
+ group "www-data"
+ mode "0755"
+end
+
+directory "/opt/matomo-#{version}/matomo/tmp/assets" do
+ owner "www-data"
+ group "mysql"
+ mode "0750"
+end
+
+link "/opt/matomo-#{version}/matomo/misc/GeoLite2-ASN.mmdb" do
+ to "#{geoip_directory}/GeoLite2-ASN.mmdb"
+end
+
+link "/opt/matomo-#{version}/matomo/misc/GeoLite2-City.mmdb" do
+ to "#{geoip_directory}/GeoLite2-City.mmdb"
+end
+
+link "/opt/matomo-#{version}/matomo/misc/GeoLite2-Country.mmdb" do
+ to "#{geoip_directory}/GeoLite2-Country.mmdb"
+end
+
+link "/srv/matomo.openstreetmap.org" do
+ to "/opt/matomo-#{version}/matomo"
+ notifies :restart, "service[php#{node[:php][:version]}-fpm]"
+end
+
+mysql_user "piwik@localhost" do
+ password passwords["database"]
+end
+
+mysql_database "piwik" do
+ permissions "piwik@localhost" => :all
+end
+
+ssl_certificate "matomo.openstreetmap.org" do
+ domains ["matomo.openstreetmap.org", "matomo.osm.org",
+ "piwik.openstreetmap.org", "piwik.osm.org"]
+ notifies :reload, "service[apache2]"
+end
+
+php_fpm "matomo.openstreetmap.org" do
+ prometheus_port 9253
+end
+
+apache_site "matomo.openstreetmap.org" do
+ template "apache.erb"
+end
+
+cron_d "matomo" do
+ minute "5"
+ user "www-data"
+ command "/usr/bin/php /srv/matomo.openstreetmap.org/console core:archive --quiet --url=https://matomo.openstreetmap.org/"
+end
+
+cron_d "piwik" do
+ action :delete
+end
# DO NOT EDIT - This file is being maintained by Chef
<VirtualHost *:443>
- ServerName piwik.openstreetmap.org
+ ServerName matomo.openstreetmap.org
+ ServerAlias matomo.osm.org
+ ServerAlias piwik.openstreetmap.org
ServerAlias piwik.osm.org
ServerAdmin webmaster@openstreetmap.org
SSLEngine on
- SSLCertificateFile /etc/ssl/certs/piwik.openstreetmap.org.pem
- SSLCertificateKeyFile /etc/ssl/private/piwik.openstreetmap.org.key
+ SSLCertificateFile /etc/ssl/certs/matomo.openstreetmap.org.pem
+ SSLCertificateKeyFile /etc/ssl/private/matomo.openstreetmap.org.key
- CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
- ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
+ CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined
+ ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
Options -Indexes
- DocumentRoot /srv/piwik.openstreetmap.org
+ DocumentRoot /srv/matomo.openstreetmap.org
Redirect 403 /core/
Redirect 403 /config/
</VirtualHost>
<VirtualHost *:80>
- ServerName piwik.openstreetmap.org
+ ServerName matomo.openstreetmap.org
+ ServerAlias matomo.osm.org
+ ServerAlias piwik.openstreetmap.org
ServerAlias piwik.osm.org
ServerAdmin webmaster@openstreetmap.org
- CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
- ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
+ CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined
+ ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
- RedirectPermanent / https://piwik.openstreetmap.org/
+ RedirectPermanent / https://matomo.openstreetmap.org/
</VirtualHost>
-<Directory /srv/piwik.openstreetmap.org>
+<Directory /srv/matomo.openstreetmap.org>
Require all granted
ExpiresActive On
</FilesMatch>
<FilesMatch ".+\.ph(ar|p|tml)$">
- SetHandler "proxy:unix:/run/php/piwik.openstreetmap.org.sock|fcgi://127.0.0.1"
+ SetHandler "proxy:unix:/run/php/matomo.openstreetmap.org.sock|fcgi://127.0.0.1"
</FilesMatch>
</Directory>
force_ssl_login = 1
login_allowlist_apply_to_reporting_api_requests = "0"
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
+trusted_hosts[] = "matomo.openstreetmap.org"
trusted_hosts[] = "piwik.openstreetmap.org"
salt = "<%= @passwords['salt'] %>"
[Tracker]
-ignore_visits_cookie_name = "piwik_ignore"
+ignore_visits_cookie_name = "matomo_ignore"
[Plugins]
<% @plugins.each do |plugin| -%>
+++ /dev/null
-# Piwik Cookbook
-
-This cookbook installs and configures the Piwiki server-side software used for
-analytics on openstreetmap.org
+++ /dev/null
-#
-# Cookbook:: piwik
-# Recipe:: default
-#
-# Copyright:: 2011, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include_recipe "apache"
-include_recipe "geoipupdate"
-include_recipe "mysql"
-include_recipe "php::fpm"
-
-passwords = data_bag_item("piwik", "passwords")
-
-package %w[
- php-cli
- php-curl
- php-mbstring
- php-mysql
- php-gd
- php-xml
- php-apcu
-]
-
-apache_module "expires"
-apache_module "rewrite"
-
-version = node[:piwik][:version]
-
-geoip_directory = node[:geoipupdate][:directory]
-
-directory "/opt/piwik-#{version}" do
- owner "root"
- group "root"
- mode "0755"
-end
-
-remote_file "#{Chef::Config[:file_cache_path]}/piwik-#{version}.zip" do
- source "https://builds.matomo.org/piwik-#{version}.zip"
- not_if { ::File.exist?("/opt/piwik-#{version}/piwik") }
-end
-
-archive_file "#{Chef::Config[:file_cache_path]}/piwik-#{version}.zip" do
- destination "/opt/piwik-#{version}"
- overwrite true
- owner "root"
- group "root"
- 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}"
- user "root"
- group "root"
- not_if { ::File.exist?("/opt/piwik-#{version}/piwik/piwik.js.gz") }
-end
-
-directory "/opt/piwik-#{version}/piwik/config" do
- owner "www-data"
- group "www-data"
- mode "0755"
-end
-
-template "/opt/piwik-#{version}/piwik/config/config.ini.php" do
- source "config.erb"
- owner "root"
- group "root"
- mode "0644"
- variables :passwords => passwords,
- :directory => "/opt/piwik-#{version}/piwik",
- :plugins => node[:piwik][:plugins].keys.sort
-end
-
-directory "/opt/piwik-#{version}/piwik/tmp" do
- owner "www-data"
- group "www-data"
- mode "0755"
-end
-
-directory "/opt/piwik-#{version}/piwik/tmp/assets" do
- owner "www-data"
- group "mysql"
- mode "0750"
-end
-
-link "/opt/piwik-#{version}/piwik/misc/GeoLite2-ASN.mmdb" do
- to "#{geoip_directory}/GeoLite2-ASN.mmdb"
-end
-
-link "/opt/piwik-#{version}/piwik/misc/GeoLite2-City.mmdb" do
- to "#{geoip_directory}/GeoLite2-City.mmdb"
-end
-
-link "/opt/piwik-#{version}/piwik/misc/GeoLite2-Country.mmdb" do
- to "#{geoip_directory}/GeoLite2-Country.mmdb"
-end
-
-link "/srv/piwik.openstreetmap.org" do
- to "/opt/piwik-#{version}/piwik"
- notifies :restart, "service[php#{node[:php][:version]}-fpm]"
-end
-
-mysql_user "piwik@localhost" do
- password passwords["database"]
-end
-
-mysql_database "piwik" do
- permissions "piwik@localhost" => :all
-end
-
-ssl_certificate "piwik.openstreetmap.org" do
- domains ["piwik.openstreetmap.org", "piwik.osm.org"]
- notifies :reload, "service[apache2]"
-end
-
-php_fpm "piwik.openstreetmap.org" do
- prometheus_port 9253
-end
-
-apache_site "piwik.openstreetmap.org" do
- template "apache.erb"
-end
-
-cron_d "piwik" do
- minute "5"
- user "www-data"
- command "/usr/bin/php /srv/piwik.openstreetmap.org/console core:archive --quiet --url=https://piwik.openstreetmap.org/"
-end
run_list(
"role[ucl]",
"role[hp-dl360-g6]",
- "role[piwik]"
+ "role[matomo]"
)
-name "piwik"
-description "Role applied to all Piwik servers"
+name "matomo"
+description "Role applied to all Matomo servers"
default_attributes(
:apache => {
)
run_list(
- "recipe[piwik]"
+ "recipe[matomo]"
)
{
- "id": "piwik",
- "location": "piwik",
+ "id": "matomo",
+ "location": "matomo",
"site": 100,
"goals": {
"signup": 1001,