Skip to content

WikimediaNorge/UKBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UKBot

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

Created by Dan Michael and maintained with ❤︎ by contributors

Getting Started

Clone code from github

git clone https://github.com/WikimediaNorge/UKBot.git
cd UKBot

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

To modify the code and test it locally, you'll need to install it as a pip package first, and then run it:

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

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