Tool:Pageviews

From Wikitech
Jump to: navigation, search
Toolforge tools
Crystal Clear app package utilities.png Pageviews Analysis
Website https://tools.wmflabs.org/pageviews/
Description Suite of tools to visualize pageviews
Keywords pageviews, statistics, analytics
Author(s) MusikAnimal, Kaldari, Marcel Ruiz Forns
Maintainer(s) MusikAnimal, Kaldari (View all)
Source code GitHub
License MIT License
Issues Phabricator
Pageviews Analysis is a suite of tools to visualize pageviews data of Wikimedia Foundation wikis. The suite includes seven tools that all share the same codebase: Pageviews, Langviews, Topviews, Siteviews, Redirect Views and Userviews.

See meta:Pageviews Analysis for user documentation.

Deployment

There is a deploy.sh script to make deployment easier:
$ ssh tools-dev.wmflabs.org
$ become pageviews
$ sh deploy.sh
...
From https://github.com/MusikAnimal/pageviews
 * branch            master     -> FETCH_HEAD
Fast-forward
This script will pull in the new code from master, copy the pageviews/public_html directory to ~/public_html, re-add necessary symlinks, and update the JSDocs (which are at ~/public_html/jsdocs in the pageviews tool).

Setting up a new app

  • become the new tool, then run git clone https://github.com/MusikAnimal/pageviews.git
  • cd pageviews && composer install
  • Back in the home directory, create a file called config.php. The contents should define the root of the project's codebase, and the URL to the "meta" app's API (explained below):
    <?php
    // Define the root of the project directory so that the vendor and messages directories
    // can be accessed with non-relative paths.
    define( 'ROOTDIR', '/data/project/mynewtool/pageviews' );
    define( 'METAROOT', 'tools.wmflabs.org/musikanimal/api' );
    
  • Setup the necessary symlinks so that the relative paths point to the right place. Do this by running ln -s public_html/file.php file.php for each necessary file listed below. Afterwards, running ls -al in the home directory should show:
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       30 May  5  2016 _browser_check.php -> public_html/_browser_check.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       22 Jul 29  2016 faq_parts -> public_html/faq_parts/
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       23 Apr 18  2016 _footer.php -> public_html/_footer.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       23 Nov 12 19:06 _header.php -> public_html/_header.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       21 Apr 18  2016 _head.php -> public_html/_head.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       30 Apr 19  2016 _lang_selector.php -> public_html/_lang_selector.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       23 Jun 29  2016 _modals.php -> public_html/_modals.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       23 Jun 29  2016 _output.php -> public_html/_output.php
    lrwxrwxrwx    1 tools.mynewtool tools.mynewtool       22 Jul 29  2016 url_parts -> public_html/url_parts/
    
  • Create the deploy.sh script in the home directory, to be used when deploying updates:
    cd ~/pageviews
    git pull origin master
    cd ~
    cp -R pageviews/public_html/mynewtool/* public_html
    cp -R pageviews/public_html/url_parts/ public_html
    cp -R pageviews/public_html/faq_parts/ public_html
    cp pageviews/public_html/_*.php public_html/
    
  • Finally, start the kubernetes webservice with webservice --backend=kubernetes start

Meta application

Aside from loading translations and a few other things, the Pageviews Analysis suite of apps is entirely clientside. Some functionality depends on API provided by the so-called "meta app", which is currently https://tools.wmflabs.org/musikanimal. At some point the API functionality may be migrated to be self-contained within the Pageviews code base. This meta app is also used to record basic usage statistics of each app.

See also