Move roles/matrix* to roles/custom/matrix*
This paves the way for installing other roles into `roles/galaxy` using `ansible-galaxy`, similar to how it's done in: - https://github.com/spantaleev/gitea-docker-ansible-deploy - https://github.com/spantaleev/nextcloud-docker-ansible-deploy In the near future, we'll be removing a lot of the shared role code from here and using upstream roles for it. Some of the core `matrix-*` roles have already been extracted out into other reusable roles: - https://github.com/devture/com.devture.ansible.role.postgres - https://github.com/devture/com.devture.ansible.role.systemd_docker_base - https://github.com/devture/com.devture.ansible.role.timesync - https://github.com/devture/com.devture.ansible.role.vars_preserver - https://github.com/devture/com.devture.ansible.role.playbook_runtime_messages - https://github.com/devture/com.devture.ansible.role.playbook_help We just need to migrate to those.
This commit is contained in:
408
roles/custom/matrix-bridge-appservice-irc/defaults/main.yml
Normal file
408
roles/custom/matrix-bridge-appservice-irc/defaults/main.yml
Normal file
@ -0,0 +1,408 @@
|
||||
---
|
||||
# Matrix Appservice IRC is a Matrix <-> IRC bridge
|
||||
# Project source code URL: https://github.com/matrix-org/matrix-appservice-irc
|
||||
|
||||
matrix_appservice_irc_enabled: true
|
||||
|
||||
matrix_appservice_irc_container_image_self_build: false
|
||||
matrix_appservice_irc_docker_repo: "https://github.com/matrix-org/matrix-appservice-irc.git"
|
||||
matrix_appservice_irc_docker_repo_version: "{{ 'master' if matrix_appservice_irc_version == 'latest' else matrix_appservice_irc_version }}"
|
||||
matrix_appservice_irc_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-irc/docker-src"
|
||||
|
||||
# matrix_appservice_irc_version used to contain the full Docker image tag (e.g. `release-X.X.X`).
|
||||
# It's a bare version number now. We try to somewhat retain compatibility below.
|
||||
matrix_appservice_irc_version: 0.36.0
|
||||
matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_docker_image_tag }}"
|
||||
matrix_appservice_irc_docker_image_tag: "{{ 'latest' if matrix_appservice_irc_version == 'latest' else ('release-' + matrix_appservice_irc_version) }}"
|
||||
matrix_appservice_irc_docker_image_force_pull: "{{ matrix_appservice_irc_docker_image.endswith(':latest') }}"
|
||||
matrix_appservice_irc_docker_image_name_prefix: "{{ 'localhost/' if matrix_appservice_irc_container_image_self_build else matrix_container_global_registry_prefix }}"
|
||||
|
||||
matrix_appservice_irc_base_path: "{{ matrix_base_data_path }}/appservice-irc"
|
||||
matrix_appservice_irc_config_path: "{{ matrix_appservice_irc_base_path }}/config"
|
||||
matrix_appservice_irc_data_path: "{{ matrix_appservice_irc_base_path }}/data"
|
||||
|
||||
matrix_appservice_irc_homeserver_url: "{{ matrix_homeserver_container_url }}"
|
||||
matrix_appservice_irc_homeserver_media_url: 'https://{{ matrix_server_fqn_matrix }}'
|
||||
matrix_appservice_irc_homeserver_domain: '{{ matrix_domain }}'
|
||||
matrix_appservice_irc_homeserver_enablePresence: true # noqa var-naming
|
||||
matrix_appservice_irc_appservice_address: 'http://matrix-appservice-irc:9999'
|
||||
|
||||
matrix_appservice_irc_database_engine: nedb
|
||||
matrix_appservice_irc_database_username: matrix_appservice_irc
|
||||
matrix_appservice_irc_database_password: ~
|
||||
matrix_appservice_irc_database_hostname: 'matrix-postgres'
|
||||
matrix_appservice_irc_database_port: 5432
|
||||
matrix_appservice_irc_database_name: matrix_appservice_irc
|
||||
|
||||
# This is just the Postgres connection string, if Postgres is used.
|
||||
# Naming clashes with `matrix_appservice_irc_database_connectionString` somewhat.
|
||||
matrix_appservice_irc_database_connection_string: 'postgresql://{{ matrix_appservice_irc_database_username }}:{{ matrix_appservice_irc_database_password }}@{{ matrix_appservice_irc_database_hostname }}:{{ matrix_appservice_irc_database_port }}/{{ matrix_appservice_irc_database_name }}?sslmode=disable'
|
||||
|
||||
# This is what actually goes into `database.connectionString` for the bridge.
|
||||
matrix_appservice_irc_database_connectionString: |- # noqa var-naming
|
||||
{{
|
||||
{
|
||||
'nedb': 'nedb:///data',
|
||||
'postgres': matrix_appservice_irc_database_connection_string,
|
||||
}[matrix_appservice_irc_database_engine]
|
||||
}}
|
||||
|
||||
matrix_appservice_irc_ircService_servers: [] # noqa var-naming
|
||||
|
||||
# Example of `matrix_appservice_irc_ircService_servers` with one server (and all its options):
|
||||
#
|
||||
# matrix_appservice_irc_ircService_servers:
|
||||
# # The address of the server to connect to.
|
||||
# irc.example.com:
|
||||
# # A human-readable short name. This is used to label IRC status rooms
|
||||
# # where matrix users control their connections.
|
||||
# # E.g. 'ExampleNet IRC Bridge status'.
|
||||
# # It is also used in the Third Party Lookup API as the instance `desc`
|
||||
# # property, where each server is an instance.
|
||||
# name: "ExampleNet"
|
||||
|
||||
# additionalAddresses: [ "irc2.example.com" ]
|
||||
# #
|
||||
# # [DEPRECATED] Use `name`, above, instead.
|
||||
# # A human-readable description string
|
||||
# # description: "Example.com IRC network"
|
||||
|
||||
# # An ID for uniquely identifying this server amongst other servers being bridged.
|
||||
# # networkId: "example"
|
||||
|
||||
# # URL to an icon used as the network icon whenever this network appear in
|
||||
# # a network list. (Like in the riot room directory, for instance.)
|
||||
# # icon: https://example.com/images/hash.png
|
||||
|
||||
# # The port to connect to. Optional.
|
||||
# port: 6697
|
||||
# # Whether to use SSL or not. Default: false.
|
||||
# ssl: true
|
||||
# # Whether or not IRC server is using a self-signed cert or not providing CA Chain
|
||||
# sslselfsign: false
|
||||
# # Should the connection attempt to identify via SASL (if a server or user password is given)
|
||||
# # If false, this will use PASS instead. If SASL fails, we do not fallback to PASS.
|
||||
# sasl: false
|
||||
# # Whether to allow expired certs when connecting to the IRC server.
|
||||
# # Usually this should be off. Default: false.
|
||||
# allowExpiredCerts: false
|
||||
# # A specific CA to trust instead of the default CAs. Optional.
|
||||
# #ca: |
|
||||
# # -----BEGIN CERTIFICATE-----
|
||||
# # ...
|
||||
# # -----END CERTIFICATE-----
|
||||
|
||||
# #
|
||||
# # The connection password to send for all clients as a PASS (or SASL, if enabled above) command. Optional.
|
||||
# # password: 'pa$$w0rd'
|
||||
# #
|
||||
# # Whether or not to send connection/error notices to real Matrix users. Default: true.
|
||||
# sendConnectionMessages: true
|
||||
|
||||
# quitDebounce:
|
||||
# # Whether parts due to net-splits are debounced for delayMs, to allow
|
||||
# # time for the netsplit to resolve itself. A netsplit is detected as being
|
||||
# # a QUIT rate higher than quitsPerSecond. Default: false.
|
||||
# enabled: false
|
||||
# # The maximum number of quits per second acceptable above which a netsplit is
|
||||
# # considered ongoing. Default: 5.
|
||||
# quitsPerSecond: 5
|
||||
# # The time window in which to wait before bridging a QUIT to Matrix that occurred during
|
||||
# # a netsplit. Debouncing is jittered randomly between delayMinMs and delayMaxMs so that the HS
|
||||
# # is not sent many requests to leave rooms all at once if a netsplit occurs and many
|
||||
# # people to not rejoin.
|
||||
# # If the user with the same IRC nick as the one who sent the quit rejoins a channel
|
||||
# # they are considered back online and the quit is not bridged, so long as the rejoin
|
||||
# # occurs before the randomly-jittered timeout is not reached.
|
||||
# # Default: 3600000, = 1h
|
||||
# delayMinMs: 3600000 # 1h
|
||||
# # Default: 7200000, = 2h
|
||||
# delayMaxMs: 7200000 # 2h
|
||||
|
||||
# # A map for conversion of IRC user modes to Matrix power levels. This enables bridging
|
||||
# # of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
|
||||
# # been given multiple modes, the one that maps to the highest power level will be used.
|
||||
# modePowerMap:
|
||||
# o: 50
|
||||
|
||||
# botConfig:
|
||||
# # Enable the presence of the bot in IRC channels. The bot serves as the entity
|
||||
# # which maps from IRC -> Matrix. You can disable the bot entirely which
|
||||
# # means IRC -> Matrix chat will be shared by active "M-Nick" connections
|
||||
# # in the room. If there are no users in the room (or if there are users
|
||||
# # but their connections are not on IRC) then nothing will be bridged to
|
||||
# # Matrix. If you're concerned about the bot being treated as a "logger"
|
||||
# # entity, then you may want to disable the bot. If you want IRC->Matrix
|
||||
# # but don't want to have TCP connections to IRC unless a Matrix user speaks
|
||||
# # (because your client connection limit is low), then you may want to keep
|
||||
# # the bot enabled. Default: true.
|
||||
# # NB: If the bot is disabled, you SHOULD have matrix-to-IRC syncing turned
|
||||
# # on, else there will be no users and no bot in a channel (meaning no
|
||||
# # messages to Matrix!) until a Matrix user speaks which makes a client
|
||||
# # join the target IRC channel.
|
||||
# # NBB: The bridge bot IRC client will still join the target IRC network so
|
||||
# # it can service bridge-specific queries from the IRC-side e.g. so
|
||||
# # real IRC clients have a way to change their Matrix display name.
|
||||
# # See https://github.com/matrix-org/matrix-appservice-irc/issues/55
|
||||
# enabled: true
|
||||
# # The nickname to give the AS bot.
|
||||
# nick: "MatrixBot"
|
||||
# # The password to give to NickServ or IRC Server for this nick. Optional.
|
||||
# # password: "helloworld"
|
||||
# #
|
||||
# # Join channels even if there are no Matrix users on the other side of
|
||||
# # the bridge. Set to false to prevent the bot from joining channels which have no
|
||||
# # real matrix users in them, even if there is a mapping for the channel.
|
||||
# # Default: true
|
||||
# joinChannelsIfNoUsers: true
|
||||
|
||||
# # Configuration for PMs / private 1:1 communications between users.
|
||||
# privateMessages:
|
||||
# # Enable the ability for PMs to be sent to/from IRC/Matrix.
|
||||
# # Default: true.
|
||||
# enabled: true
|
||||
# # Prevent Matrix users from sending PMs to the following IRC nicks.
|
||||
# # Optional. Default: [].
|
||||
# # exclude: ["Alice", "Bob"] # NOT YET IMPLEMENTED
|
||||
|
||||
# # Should created Matrix PM rooms be federated? If false, only users on the
|
||||
# # HS attached to this AS will be able to interact with this room.
|
||||
# # Optional. Default: true.
|
||||
# federate: true
|
||||
|
||||
# # Configuration for mappings not explicitly listed in the 'mappings'
|
||||
# # section.
|
||||
# dynamicChannels:
|
||||
# # Enable the ability for Matrix users to join *any* channel on this IRC
|
||||
# # network.
|
||||
# # Default: false.
|
||||
# enabled: true
|
||||
# # Should the AS create a room alias for the new Matrix room? The form of
|
||||
# # the alias can be modified via 'aliasTemplate'. Default: true.
|
||||
# createAlias: true
|
||||
# # Should the AS publish the new Matrix room to the public room list so
|
||||
# # anyone can see it? Default: true.
|
||||
# published: true
|
||||
# # What should the join_rule be for the new Matrix room? If 'public',
|
||||
# # anyone can join the room. If 'invite', only users with an invite can
|
||||
# # join the room. Note that if an IRC channel has +k or +i set on it,
|
||||
# # join_rules will be set to 'invite' until these modes are removed.
|
||||
# # Default: "public".
|
||||
# joinRule: public
|
||||
# # This will set the m.room.related_groups state event in newly created rooms
|
||||
# # with the given groupId. This means flares will show up on IRC users in those rooms.
|
||||
# # This should be set to the same thing as namespaces.users.group_id in irc_registration.
|
||||
# # This does not alter existing rooms.
|
||||
# # Leaving this option empty will not set the event.
|
||||
# groupId: +myircnetwork:localhost
|
||||
# # Should created Matrix rooms be federated? If false, only users on the
|
||||
# # HS attached to this AS will be able to interact with this room.
|
||||
# # Default: true.
|
||||
# federate: true
|
||||
# # The room alias template to apply when creating new aliases. This only
|
||||
# # applies if createAlias is 'true'. The following variables are exposed:
|
||||
# # $SERVER => The IRC server address (e.g. "irc.example.com")
|
||||
# # $CHANNEL => The IRC channel (e.g. "#python")
|
||||
# # This MUST have $CHANNEL somewhere in it.
|
||||
# # Default: '#irc_$SERVER_$CHANNEL'
|
||||
# aliasTemplate: "#irc_$CHANNEL"
|
||||
# # A list of user IDs which the AS bot will send invites to in response
|
||||
# # to a !join. Only applies if joinRule is 'invite'. Default: []
|
||||
# # whitelist:
|
||||
# # - "@foo:example.com"
|
||||
# # - "@bar:example.com"
|
||||
# #
|
||||
# # Prevent the given list of channels from being mapped under any
|
||||
# # circumstances.
|
||||
# # exclude: ["#foo", "#bar"]
|
||||
|
||||
# # Configuration for controlling how Matrix and IRC membership lists are
|
||||
# # synced.
|
||||
# membershipLists:
|
||||
# # Enable the syncing of membership lists between IRC and Matrix. This
|
||||
# # can have a significant effect on performance on startup as the lists are
|
||||
# # synced. This must be enabled for anything else in this section to take
|
||||
# # effect. Default: false.
|
||||
# enabled: false
|
||||
|
||||
# # Syncing membership lists at startup can result in hundreds of members to
|
||||
# # process all at once. This timer drip feeds membership entries at the
|
||||
# # specified rate. Default: 10000. (10s)
|
||||
# floodDelayMs: 10000
|
||||
|
||||
# global:
|
||||
# ircToMatrix:
|
||||
# # Get a snapshot of all real IRC users on a channel (via NAMES) and
|
||||
# # join their virtual matrix clients to the room.
|
||||
# initial: false
|
||||
# # Make virtual matrix clients join and leave rooms as their real IRC
|
||||
# # counterparts join/part channels. Default: false.
|
||||
# incremental: false
|
||||
|
||||
# matrixToIrc:
|
||||
# # Get a snapshot of all real Matrix users in the room and join all of
|
||||
# # them to the mapped IRC channel on startup. Default: false.
|
||||
# initial: false
|
||||
# # Make virtual IRC clients join and leave channels as their real Matrix
|
||||
# # counterparts join/leave rooms. Make sure your 'maxClients' value is
|
||||
# # high enough! Default: false.
|
||||
# incremental: false
|
||||
|
||||
# # Apply specific rules to Matrix rooms. Only matrix-to-IRC takes effect.
|
||||
# rooms:
|
||||
# - room: "!fuasirouddJoxtwfge:localhost"
|
||||
# matrixToIrc:
|
||||
# initial: false
|
||||
# incremental: false
|
||||
|
||||
# # Apply specific rules to IRC channels. Only IRC-to-matrix takes effect.
|
||||
# channels:
|
||||
# - channel: "#foo"
|
||||
# ircToMatrix:
|
||||
# initial: false
|
||||
# incremental: false
|
||||
|
||||
# mappings:
|
||||
# # 1:many mappings from IRC channels to room IDs on this IRC server.
|
||||
# # The matrix room must already exist. Your matrix client should expose
|
||||
# # the room ID in a "settings" page for the room.
|
||||
# "#thepub":
|
||||
# roomIds: ["!kieouiJuedJoxtVdaG:localhost"]
|
||||
# # Channel key/password to use. Optional. If provided, matrix users do
|
||||
# # not need to know the channel key in order to join the channel.
|
||||
# # key: "secret"
|
||||
|
||||
# # Configuration for virtual matrix users. The following variables are
|
||||
# # exposed:
|
||||
# # $NICK => The IRC nick
|
||||
# # $SERVER => The IRC server address (e.g. "irc.example.com")
|
||||
# matrixClients:
|
||||
# # The user ID template to use when creating virtual matrix users. This
|
||||
# # MUST have $NICK somewhere in it.
|
||||
# # Optional. Default: "@$SERVER_$NICK".
|
||||
# # Example: "@irc.example.com_Alice:example.com"
|
||||
# userTemplate: "@irc_$NICK"
|
||||
# # The display name to use for created matrix clients. This should have
|
||||
# # $NICK somewhere in it if it is specified. Can also use $SERVER to
|
||||
# # insert the IRC domain.
|
||||
# # Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
|
||||
# displayName: "$NICK (IRC)"
|
||||
# # Number of tries a client can attempt to join a room before the request
|
||||
# # is discarded. You can also use -1 to never retry or 0 to never give up.
|
||||
# # Optional. Default: -1
|
||||
# joinAttempts: -1
|
||||
|
||||
# # Configuration for virtual IRC users. The following variables are exposed:
|
||||
# # $LOCALPART => The user ID localpart ("alice" in @alice:localhost)
|
||||
# # $USERID => The user ID
|
||||
# # $DISPLAY => The display name of this user, with excluded characters
|
||||
# # (e.g. space) removed. If the user has no display name, this
|
||||
# # falls back to $LOCALPART.
|
||||
# ircClients:
|
||||
# # The template to apply to every IRC client nick. This MUST have either
|
||||
# # $DISPLAY or $USERID or $LOCALPART somewhere in it.
|
||||
# # Optional. Default: "M-$DISPLAY". Example: "M-Alice".
|
||||
# nickTemplate: "$DISPLAY[m]"
|
||||
# # True to allow virtual IRC clients to change their nick on this server
|
||||
# # by issuing !nick <server> <nick> commands to the IRC AS bot.
|
||||
# # This is completely freeform: it will NOT follow the nickTemplate.
|
||||
# allowNickChanges: true
|
||||
# # The max number of IRC clients that will connect. If the limit is
|
||||
# # reached, the client that spoke the longest time ago will be
|
||||
# # disconnected and replaced.
|
||||
# # Optional. Default: 30.
|
||||
# maxClients: 30
|
||||
# # IPv6 configuration.
|
||||
# ipv6:
|
||||
# # Optional. Set to true to force IPv6 for outgoing connections.
|
||||
# only: false
|
||||
# # Optional. The IPv6 prefix to use for generating unique addresses for each
|
||||
# # connected user. If not specified, all users will connect from the same
|
||||
# # (default) address. This may require additional OS-specific work to allow
|
||||
# # for the node process to bind to multiple different source addresses
|
||||
# # e.g IP_FREEBIND on Linux, which requires an LD_PRELOAD with the library
|
||||
# # https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
|
||||
# # prefix: "2001:0db8:85a3::" # modify appropriately
|
||||
# #
|
||||
# # The maximum amount of time in seconds that the client can exist
|
||||
# # without sending another message before being disconnected. Use 0 to
|
||||
# # not apply an idle timeout. This value is ignored if this IRC server is
|
||||
# # mirroring matrix membership lists to IRC. Default: 172800 (48 hours)
|
||||
# idleTimeout: 10800
|
||||
# # The number of millseconds to wait between consecutive reconnections if a
|
||||
# # client gets disconnected. Setting to 0 will cause the scheduling to be
|
||||
# # disabled, i.e. it will be scheduled immediately (with jitter.
|
||||
# # Otherwise, the scheduling interval will be used such that one client
|
||||
# # reconnect for this server will be handled every reconnectIntervalMs ms using
|
||||
# # a FIFO queue.
|
||||
# # Default: 5000 (5 seconds)
|
||||
# reconnectIntervalMs: 5000
|
||||
# # The number of concurrent reconnects if a user has been disconnected unexpectedly
|
||||
# # (e.g. a netsplit). You should set this to a reasonably high number so that
|
||||
# # bridges are not waiting an eternity to reconnect all its clients if
|
||||
# # we see a massive number of disconnect. This is unrelated to the reconnectIntervalMs
|
||||
# # setting above which is for connecting on restart of the bridge. Set to 0 to
|
||||
# # immediately try to reconnect all users.
|
||||
# # Default: 50
|
||||
# concurrentReconnectLimit: 50
|
||||
# # The number of lines to allow being sent by the IRC client that has received
|
||||
# # a large block of text to send from matrix. If the number of lines that would
|
||||
# # be sent is > lineLimit, the text will instead be uploaded to matrix and the
|
||||
# # resulting URI is treated as a file. As such, a link will be sent to the IRC
|
||||
# # side instead of potentially spamming IRC and getting the IRC client kicked.
|
||||
# # Default: 3.
|
||||
# lineLimit: 3
|
||||
# # A list of user modes to set on every IRC client. For example, "RiG" would set
|
||||
# # +R, +i and +G on every IRC connection when they have successfully connected.
|
||||
# # User modes vary wildly depending on the IRC network you're connecting to,
|
||||
# # so check before setting this value. Some modes may not work as intended
|
||||
# # through the bridge e.g. caller ID as there is no way to /ACCEPT.
|
||||
# # Default: "" (no user modes)
|
||||
# # userModes: "R"
|
||||
|
||||
# Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9999 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9999"), or empty string to not expose.
|
||||
matrix_appservice_irc_container_http_host_bind_port: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_appservice_irc_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-appservice-irc.service depends on.
|
||||
matrix_appservice_irc_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-appservice-irc.service wants
|
||||
matrix_appservice_irc_systemd_wanted_services_list: []
|
||||
|
||||
matrix_appservice_irc_appservice_token: ''
|
||||
matrix_appservice_irc_homeserver_token: ''
|
||||
|
||||
matrix_appservice_irc_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
|
||||
|
||||
matrix_appservice_irc_configuration_extension_yaml: |
|
||||
# Your custom YAML configuration for Appservice IRC servers goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_appservice_irc_configuration_yaml`).
|
||||
#
|
||||
# You can override individual variables from the default configuration, or introduce new ones.
|
||||
#
|
||||
# If you need something more special, you can take full control by
|
||||
# completely redefining `matrix_appservice_irc_configuration_yaml`.
|
||||
|
||||
matrix_appservice_irc_configuration_extension: "{{ matrix_appservice_irc_configuration_extension_yaml | from_yaml if matrix_appservice_irc_configuration_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
matrix_appservice_irc_configuration: "{{ matrix_appservice_irc_configuration_yaml | from_yaml | combine(matrix_appservice_irc_configuration_extension, recursive=True) }}"
|
||||
|
||||
# The original registration.yaml file generated by AppService IRC is merged with this config override,
|
||||
# to produce the final registration.yaml file ultimately used by both the bridge and the homeserver.
|
||||
#
|
||||
# We do this to ensure consistency:
|
||||
# - always having an up-to-date registration.yaml file (synced with the configuration file)
|
||||
# - always having the same AS/HS token and appservice id in the registration.yaml file
|
||||
#
|
||||
# Learn more about this in `setup_install.yml`
|
||||
matrix_appservice_irc_registration_override_yaml: |
|
||||
id: appservice-irc
|
||||
as_token: "{{ matrix_appservice_irc_appservice_token }}"
|
||||
hs_token: "{{ matrix_appservice_irc_homeserver_token }}"
|
||||
|
||||
matrix_appservice_irc_registration_override: "{{ matrix_appservice_irc_registration_override_yaml | from_yaml }}"
|
36
roles/custom/matrix-bridge-appservice-irc/tasks/init.yml
Normal file
36
roles/custom/matrix-bridge-appservice-irc/tasks/init.yml
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
|
||||
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
|
||||
- name: Fail if trying to self-build on Ansible < 2.8
|
||||
ansible.builtin.fail:
|
||||
msg: "To self-build the matrix-appservice-irc image, you should use Ansible 2.8 or higher. See docs/ansible.md"
|
||||
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_appservice_irc_container_image_self_build and matrix_appservice_irc_enabled"
|
||||
|
||||
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
|
||||
# We don't want to fail in such cases.
|
||||
- name: Fail if matrix-synapse role already executed
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
The matrix-bridge-appservice-irc role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_appservice_irc_enabled | bool and matrix_synapse_role_executed | default(False)"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc.service'] }}"
|
||||
when: matrix_appservice_irc_enabled | bool
|
||||
|
||||
# If the matrix-synapse role is not used, these variables may not exist.
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_homeserver_container_runtime_injected_arguments: >
|
||||
{{
|
||||
matrix_homeserver_container_runtime_injected_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_appservice_irc_config_path }}/registration.yaml,dst=/matrix-appservice-irc-registration.yaml,ro"]
|
||||
}}
|
||||
|
||||
matrix_homeserver_app_service_runtime_injected_config_files: >
|
||||
{{
|
||||
matrix_homeserver_app_service_runtime_injected_config_files | default([])
|
||||
+
|
||||
["/matrix-appservice-irc-registration.yaml"]
|
||||
}}
|
||||
when: matrix_appservice_irc_enabled | bool
|
23
roles/custom/matrix-bridge-appservice-irc/tasks/main.yml
Normal file
23
roles/custom/matrix-bridge-appservice-irc/tasks/main.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_appservice_irc_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-appservice-irc
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup | bool and matrix_appservice_irc_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-appservice-irc
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup | bool and not matrix_appservice_irc_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-appservice-irc
|
@ -0,0 +1,76 @@
|
||||
---
|
||||
|
||||
- name: Fail if Postgres not enabled
|
||||
ansible.builtin.fail:
|
||||
msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate."
|
||||
when: "not matrix_postgres_enabled | bool"
|
||||
|
||||
# Defaults
|
||||
|
||||
- name: Set postgres_start_wait_time, if not provided
|
||||
ansible.builtin.set_fact:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time | default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
ansible.builtin.service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: true
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
ansible.builtin.wait_for:
|
||||
timeout: "{{ postgres_start_wait_time }}"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "matrix_postgres_service_start_result.changed | bool"
|
||||
|
||||
- name: Check existence of matrix-appservice-irc service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
|
||||
register: matrix_appservice_irc_service_stat
|
||||
|
||||
- name: Ensure matrix-appservice-irc is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
when: "matrix_appservice_irc_service_stat.stat.exists"
|
||||
|
||||
- name: Import appservice-irc NeDB database into Postgres
|
||||
ansible.builtin.command:
|
||||
cmd: >-
|
||||
{{ matrix_host_command_docker }} run
|
||||
--rm
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
--network={{ matrix_docker_network }}
|
||||
--mount type=bind,src={{ matrix_appservice_irc_data_path }},dst=/data
|
||||
--entrypoint=/bin/sh
|
||||
{{ matrix_appservice_irc_docker_image }}
|
||||
-c
|
||||
'/usr/local/bin/node /app/lib/scripts/migrate-db-to-pgres.js --dbdir /data --privateKey /data/passkey.pem --connectionString {{ matrix_appservice_irc_database_connection_string }}'
|
||||
register: matrix_appservice_irc_import_nedb_to_postgres_result
|
||||
changed_when: matrix_appservice_irc_import_nedb_to_postgres_result.rc == 0
|
||||
|
||||
- name: Archive NeDB database files
|
||||
ansible.builtin.command:
|
||||
cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
register: matrix_appservice_irc_import_nedb_to_postgres_move_result
|
||||
changed_when: matrix_appservice_irc_import_nedb_to_postgres_move_result.rc == 0
|
||||
|
||||
- name: Inject result
|
||||
ansible.builtin.set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results | default([])
|
||||
+
|
||||
[
|
||||
"NOTE: Your appservice-irc database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_irc_data_path }}/*.db` to `{{ matrix_appservice_irc_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files."
|
||||
]
|
||||
}}
|
@ -0,0 +1,209 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml"
|
||||
|
||||
- name: Ensure Appservice IRC paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_appservice_irc_base_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_irc_config_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_irc_data_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_irc_docker_src_files_path }}", when: "{{ matrix_appservice_irc_container_image_self_build }}"}
|
||||
when: item.when | bool
|
||||
|
||||
- name: Check if an old passkey file already exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_appservice_irc_base_path }}/passkey.pem"
|
||||
register: matrix_appservice_irc_stat_passkey
|
||||
|
||||
- when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
block:
|
||||
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
daemon_reload: true
|
||||
failed_when: false
|
||||
|
||||
- name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory
|
||||
ansible.builtin.command:
|
||||
cmd: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem"
|
||||
register: matrix_appservice_irc_move_passkey_result
|
||||
changed_when: matrix_appservice_irc_move_passkey_result.rc == 0
|
||||
|
||||
- name: (Data relocation) Move AppService IRC database files to ./data directory
|
||||
ansible.builtin.command:
|
||||
cmd: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}"
|
||||
register: matrix_appservice_irc_move_dbs_result
|
||||
changed_when: matrix_appservice_irc_move_dbs_result.rc == 0
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
failed_when: false
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_appservice_irc_requires_restart: false
|
||||
|
||||
- when: "matrix_appservice_irc_database_engine == 'postgres'"
|
||||
block:
|
||||
- name: Check if a nedb database already exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_appservice_irc_data_path }}/users.db"
|
||||
register: matrix_appservice_irc_nedb_database_path_local_stat_result
|
||||
|
||||
- when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists | bool"
|
||||
block:
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_appservice_irc_requires_restart: true
|
||||
|
||||
- name: Ensure Appservice IRC image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_appservice_irc_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_irc_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_irc_docker_image_force_pull }}"
|
||||
when: "matrix_appservice_irc_enabled | bool and not matrix_appservice_irc_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- name: Ensure matrix-appservice-irc repository is present when self-building
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_appservice_irc_docker_repo }}"
|
||||
version: "{{ matrix_appservice_irc_docker_repo_version }}"
|
||||
dest: "{{ matrix_appservice_irc_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_appservice_irc_git_pull_results
|
||||
when: "matrix_appservice_irc_enabled | bool and matrix_appservice_irc_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure matrix-appservice-irc Docker image is built
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_appservice_irc_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_appservice_irc_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_irc_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_appservice_irc_docker_src_files_path }}"
|
||||
pull: true
|
||||
when: "matrix_appservice_irc_enabled | bool and matrix_appservice_irc_container_image_self_build | bool and matrix_appservice_irc_git_pull_results.changed"
|
||||
|
||||
- name: Ensure Matrix Appservice IRC config installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_appservice_irc_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_appservice_irc_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Check if Appservice IRC passkey exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_appservice_irc_data_path }}/passkey.pem"
|
||||
register: irc_passkey_file
|
||||
|
||||
- name: Generate Appservice IRC passkey if it doesn't exist
|
||||
ansible.builtin.shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_appservice_irc_data_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
when: "not irc_passkey_file.stat.exists"
|
||||
|
||||
# In the past, we used to generate the passkey.pem file with root, so permissions may not be okay.
|
||||
# Fix it.
|
||||
- name: (Migration) Ensure Appservice IRC passkey permissions are okay
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_appservice_irc_data_path }}/passkey.pem"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
# Ideally, we'd like to generate the final registration.yaml file by ourselves.
|
||||
#
|
||||
# However, the IRC bridge supports multiple servers, which leads to multiple
|
||||
# users/aliases/rooms rules in the registration file.
|
||||
#
|
||||
# Generating a proper file by ourselves is complicated and may lead to deviation
|
||||
# from what the bridge is doing.
|
||||
#
|
||||
# Instead, we do another hacky thing - asking the bridge to generate a template,
|
||||
# and then we parse it and fix it up with our own AS/HS token.
|
||||
# We need to do this, because:
|
||||
# - we'd like to have an up-to-date registration file
|
||||
# - we can achieve this by asking the bridge to rebuild it each time
|
||||
# - however, the bridge insists on regenerating all tokens each time
|
||||
# - .. which is not friendly for integrating with the homeserver
|
||||
#
|
||||
# So we have a hybrid approach. We ask the bridge to always generate
|
||||
# an up-to-date file, and we fix it up with some static values later on,
|
||||
# to produce a final registration.yaml file, as we desire.
|
||||
- name: Generate Appservice IRC registration-template.yaml
|
||||
ansible.builtin.shell: >-
|
||||
{{ matrix_host_command_docker }} run --rm --name matrix-appservice-irc-gen
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
||||
--cap-drop=ALL
|
||||
-v {{ matrix_appservice_irc_config_path }}:/config:z
|
||||
-v {{ matrix_appservice_irc_data_path }}:/data:z
|
||||
--entrypoint=/bin/bash
|
||||
{{ matrix_appservice_irc_docker_image }}
|
||||
-c
|
||||
'node app.js
|
||||
-r
|
||||
-f /config/registration-template.yaml
|
||||
-u "http://matrix-appservice-irc:9999"
|
||||
-c /config/config.yaml
|
||||
-l irc_bot'
|
||||
changed_when: false
|
||||
|
||||
- name: Read Appservice IRC registration-template.yaml
|
||||
ansible.builtin.slurp:
|
||||
src: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml"
|
||||
register: matrix_appservice_irc_registration_template_slurp
|
||||
|
||||
- name: Remove unnecessary Appservice IRC registration-template.yaml
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml"
|
||||
state: absent
|
||||
changed_when: false
|
||||
|
||||
- name: Parse registration-template.yaml
|
||||
ansible.builtin.set_fact:
|
||||
matrix_appservice_irc_registration_template: "{{ matrix_appservice_irc_registration_template_slurp['content'] | b64decode | from_yaml }}"
|
||||
|
||||
- name: Combine registration-template.yaml and own registration override config
|
||||
ansible.builtin.set_fact:
|
||||
matrix_appservice_irc_registration: "{{ matrix_appservice_irc_registration_template | combine(matrix_appservice_irc_registration_override, recursive=True) }}"
|
||||
|
||||
- name: Ensure Appservice IRC registration.yaml installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_appservice_irc_registration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_appservice_irc_config_path }}/registration.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-appservice-irc.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
|
||||
mode: 0644
|
||||
register: matrix_appservice_irc_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-appservice-irc.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_appservice_irc_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-irc.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-appservice-irc.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_irc_requires_restart | bool"
|
@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-appservice-irc service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
|
||||
register: matrix_appservice_irc_service_stat
|
||||
|
||||
- name: Ensure matrix-appservice-irc is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
when: "matrix_appservice_irc_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-appservice-irc.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service"
|
||||
state: absent
|
||||
when: "matrix_appservice_irc_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-appservice-irc.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_appservice_irc_service_stat.stat.exists"
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Fail if required settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_appservice_irc_appservice_token"
|
||||
- "matrix_appservice_irc_homeserver_token"
|
||||
|
||||
# Our base configuration (`matrix_appservice_irc_configuration_yaml`) is not enough to
|
||||
# let the playbook run without errors.
|
||||
#
|
||||
# Unless the final configuration (`matrix_appservice_irc_configuration`) contains an `ircService` definition,
|
||||
# we'd fail generating the registration.yaml file with a non-helpful error.
|
||||
#
|
||||
# This is a safety check to ensure we fail earlier and in a nicer way.
|
||||
- name: Fail if no additional configuration provided
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Your Appservice IRC configuration is incomplete (lacking an `ircService.servers` configuration).
|
||||
You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers`
|
||||
or by extending the base configuration with additional configuration in `matrix_appservice_irc_configuration_extension_yaml`.
|
||||
Overriding the whole bridge's configuration (`matrix_appservice_irc_configuration`) is yet another possibility.
|
||||
when: "matrix_appservice_irc_configuration.ircService.servers | length == 0"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed appservice-irc variables
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Your configuration contains a variable, which now has a different name.
|
||||
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
|
||||
when: "item.old in vars"
|
||||
with_items:
|
||||
- {'old': 'matrix_appservice_irc_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_irc_container_http_host_bind_port>'}
|
||||
- {'old': 'matrix_appservice_irc_container_self_build', 'new': 'matrix_appservice_irc_container_image_self_build'}
|
@ -0,0 +1,134 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
homeserver:
|
||||
# The URL to the home server for client-server API calls, also used to form the
|
||||
# media URLs as displayed in bridged IRC channels:
|
||||
url: {{ matrix_appservice_irc_homeserver_url }}
|
||||
#
|
||||
# The URL of the homeserver hosting media files. This is only used to transform
|
||||
# mxc URIs to http URIs when bridging m.room.[file|image] events. Optional. By
|
||||
# default, this is the homeserver URL, specified above.
|
||||
#
|
||||
media_url: {{ matrix_appservice_irc_homeserver_media_url }}
|
||||
|
||||
# Drop Matrix messages which are older than this number of seconds, according to
|
||||
# the event's origin_server_ts.
|
||||
# If the bridge is down for a while, the homeserver will attempt to send all missed
|
||||
# events on reconnection. These events may be hours old, which can be confusing to
|
||||
# IRC users if they are then bridged. This option allows these old messages to be
|
||||
# dropped.
|
||||
# CAUTION: This is a very coarse heuristic. Federated homeservers may have different
|
||||
# clock times and hence produce different origin_server_ts values, which may be old
|
||||
# enough to cause *all* events from the homeserver to be dropped.
|
||||
# Default: 0 (don't ever drop)
|
||||
# dropMatrixMessagesAfterSecs: 300 # 5 minutes
|
||||
|
||||
# The 'domain' part for user IDs on this home server. Usually (but not always)
|
||||
# is the "domain name" part of the HS URL.
|
||||
domain: {{ matrix_appservice_irc_homeserver_domain }}
|
||||
|
||||
# Should presence be enabled for matrix clients on this bridge. If disabled on the
|
||||
# homeserver then it should also be disabled here to avoid excess traffic.
|
||||
# Default: true
|
||||
enablePresence: {{ matrix_appservice_irc_homeserver_enablePresence|to_json }}
|
||||
|
||||
ircService:
|
||||
# WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
|
||||
# send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
|
||||
# the database.
|
||||
#
|
||||
# To generate a .pem file:
|
||||
# $ openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
||||
#
|
||||
# The path to the RSA PEM-formatted private key to use when encrypting IRC passwords
|
||||
# for storage in the database. Passwords are stored by using the admin room command
|
||||
# `!storepass server.name passw0rd. When a connection is made to IRC on behalf of
|
||||
# the Matrix user, this password will be sent as the server password (PASS command).
|
||||
passwordEncryptionKeyPath: "/data/passkey.pem" # does not typically need modification
|
||||
|
||||
# Config for Matrix -> IRC bridging
|
||||
matrixHandler:
|
||||
# Cache this many matrix events in memory to be used for m.relates_to messages (usually replies).
|
||||
eventCacheSize: 4096
|
||||
|
||||
servers: {{ matrix_appservice_irc_ircService_servers|to_json }}
|
||||
|
||||
# Configuration for an ident server. If you are running a public bridge it is
|
||||
# advised you setup an ident server so IRC mods can ban specific matrix users
|
||||
# rather than the application service itself.
|
||||
ident:
|
||||
# True to listen for Ident requests and respond with the
|
||||
# matrix user's user_id (converted to ASCII, respecting RFC 1413).
|
||||
# Default: false.
|
||||
enabled: false
|
||||
# The port to listen on for incoming ident requests.
|
||||
# Ports below 1024 require root to listen on, and you may not want this to
|
||||
# run as root. Instead, you can get something like an Apache to yank up
|
||||
# incoming requests to 113 to a high numbered port. Set the port to listen
|
||||
# on instead of 113 here.
|
||||
# Default: 113.
|
||||
port: 1113
|
||||
# The address to listen on for incoming ident requests.
|
||||
# Default: 0.0.0.0
|
||||
address: "::"
|
||||
|
||||
# Configuration for logging. Optional. Default: console debug level logging
|
||||
# only.
|
||||
logging:
|
||||
# Level to log on console/logfile. One of 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"
|
||||
# Whether to log to the console or not.
|
||||
toConsole: true
|
||||
# The max number of files to keep. Files will be overwritten eventually due
|
||||
# to rotations.
|
||||
maxFiles: 5
|
||||
|
||||
# Optional. Enable Prometheus metrics. If this is enabled, you MUST install `prom-client`:
|
||||
# $ npm install prom-client@6.3.0
|
||||
# Metrics will then be available via GET /metrics on the bridge listening port (-p).
|
||||
metrics:
|
||||
# Whether to actually enable the metric endpoint. Default: false
|
||||
enabled: true
|
||||
# When collecting remote user active times, which "buckets" should be used. Defaults are given below.
|
||||
# The bucket name is formed of a duration and a period. (h=hours,d=days,w=weeks).
|
||||
remoteUserAgeBuckets:
|
||||
- "1h"
|
||||
- "1d"
|
||||
- "1w"
|
||||
|
||||
# Configuration for the provisioning API.
|
||||
#
|
||||
# GET /_matrix/provision/link
|
||||
# GET /_matrix/provision/unlink
|
||||
# GET /_matrix/provision/listlinks
|
||||
#
|
||||
provisioning:
|
||||
# True to enable the provisioning HTTP endpoint. Default: false.
|
||||
enabled: false
|
||||
# The number of seconds to wait before giving up on getting a response from
|
||||
# an IRC channel operator. If the channel operator does not respond within the
|
||||
# allotted time period, the provisioning request will fail.
|
||||
# Default: 300 seconds (5 mins)
|
||||
requestTimeoutSeconds: 300
|
||||
|
||||
# Options here are generally only applicable to large-scale bridges and may have
|
||||
# consequences greater than other options in this configuration file.
|
||||
advanced:
|
||||
# The maximum number of HTTP(S) sockets to maintain. Usually this is unlimited
|
||||
# however for large bridges it is important to rate limit the bridge to avoid
|
||||
# accidentally overloading the homeserver. Defaults to 1000, which should be
|
||||
# enough for the vast majority of use cases.
|
||||
maxHttpSockets: 1000
|
||||
|
||||
# Use an external database to store bridge state.
|
||||
database:
|
||||
# database engine (must be 'postgres' or 'nedb'). Default: nedb
|
||||
engine: {{ matrix_appservice_irc_database_engine|to_json }}
|
||||
# Either a PostgreSQL connection string, or a path to the NeDB storage directory.
|
||||
# For postgres, it must start with postgres://
|
||||
# For NeDB, it must start with nedb://. The path is relative to the project directory.
|
||||
connectionString: {{ matrix_appservice_irc_database_connectionString|to_json }}
|
@ -0,0 +1,46 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Appservice IRC bridge
|
||||
{% for service in matrix_appservice_irc_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_appservice_irc_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-appservice-irc 2>/dev/null || true'
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-appservice-irc 2>/dev/null || true'
|
||||
|
||||
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
|
||||
ExecStartPre={{ matrix_host_command_sleep }} 5
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-appservice-irc \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_appservice_irc_container_http_host_bind_port %}
|
||||
-p {{ matrix_appservice_irc_container_http_host_bind_port }}:9999 \
|
||||
{% endif %}
|
||||
-v {{ matrix_appservice_irc_config_path }}:/config:z \
|
||||
-v {{ matrix_appservice_irc_data_path }}:/data:z \
|
||||
{% for arg in matrix_appservice_irc_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
--entrypoint=/bin/bash \
|
||||
{{ matrix_appservice_irc_docker_image }} \
|
||||
-c 'node app.js -c /config/config.yaml -f /config/registration.yaml -p 9999'
|
||||
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-appservice-irc 2>/dev/null || true'
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-appservice-irc 2>/dev/null || true'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-appservice-irc
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user