Page MenuHomePhabricator

Security Upgrade for piwik
Closed, ResolvedPublic3 Estimated Story Points

Description

Check the 2.16 -> 2.17 changelog for db upgrade procedures and perform them while Luca updates the deb.

Event Timeline

Milimetric triaged this task as Medium priority.
Milimetric edited projects, added Analytics-Kanban; removed Analytics.
Milimetric updated the task description. (Show Details)
Milimetric set the point value for this task to 3.
Nuria added a subscriber: Milimetric.

As far as I can see the last version available for LTS 2.x is 2.17.1, and it will be required to upgrade the db schema. I have no idea if we can jump directly to 2.17.1 or if we need to upgrade all the intermediate versions, need to ask to upstream and/or just test it in labs.

From what I gathered the procedure should be:

  1. Put Piwik in maintenance mode via config - https://piwik.org/faq/how-to/faq_111/
  2. Mysql dump of the DB
  3. Install the new deb - https://debian.piwik.org/pool/main/p/piwik/piwik_2.17.0-1_all.deb
  4. Connect to the UI and upgrade Piwik's DB schema with the helper or better use the CLI console and run /usr/share/piwik/console core:update - https://piwik.org/docs/update/#the-manual-three-step-update
elukey raised the priority of this task from Medium to High.Apr 14 2017, 2:23 PM
elukey added a parent task: T163000: Piwik improvements.

@elukey: it should be trivial to backup the db, try the upgrade, and if it fails recover. If you think that saves you time we can announce a slight down-time on piwik and do it.

Today I've set up a Debian Jessie VM, installed 2.16 and tried to upgrade to 2.17-1. This is the result of the db upgrade script:

vagrant@debian-jessie:~$ sudo php /usr/share/piwik/console core:update

    *** Update ***

    Database Upgrade Required

    Your Piwik database is out-of-date, and must be upgraded before you can continue.

    Piwik database will be upgraded from version 2.16.0 to the new version 2.17.1.

    The following dimensions will be updated: log_visit.visit_entry_idaction_url.


This is a major update! It will take longer than usual.

    *** Note: this is a Dry Run ***

    ALTER TABLE `piwik_log_visit` MODIFY COLUMN `visit_entry_idaction_url` INTEGER(11) UNSIGNED NULL  DEFAULT NULL;

    *** End of Dry Run ***

A database upgrade is required. Execute update? (y/N) y

Starting the database upgrade process now. This may take a while, so please be patient.

    *** Update ***

    Database Upgrade Required

    Your Piwik database is out-of-date, and must be upgraded before you can continue.

    Piwik database will be upgraded from version 2.16.0 to the new version 2.17.1.

    The following dimensions will be updated: log_visit.visit_entry_idaction_url.

    The database upgrade process may take a while, so please be patient.

  Executing ALTER TABLE `piwik_log_visit` MODIFY COLUMN `visit_entry_idaction_url` INTEGER(11) UNSIGNED NULL  DEFAULT NULL... Done. [1 / 1]

Piwik has been successfully updated!

Everything went fine and Piwik restarted at version 2.17 without major issues.

@Milimetric I think that we can schedule some downtime for the tracker and the UI (so there will be a loss of data), and then upgrade :)

Hi @JMinor! We'd like to schedule some downtime for Thursday to upgrade Piwik to the latest LTS release. This will cause some events to not be recorded, but the maintenance window should be something like 30 minutes. Anything against it?

Nope, that should be no problem from out side. Thanks for checking!

Total downtime of two hours (just ended now) due to long backup for the mysql database and schema changes required (an alter table that last more than one hour was the primary issue).

elukey moved this task from Ready to Deploy to Done on the Analytics-Kanban board.