Nova Resource:Wikispore/Runbook

From Wikitech

Access

See Accessing Cloud VPS instances. You'll need to be a member or administrator of the wikispore project.

Use

cd /srv/mediawiki-vagrant
vagrant ssh

to get into the virtual machine running MediaWiki .

Setting up a new Wikispore instance

  1. Follow the steps in Help:MediaWiki-Vagrant in Cloud VPS#Setting up your instance with MediaWiki-Vagrant.
  2. Download custom Wikispore Vagrant roles from gerrit 546156: (get inside the Vagrant box with cd /srv/mediawiki-vagrant; vagrant ssh if needed, then) cd /vagrant and cherry-pick the patch (command can be copied by visiting the previous link, clicking More > Download, selecting Anonymous HTTPS and the Cherry Pick field).
  3. Set vagrant config nfs_shares false (this is a workaround for T234694)
  4. Enable the wikispore role with vagrant roles enable wikispore
  5. Set the following values (with vagrant hiera <key> <value>):
    • role::mediawiki::hostname: the site's domain name
    • role::wsoauth::oauth_key and role::wsoauth::oauth_secret: the OAuth 1 consumer key and secret used for Wikimedia login
    • role::cargo::db_pass: the Cargo DB password
    • mediawiki::parallel_composer_jobs: optional, setting this to 1 makes upgrades slower but more reliable
  6. If this is a test instance, run vagrant hiera role::wikispore::beta true in the Cloud VPS box, from the /srv/mediawiki-vagrant directory.
  7. Run vagrant provision in the Cloud VPS box, from the /srv/mediawiki-vagrant directory.

Copying the DB of another Wikispore instance

(i.e. syncing up test with production)

  1. On the source server, get into vagrant, dump with e.g. mysqldump wiki | gzip -9 -c > /vagrant/wikispore.sql.gz
  2. Move the dump to the target server, e.g. from your local machine run scp wikispore.wmflabs.org:/srv/mediawiki-vagrant/wikispore.sql.gz wikispore-test.wmflabs.org:/srv/mediawiki-vagrant/wikispore.sql.gz
  3. On the target server, get into vagrant, import with e.g. zcat /vagrant/wikispore.sql.gz | mysql wiki

Upgrading Vagrant

  1. Go to /srv/mediawiki-vagrant
  2. Run sudo git pull --rebase
  3. Run vagrant provision

Note that this is hard to undo, as there isn't really a way to un-apply Vagrant changes. Test on wikispore-test first.

Upgrading MediaWiki and extensions/skins

  1. Go to /srv/mediawiki-vagrant
  2. Run vagrant git-update which will do everything: it runs git pull --rebase on MediaWiki core, all extensions and skins (and a couple of other libraries), runs composer update on everything, and runs maintenance/update.php.

Note that there is no automatic or easy way to undo this so test on wikispore-test first.

Adding a new extension/skin

  1. If the extension or skin does not have a Vagrant role yet, add it. (example, mediawiki::extension docs)
  2. Update 546156, add include role::<extension name> to puppet/modules/role/manifests/wikispore.pp, do other changes as needed (usually not)
  3. Update the code in the Vagrant checkout:
    1. Go to /srv/mediawiki-vagrant
    2. Run sudo git reset --hard @~
    3. Run sudo git fetch https://gerrit.wikimedia.org/r/mediawiki/vagrant refs/changes/56/546156/XX && sudo -E git cherry-pick FETCH_HEAD where XX is the patchset ID (you can also get this command by going to 546156, clicking on the "DOWNLOAD" button and then copying it from the "Cherry Pick" section)
  4. Run vagrant provision
  5. Probably do an upgrade (per above) as the new extension will be checked out from its master branch so best to keep everything in sync.

Adding a new namespace

  1. Go to Special:Namespaces
  2. Click on Add a namespace (you need to be admin)
  3. Number should be the smallest available even number starting with 3000 (per this). Default and Canonical should be checked. Name should be the namespace name. Reason can be ignored (it's shown in the logs).
  4. Add the corresponding talk namespace; the number should be one higher.