You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Tool:Bridgebot: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>BryanDavis
(first!)
 
imported>BryanDavis
Line 21: Line 21:
The bot runs from [[Portal:Toolforge|Toolforge]] under the "bridgebot" account as a [[Help:Toolforge/Kubernetes|kubernetes]] pod.
The bot runs from [[Portal:Toolforge|Toolforge]] under the "bridgebot" account as a [[Help:Toolforge/Kubernetes|kubernetes]] pod.


<syntaxhighlight lang="sh">
<syntaxhighlight lang="yaml">
# TODO: document creating Deployment
---
# TODO: document quick restart (pod delete)
kind: Deployment
# TODO: document "full" restart (Deployment delete; Deployment create)
apiVersion: apps/v1
# TODO: document upgrading the golang binary
metadata:
  name: bridgebot.bot
  namespace: tool-bridgebot
  labels:
    name: bridgebot.bot
    toolforge: tool
spec:
  replicas: 1
  selector:
    matchLabels:
      name: bridgebot.bot
      toolforge: tool
  template:
    metadata:
      labels:
        name: bridgebot.bot
        toolforge: tool
    spec:
      containers:
        - name: bot
          image: docker-registry.tools.wmflabs.org/toolforge-buster-sssd:latest
          command:
            - "/data/project/bridgebot/matterbridge"
            - "-debug"
            - "-conf"
            - "/data/project/bridgebot/matterbridge.toml"
          workingDir: /data/project/bridgebot
          env:
            - name: HOME
              value: /data/project/bridgebot
          imagePullPolicy: Always
</syntaxhighlight>
 
<syntaxhighlight lang="shell-session">
$ ssh dev.tools.wmflabs.org
$ become bridgebot
 
:# Deploying
$ kubectl create --validate=true -f deployment.yaml
 
:# Quick restart (pod delete)
$ kubectl delete po/$(kubectl get pods | grep Running | awk '{print $1}')
 
:# "Full" restart (Deployment delete; Deployment create)
$ kubectl delete deploy/bridgebot.bot
$ kubectl create --validate=true -f deployment.yaml
 
:# Upgrading the golang binary
$ wget https://github.com/42wim/matterbridge/releases/download/v{$version}/matterbridge-{$version}-linux-64bit
$ rm matterbridge
$ ln -s matterbridge-{$version}-linux-64bit matterbridge
$ kubectl delete po/$(kubectl get pods | grep Running | awk '{print $1}')
</syntaxhighlight>
</syntaxhighlight>



Revision as of 18:26, 3 January 2020

Toolforge tools
Crystal Clear app package utilities.png
Description A bot for bridging IRC and other chat platform channels
Keywords irc, golang
Maintainer(s) BryanDavis (View all)
Source code https://github.com/42wim/matterbridge
License Apache License 2.0
Admin log Tools.bridgebot/SAL

Bridgebot is a deployment of the FLOSS matterbridge software. It can be used to relay messages between multiple different chat systems. The current deployment in Toolforge is bridging various Wikimedia related Freenode IRC channels with similarly themed Telegram chats and channels.

Maintenance

The bot runs from Toolforge under the "bridgebot" account as a kubernetes pod.

---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: bridgebot.bot
  namespace: tool-bridgebot
  labels:
    name: bridgebot.bot
    toolforge: tool
spec:
  replicas: 1
  selector:
    matchLabels:
      name: bridgebot.bot
      toolforge: tool
  template:
    metadata:
      labels:
        name: bridgebot.bot
        toolforge: tool
    spec:
      containers:
        - name: bot
          image: docker-registry.tools.wmflabs.org/toolforge-buster-sssd:latest
          command:
            - "/data/project/bridgebot/matterbridge"
            - "-debug"
            - "-conf"
            - "/data/project/bridgebot/matterbridge.toml"
          workingDir: /data/project/bridgebot
          env:
            - name: HOME
              value: /data/project/bridgebot
          imagePullPolicy: Always
$ ssh dev.tools.wmflabs.org
$ become bridgebot

:# Deploying
$ kubectl create --validate=true -f deployment.yaml

:# Quick restart (pod delete)
$ kubectl delete po/$(kubectl get pods | grep Running | awk '{print $1}')

:# "Full" restart (Deployment delete; Deployment create)
$ kubectl delete deploy/bridgebot.bot
$ kubectl create --validate=true -f deployment.yaml

:# Upgrading the golang binary
$ wget https://github.com/42wim/matterbridge/releases/download/v{$version}/matterbridge-{$version}-linux-64bit
$ rm matterbridge
$ ln -s matterbridge-{$version}-linux-64bit matterbridge
$ kubectl delete po/$(kubectl get pods | grep Running | awk '{print $1}')

Joining a new channel

Maintainers of the tool can configure the bot to join a new channel;

$ ssh login.tools.wmflabs.org
$ become bridgebot
$ vim matterbridge.toml
:# Add a new "[[gateway]]" section defining the gateway name and the channels to bridge
$ kubectl delete po/$(kubectl get pods | grep Running | awk '{print $1}')