1<chapter xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:xi="http://www.w3.org/2001/XInclude"
4 version="5.0"
5 xml:id="module-services-matomo">
6
7 <title>Matomo</title>
8 <para>
9 Matomo is a real-time web analytics application.
10 This module configures php-fpm as backend for Matomo, optionally configuring an nginx vhost as well.
11 </para>
12
13 <para>
14 An automatic setup is not suported by Matomo, so you need to configure Matomo itself in the browser-based Matomo setup.
15 </para>
16
17
18 <section xml:id="module-services-matomo-database-setup">
19 <title>Database Setup</title>
20
21 <para>
22 You also need to configure a MariaDB or MySQL database and -user for Matomo yourself,
23 and enter those credentials in your browser.
24 You can use passwordless database authentication via the UNIX_SOCKET authentication plugin
25 with the following SQL commands:
26
27 <programlisting>
28 # For MariaDB
29 INSTALL PLUGIN unix_socket SONAME 'auth_socket';
30 CREATE DATABASE matomo;
31 CREATE USER 'matomo'@'localhost' IDENTIFIED WITH unix_socket;
32 GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
33
34 # For MySQL
35 INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
36 CREATE DATABASE matomo;
37 CREATE USER 'matomo'@'localhost' IDENTIFIED WITH auth_socket;
38 GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
39 </programlisting>
40
41 Then fill in <literal>matomo</literal> as database user and database name, and leave the password field blank.
42 This authentication works by allowing only the <literal>matomo</literal> unix user to authenticate as the
43 <literal>matomo</literal> database user (without needing a password), but no other users.
44 For more information on passwordless login, see
45 <link xlink:href="https://mariadb.com/kb/en/mariadb/unix_socket-authentication-plugin/" />.
46 </para>
47
48 <para>
49 Of course, you can use password based authentication as well, e.g. when the database is not on the same host.
50 </para>
51 </section>
52
53
54 <section xml:id="module-services-matomo-backups">
55 <title>Backup</title>
56 <para>
57 You only need to take backups of your MySQL database and the
58 <filename>/var/lib/matomo/config/config.ini.php</filename> file.
59 Use a user in the <literal>matomo</literal> group or root to access the file.
60 For more information, see <link xlink:href="https://matomo.org/faq/how-to-install/faq_138/" />.
61 </para>
62 </section>
63
64
65 <section xml:id="module-services-matomo-issues">
66 <title>Issues</title>
67 <itemizedlist>
68 <listitem>
69 <para>
70 Matomo's file integrity check will warn you.
71 This is due to the patches necessary for NixOS, you can safely ignore this.
72 </para>
73 </listitem>
74
75 <listitem>
76 <para>
77 Matomo will warn you that the JavaScript tracker is not writable.
78 This is because it's located in the read-only nix store.
79 You can safely ignore this, unless you need a plugin that needs JavaScript tracker access.
80 </para>
81 </listitem>
82 </itemizedlist>
83 </section>
84
85
86 <section xml:id="module-services-matomo-other-web-servers">
87 <title>Using other Web Servers than nginx</title>
88
89 <para>
90 You can use other web servers by forwarding calls for <filename>index.php</filename> and
91 <filename>piwik.php</filename> to the <literal>/run/phpfpm-matomo.sock</literal> fastcgi unix socket.
92 You can use the nginx configuration in the module code as a reference to what else should be configured.
93 </para>
94 </section>
95</chapter>