Pathoschild / Wikimedia-contrib

A collection of user scripts and Tool Labs tools intended for users of Wikimedia Foundation wikis.
MIT License
45 stars 28 forks source link

Wikimedia-contrib is a collection of user scripts and Toolforge tools intended for users of Wikimedia Foundation wikis.

For users

Tools

Toolforge is part of the Wikimedia Cloud infrastructure hosted by the Wikimedia Foundation for community-developed tools and bots. These tools provide analysis and data to support wiki editors and functionaries.

User scripts

These user scripts extend the wiki interface seen by a user, and they're sometimes available to all users as gadgets (particularly TemplateScript). See _Gadget kitchen_ for an introduction to user scripts & gadgets.

For maintainers

Deploy to Toolforge

This repo uses three Toolforge accounts by default:

account tools
meta most tools
meta2 crossactivity
meta3 stalktoy

They redirect as needed, so all tools can be accessed through eitherhostname. To use different accounts, edit the tool-labs/backend/modules/__config__.php and tool-labs/.lighttpd* files accordingly.

To deploy from scratch:

  1. Connect to Toolforge via SSH.
  2. Run this script:

    ##########
    ## Set up meta
    ##########
    # switch to the meta project
    become meta
    
    ## set up tool files
    git clone https://github.com/Pathoschild/Wikimedia-contrib.git git/wikimedia-contrib
    mkdir cache
    mkdir public_html
    ln -s git/wikimedia-contrib/tool-labs/.lighttpd.meta.conf .lighttpd.conf
    cd public_html
    for TARGET in backend content 'toolinfo.json' accounteligibility catanalysis globalgroups gusersearch iso639db magicredirect pgkbot regextoy stewardry userpages
    do
      ln -s "../git/wikimedia-contrib/tool-labs/$TARGET"
    done
    
    # set up script CDN (accessed via https://tools-static.wmflabs.org/meta/scripts/*.js).
    mkdir ~/www
    mkdir ~/www/static
    cd ~/www/static
    ln -s ~/git/wikimedia-contrib/user-scripts scripts
    
    ## launch server
    webservice --backend=kubernetes start
    
    ##########
    ## Set up meta2
    ##########
    ## switch to the meta2 project
    exit
    become meta2
    
    ## set up files
    git clone https://github.com/Pathoschild/Wikimedia-contrib.git git/wikimedia-contrib
    mkdir cache
    mkdir public_html
    ln -s git/wikimedia-contrib/tool-labs/.lighttpd.meta2.conf .lighttpd.conf
    cd public_html
    for TARGET in backend content crossactivity
    do
      ln -s "../git/wikimedia-contrib/tool-labs/$TARGET"
    done
    
    ## launch server
    webservice --backend=kubernetes start
    
    ##########
    ## Set up meta3
    ##########
    ## switch to the meta3 project
    exit
    become meta3
    
    ## set up files
    git clone https://github.com/Pathoschild/Wikimedia-contrib.git git/wikimedia-contrib
    mkdir cache
    mkdir public_html
    ln -s git/wikimedia-contrib/tool-labs/.lighttpd.meta3.conf .lighttpd.conf
    cd public_html
    for TARGET in backend content stalktoy
    do
      ln -s "../git/wikimedia-contrib/tool-labs/$TARGET"
    done
    
    ## launch server
    webservice --backend=kubernetes start

That's it! The new tools should now be running at https://meta.toolforge.org. To update an account later, just login and run these commands:

git -C git/wikimedia-contrib pull
webservice restart