matrix-docker-ansible-deploy/docs/configuring-playbook-bridge-appservice-irc.md
Suguru Hirahara bad06d01c2
Update files for matrix-appservice-irc: adopt the common description for logging verbosity
Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
2025-01-30 01:19:25 +09:00

4.4 KiB

Setting up Appservice IRC bridging (optional)

Note: bridging to IRC can also happen via the Heisenbridge bridge supported by the playbook.

The playbook can install and configure the matrix-appservice-irc bridge for you.

See the project's documentation to learn what it does and why it might be useful to you.

Adjusting the playbook configuration

To enable the bridge, add the following configuration to your inventory/host_vars/matrix.example.com/vars.yml file:

matrix_appservice_irc_enabled: true

matrix_appservice_irc_ircService_servers:
  irc.example.com:
    name: "ExampleNet"
    port: 6697
    ssl: true
    sasl: false
    allowExpiredCerts: false
    sendConnectionMessages: true
    botConfig:
      enabled: true
      nick: "MatrixBot"
      joinChannelsIfNoUsers: true
    privateMessages:
      enabled: true
      federate: true
    dynamicChannels:
      enabled: true
      createAlias: true
      published: true
      joinRule: public
      groupId: +myircnetwork:localhost
      federate: true
      aliasTemplate: "#irc_$CHANNEL"
    membershipLists:
      enabled: false
      floodDelayMs: 10000
      global:
        ircToMatrix:
          initial: false
          incremental: false
        matrixToIrc:
          initial: false
          incremental: false
    matrixClients:
      userTemplate: "@irc_$NICK"
      displayName: "$NICK (IRC)"
      joinAttempts: -1
    ircClients:
      nickTemplate: "$DISPLAY[m]"
      allowNickChanges: true
      maxClients: 30
      idleTimeout: 10800
      reconnectIntervalMs: 5000
      concurrentReconnectLimit: 50
      lineLimit: 3

Extending the configuration

There are some additional things you may wish to configure about the bridge.

Take a look at:

  • roles/custom/matrix-bridge-appservice-irc/defaults/main.yml for some variables that you can customize via your vars.yml file
  • roles/custom/matrix-bridge-appservice-irc/templates/config.yaml.j2 for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the matrix_appservice_irc_configuration_extension_yaml variable

Installing

After configuring the playbook, run it with playbook tags as below:

ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,ensure-matrix-users-created,start

Notes:

  • The ensure-matrix-users-created playbook tag makes the playbook automatically create the bot's user account.

  • The shortcut commands with the just program are also available: just install-all or just setup-all

    just install-all is useful for maintaining your setup quickly (2x-5x faster than just setup-all) when its components remain unchanged. If you adjust your vars.yml to remove other components, you'd need to run just setup-all, or these components will still remain installed.

Usage

To use the bridge, you need to start a chat with @irc_bot:example.com (where example.com is your base domain, not the matrix. domain).

Troubleshooting

As with all other services, you can find the logs in systemd-journald by logging in to the server with SSH and running journalctl -fu matrix-appservice-irc.

Configuring for logging

The default logging level for this component is debug, and the log is output to the console only. If you want to change the verbosity or enable logging to a file, add the following configuration to your vars.yml file (adapt to your needs) and re-run the playbook:

matrix_appservice_irc_configuration_extension_yaml: |
  logging:
    # Level to log on console/logfile.
    # Valid values: error, warn, info, debug
    level: "debug"
    # The file location to log to. This is relative to the project directory.
    logfile: "debug.log"
    # The file location to log errors to. This is relative to the project directory.
    errfile: "errors.log"