MediaWiki-Vagrant/OS upgrade

MediaWiki-Vagrant uses Puppet to modify a Debian base VM. Most changes can be managed via Puppet (and thus can be applied by just running vagrant provision), but upgrading the OS to a new Debian release cannot. When you update MediaWiki-Vagrant to a version that requires a newer OS, at the next provisioning attempt it will tell you to rebuild the VM.

Ideally Vagrant boxes should not contain anything important ("cattle not pets") and so you should be able to just delete the whole thing with vagrant destroy -f; vagrant up and discard all state. In practice having to recreate the old state is sometimes uncomfortable, so here is an approximate process of upgrading MediaWiki-Vagrant while mostly keeping it intact:

  • dump the DB by running this command inside Vagrant:
    mysqldump --add-drop-database --databases `mysql -rNe 'show databases' | ack -v '^(mysql|information_schema|performance_schema)$'` > /vagrant/dump.sql
    
  • update MediaWiki-Vagrant itself with git pull
  • rebuild VM: vagrant destroy -f; vagrant up
  • restore the DB dump by running this command inside Vagrant: mysql < /vagrant/dump.sql
  • clear MediaWiki caches, e.g. by running vagrant reload
  • regenerate all data wasn't stored in the DB
    • if the cirrussearch role is enabled, run mwscript /vagrant/mediawiki/extensions/CirrusSearch/maintenance/ForceSearchIndex.php inside Vagrant

See also edit

  • T256822 - upgrading from Stretch (9) to Buster (10)
  • T319167 - upgrading from Buster (10) to Bullseye (11)