Comment Bot

Registrator Comment Bot

Here we'll discuss hosting an instance of Registrator's comment bot on a local system behind a subnet for use with a registry other than General.

Configuring the Machine

The relevant configuration settings here live in the [commentbot] section of run/config.commentbot.toml:

You can ensure that the host IP and port are configured properly by running the following on the host, substituting the appropriate values:

using HTTP
HTTP.listen(http_ip, http_port) do _
    println("I hear you!")
end

then entering the URL http://<http_ip>:<http_port> in a browser. If all goes well, the listener running on the server should print.

A Bot Account

Since access to private repositories is required to work with a private registry, it's recommended to set up a "bot" account with limited permission within the organization. Authenticating as a user with elevated permissions may pose a security risk. Note that this is true regardless of whether the registry is private, since GitHub personal access tokens do not currently provide sufficiently granular access permissions.

Once such an account is created, create a personal access token for it for authentication.

In run/config.commentbot.toml in the [commentbot.github] section, set the following:

In the [commentbot] section, set trigger to @<user>.

The GitHub App

A GitHub App is required to use the comment bot. In the organization settings, create a new GitHub App. Note that this App should be owned by the organization and not by the bot user in order to be installable without making it public.

Fill out the necessary fields in the app registration. For the webhook URL, use http://<http_ip>:<http_port>, where the values in brackets are what was entered into run/config.commentbot.toml when configuring the host machine. Enter a webhook secret and record the value you entered as secret in the [commentbot.github] section of run/config.commentbot.toml.

No organization or user permissions are required. For repository permissions, set at least:

Subscribe to commit and issue comments.

For private registries, ensure that the app is only installable on this account.