Page MenuHomePhabricator

Reenable Matomo [previously Piwik]
Closed, ResolvedPublic24 Estimated Story Points


Last time piwik was updated (2017) the update failed in a non recoverable way. IIRC this was due to the db server being outdated. Add a result we haven't collected any stats for e.g.

We should update/migrate the database server, renewable piwik and add an SSL certificate for it.

Both the piwik server and the db server likely host other services which we need to ensure survive the transition.

Event Timeline

The Piwik module was disabled during last Drupal update, see T207354#4677368.

This should be done both on and on our new website.

@Sebastian_Berlin-WMSE please talk with @Evelina-Bang-WMSE about implementation on the new website. Perhaps the web developer could help as well, or at least should be informed.

Jopparn renamed this task from Reenable piwik to Reenable Matomo [previously Piwik].Apr 15 2019, 8:10 AM

A Bahnhof server running the at the lowest requirements would cost 1.95862 SEK / hour = 1 410 SEK / 30 days.

We have a limited budget so experiment with an even lower level and if this doesn't work then we can get this later this year when we start our donation and membership drives.

That is the plugin I found on (in case we want to experiment)

Sebastian_Berlin-WMSE set the point value for this task to 24.

Use Banhof communication to decide on deletion of T232567

Set up automatic updates following the instructions on Set time for rebooting (when necessary) to 02:00. Set up mailx to send emails to drift@ if somethings need attention.

I prepared the installation by following the instructions on, up until "Start the Installation". This is more or less the order in which I did stuff:

  • Installed Nginx as web server since there was a config prepared for that
    • There was initially problems accessing the server remotely. It took me a while to figure out that I needed to add firewall rules at Bahnhof (not ufw mentioned in the installation instructions for Nginx). I opened port 80 to install Letsencrypt and later changed that to 443 to only allow https.
  • Added as a subdomain in Loopia
  • Installed Letsencrypt certificates using Certbot, following the instructions for Nginx
    • I told Letsencrypt to redirect HTTP to HTTPS
  • Added link to matomo.conf and removed default from /etc/nginx/sites-enabled/
  • Removed Apache
    • At some point, this must have been installed, but it broke Nginx (gave error 502)
  • Put the Matomo files in /var/www/matomo/

After that, I got to the installation wizard when visiting the server. Initially there was some problem with permissions (the Matomo files were owned by root, should be www-data), but the installer was kind enough to give me the commands needed to fix that.

I set up MySQL with user "matomo" and database "matomo".

The web based setup went fine. I checked "email me with major Matomo community updates" for email options since it wasn't clear if this was required for security updates or not. I Added as site, but haven't added the tracking code yet.

I managed to set up a test site in Matomo (on and add the tracking code. It tracks the visits, though it thinks I'm in the US.

[...] though it thinks I'm in the US.

Maybe this can be fixed in Settings > System > Geolocation.

The cost of the server at Bahnhof ended up being about 280 SEK/30 days (186 SEK for the server and half that again for backup, which is about the ratio of the backups across all server).

I reduced the disk size to 5 GB which leaves the disk at 65% full currently. We should check in on how much gets eaten up once Matomo starts to actually do it's thing. In the long run, we probably want an automatic server monitor (T234508) so we don't have to keep track of it manually.

I'd say this is done as the server is now up and running. Remaining work to actually start using Matomo can be found in the related tasks.