Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: maint / admin /

irc-bot.mdwn

There is an IRC commit bot (the software is KGB), which reports commits made into Git repositories (currently the [[!rel4git wiki]] repo, i.e. this website) to IRC channels (currently #rel4tion). The bot’s nickname is rel4bot.

Intro

KGB has a server component which listens to requests and sends messages to IRC channels accordingly. There is also a client command, meant to be run from a Git hook, which contacts the server to send requests.

I’d prefer to try doing this in Haskell, because it’s a chance to learn more in Haskell and customize the bot, but after examining my options I decided to leave this for later (I have enough open projects). KGB comes as a package in Debian-based distros, so it’s quick and easy to set up.

I’ll hopefully do some hacking with Haskell IRC-related packages in the future.

Server

The KGB server daemon has a config file under /etc/. New IRC channels need to be added to it (or to other config files it includes). For example, this is for #rel4tion:

[[!format yaml """ repositories: wiki: password: verysecret channels: - name: ‘#rel4tion’ network: freenode repos: - wiki """]]

Client

In the gitolite conf file, specify notify-irc as a post-receive hook. For example:

repo    wiki
        RW+    =    fr33domlover
        RW     =    ikiwiki
        R      =    daemon
        config gitweb.description = "Research, design, development, documents"
        option hook.post-receive  = ping-ikiwiki notify-irc

The hook script looks like this (the GNOME sysadmin team wiki pages helped):

[[!format sh """ #!/bin/sh

send notification to IRC channel

REPOSITORY_ID=$(basename "$PWD") REPOSITORY_ID=${REPOSITORY_ID%.git}

kgb-client –conf /var/lib/gitolite3/kgb-client-${REPOSITORY_ID}.conf –repository git > /dev/null 2>&1 """]]

Create a client config file and place it under the gitolite user’s home directory. The name should as specified in the script above. For example, kgb-config-wiki.conf looks like this:

[[!format yaml """
repo-id: wiki
servers:
- uri: http://localhost:5391/
timeout: 5
password: verysecret
status-dir: /var/cache/kgb/client-status
web-link: http://git.rel4tion.org/?p=module.git; a = commitdiff; h={commit}
"""]]
[See repo JSON]