Skip to content

danmichaelo/UKBot

Repository files navigation

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 www/python/uwsgi.ini --python-autoreload 1 --master --http :5000

Deployment

At Tool Forge:

python3 -m venv www/python/venv
. www/python/venv/bin/activate
webservice --backend=kubernetes python shell
pip install -e .
exit
webservice --backend=kubernetes python start

Setup crontab:

crontab ukbot.crontab

Create database tables from scratch (disaster recovery):

mysql --defaults-file=~/replica.my.cnf -h tools.db.svc.eqiad.wmflabs s51083__ukbot < db/init.sql

Other notes

Forenklet flytkart: Flowchart

About

Weekly Contest Bot for Wikipedia

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •