Tool:UKBot

From Wikitech
Toolforge tools
Website https://ukbot.toolforge.org/
Description Bot for article writing contests
Keywords python
Maintainer(s) Danmichaelo, Jon Harald Søby, Zache-tool (View all)
Source code https://github.com/danmichaelo/UKBot
License MIT License
Admin log Tools.ukbot/SAL

UKBot is a bot for article writing contests at nowiki, nnwiki, sewiki, fiwiki and euwiki, deployed at Portal:Toolforge under the "ukbot" tools account. It has a web interface at https://ukbot.toolforge.org/ powered by Webservice, and run jobs using the Toolforge Jobs Framework.

Maintenance

$ ssh login.toolforge.org
$ become ukbot

:# Update from github (authenticates using a password-less read-only deployment key in .ssh/id_ed25519)
$ git pull

:# (Re)start the webservice
$ webservice restart

:# If changes have been made to jobs.yaml, load the new version
$ toolforge-jobs load jobs.yaml

:# Verify that jobs  have been loaded
$ toolforge-jobs list --long

:# Manually running the bot with verbose logging (DEBUG level)
$ toolforge-jobs run adhoc-job --command "./jobs/run.sh fi-vk --verbose" --image python3.11

: # Update to a new Python image (e.g. from Python 3.9 to 3.11):
$ toolforge-jobs run bootstrap-venv --command "./jobs/bootstrap-venv.sh" --image python3.11 --wait
$ sed -i'' 's/python3.9/python3.11/' jobs.yaml
$ toolforge-jobs load jobs.yaml
$ sed -i'' 's/python3.9/python3.11/' service.template
$ webservice restart

Disaster recovery

Database tables are found in `db/init.sql` and can be loaded using something like this:

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