Obsolete:grrrit-wm

From Wikitech
(Redirected from User:Addshore/Grrrit-wm)
Jump to: navigation, search
wikibugs has taken over this function

grrrit-wm is an IRC bot that listens to events from Gerrit and reports them on various IRC channels; it replaces gerrit-wm.

Which repo changes report to which channels can be configured in config.yaml [1]; it defaults to #wikimedia-dev, see mw:MediaWiki on IRC.

Running it

It runs in a Docker container in our new Kubernetes cluster under the tools project in labs. It uses one of the base containers that tool labs provides (docker-registry.tools.wmflabs.org/toollabs-nodejs-base:latest). You can see the YAML file used as the kubernetes deployment definition in kubernetes-deployment.yaml in the repository. If you want to start the bot entirely from scratch, then just doing kubectl apply -f kubernetes-deployment.yaml should work.

Config changes

To add more repo -> channel mappings, edit config.yaml. The repo names can be matched using regexen. The tool needs to be restarted for the changes to take effect - see the deploying and restarting sections for more.

Building/Deploying

Log files

ssh tools-login.wmflabs.org
become lolrrit-wm
kubectl get pods
kubectl logs grrrit-otnlc   # use actual pod name from previous command
Deploying or restarting
$ ssh tools-login.wmflabs.org
$ become lolrrit-wm
# cd into lolrrit-wm and change repository to deploy (e.g. git pull)
$ kubectl get pods
NAME                          READY     STATUS    RESTARTS   AGE
grrrit-wm-230500525-qk7fl     1/1       Running   0          2m
lolrrit-wm-3433923449-x40eu   1/1       Running   0          4d
$ kubectl delete pod grrrit-wm-230500525-qk7fl # use actual pod name from previous command

Temporarily Stopping You can just the deployment to run 0 instances.

$ kubectl scale --replicas=0 deployment/grrrit-wm
deployment "grrrit-wm" scaled

Restarting after stopping

Just scale it back to 1 instance.

$ kubectl scale --replicas=1 deployment/grrrit-wm
deployment "grrrit-wm" scaled

Code

The code is hosted on Gerrit, under labs/tools/grrrit [2].

Historical

  • It first used to run on the gridengine, and received gerrit changes via redis stream
  • Then it ran on gridengine, but didn't use redis at all
  • It was the first tool to be moved to kubernetes, using a custom docker image
  • Now it just runs on the kubernetes cluster, without any custom docker images.

npm 2 upgrade changes

cd ~/lol*

edit

.profile

add

source ~/.bashrc

at bottom of file.


Then edit

.npmrc

and add

prefix = /data/project/lolrrit-wm/.npm-packages

Then run

/usr/share/npm/bin/npm-cli.js install -g npm@2 // Change the 2 to the version you want.

See also