/UKBot

Weekly Contest Bot for Wikipedia

Primary LanguagePythonMIT LicenseMIT

ukbot

Bot for updating results in writing contests at Wikipedia, deployed at ukbot.wmflabs.org.

Getting Started

Create a new Python3 virtualenv and activate it:

mkdir -p www/python/venv
python3 -m venv www/python/venv
. www/python/venv/bin/activate

Install dependencies:

pip install .

If installation fails on Mac, try

LDFLAGS=-L/opt/homebrew/lib pip install .

Generate locales:

make all

Start a MariaDB instance with the necesseary database tables:

docker compose up -d

Create a configuration file:

cp .env.dist .env

and modify it if needed. The default database credentials should work with the MariaDB instance from Docker, but you may need to add Wikimedia credentials (Oauth 1.0a consumer-only credentials) if you want to actually run the bot locally.

Within the virtualenv you should now be able to run the bot. For testing purposes, you can create a sandbox contest page such as this one: https://no.wikipedia.org/wiki/Bruker:Danmichaelo/Sandkasse5 and test the bot with that page:

ukbot --page Bruker:Danmichaelo/Sandkasse5 --simulate config/config.no-mk.yml

or using the wrapper script:

JOB_NAME=no-mk JOB_ID=adhoc1 ./jobs/run.sh --page Bruker:Danmichaelo/Sandkasse5

To test the webinterface locally:

FLASK_UWSGI_DEBUG=true uwsgi --ini uwsgi.dev.ini --python-autoreload 1 --master --http :5000

Deployment

The bot is deployed at ToolForge under the "UKBot" account using Webservice and the Toolforge Jobs Framework.

See https://wikitech.wikimedia.org/wiki/Tool:UKBot for deployment notes.

Other notes

Forenklet flytkart: Flowchart