gerritbot/doc/source/installation.rst
Jeremy Stanley 6fc83f806f Feature: Keep alive interval of 60 by default
In situations where the Gerrit server dies suddenly (not a clean
process or system shutdown, but loss of networking or an underlying
hypervisor crash), the TCP socket for the stream-events feed can be
left indefinitely hung since the client has no reason to send new
messages and will never notice that there are no further messages
arriving from the server.

Gerritlib exposes a keep alive option for Gerrit stream-events
connections which can double as a sort of dead peer detection, but
it defaults to 0 (off). Set this to 60 seconds, while allowing it to
be configured to an arbitrary value in case this is unsuitable.

Change-Id: Ib92f1ee819f060dc52163735fe8d87d6d82ab788
2025-02-10 15:22:09 +00:00

1.6 KiB

Installation

To install Gerritbot run :

sudo python setup.py install

Configuration File

Gerritbot has two configuration files. The first configures the IRC server and Gerrit server details and is the config file whose path you pass to gerritbot when starting the bot. It should look like:

[ircbot]
nick=NICKNAME
pass=PASSWORD
use_sasl=False
server=irc.oftc.net
port=6697
server_password=SERVERPASS
channel_config=/path/to/yaml/config (See below)

[gerrit]
user=gerrit2
key=/path/to/id_rsa
host=review.example.com
port=29418
keep_alive=300  # (optional value in seconds, defaults to 60, 0 to disable)

The second, referenced by [ircbot]channel_config in the above, configures the IRC channels and the events and projects that each channel is interested in. This config file is written in yaml and should look like:

example-channel1:
    events:
      - patchset-created
      - change-merged
      - ^x-(crvw|vrif)-(plus|minus)-2$
    projects:
      - example/project1
      - example/project2
    branches:
      - master
      - development

example-channel2:
    events:
      - change-merged
    projects:
      - ^example/project[34]$
      - ^example/interesting-
    branches:
      - master
      - ^stable/(newton|ocata|pike)$

Denote regular expressions using the prefix ^.

Running

To run Gerritbot $PATH/gerritbot /path/to/config. $PATH is usually something like /usr/local/bin and /path/to/config should be whatever path you have hidden the config at.