Nova Resource:Wikistats

From Wikitech
Jump to navigation Jump to search
For the Wikimedia Fondation project see mw:Wikistats.
Project Name wikistats



A project that collects and displays statistics for Mediawikis.


Collecting statistics about Mediawiki installs on the internet.

Anticipated traffic level

10-100 hits per day

Anticipated time span


Project status

currently running

Contact address

Willing to take contributors or not


Subject area narrow or broad

narrow statistics

Where to find the code

Wikistats consists of 2 parts, the puppet manifests (in the operations/puppet git repo) and the Debian package (in the operations/debs/wikistats repo).

The puppet part is divided into ./puppet/modules/role/manifests/wikistats/instance.pp,the role class which is applied to a node/instance, and the module in ./puppet/modules/wikistats/.


  1. role::wikistats - configures host name and SSL certs depending on labs vs. prod, uses the main classes below, is all that needs to be included on an instance or node
  2. wikistats - the init.pp of the module, sets up user/group, installs package (if we're using labsdebprepo), uses the other classes
  3. wikistats::cronjob - defines a cron job to update a table
  4. wikistats::db - installs mariadb, php-mysql
  5. wikistats::updates - installs php-cli, creates log dir, has definitions for the update cron jobs and configures them
  6. wikistats::web - does the Apache setup

(Currently they do not automatically install the package yet which is done manually)

How to build the Debian package

  1. git clone
  2. cd wikistats
  3. "debuild" (signed) or "debuild -us -uc" (unsigned)
  4. cd ..
  5. optional: check which files would be installed by this: dpkg-deb -c wikistats_*_all.deb
  6. install: dpkg -i wikistats_*_all.deb

How to deploy latest code

/usr/local/bin/wikistats# ./deploy-wikistats deploy

Optionally use "backup" to make a backup of current code before deploying or "restore" to restore from the last backup.

/usr/local/bin/wikistats# ./deploy-wikistats backup
/usr/local/bin/wikistats# ./deploy-wikistats restore

How to fix DB grants if they break after deploy

grep db_pass /etc/wikistats/config.php
mysql -u root -p wikistats
mysql> grant all privileges on wikistats.* to 'wikistatsuser'@'localhost' identified by '<password from config.php>';
Edit documentation

Server admin log


  • 23:47 mutante: - shutting down and removing instance wikistats-dancing-goat - backup stored on -wild-tiger
  • 23:35 mutante: deleting web proxy wikistats-old


  • 00:05 mutante: re-enabling puppet (disabled without reason) on wikistats-wild-tiger


  • 22:25 mutante: - replacing all cron jobs with systemd timers - gerrit:645455 - T265138


  • 23:57 mutante: fixed updates of gamepedia wikis


  • 19:41 mutante: wikistats-dancing-goat - cron service was broken for unknown reason - systemctl sta... (more)