Move mautrix telegram and whatsapp into separate roles
The goal is to move each bridge into its own separate role. This commit starts off the work on this with 2 bridges: - mautrix-telegram - mautrix-whatsapp Each bridge's role (including these 2) is meant to: - depend only on the matrix-base role - integrate nicely with the matrix-synapse role (if available) - integrate nicely with the matrix-nginx-proxy role (if available and if required). mautrix-telegram bridge benefits from integrating with it. - not break if matrix-synapse or matrix-nginx-proxy are not used at all This has been provoked by #174 (Github Issue).
This commit is contained in:
@ -0,0 +1,87 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
# Homeserver details.
|
||||
homeserver:
|
||||
# The address that this appservice can use to connect to the homeserver.
|
||||
address: {{ matrix_mautrix_whatsapp_homeserver_address }}
|
||||
# The domain of the homeserver (for MXIDs, etc).
|
||||
domain: {{ matrix_mautrix_whatsapp_homeserver_domain }}
|
||||
|
||||
# Application service host/registration related details.
|
||||
# Changing these values requires regeneration of the registration.
|
||||
appservice:
|
||||
# The address that the homeserver can use to connect to this appservice.
|
||||
address: {{ matrix_mautrix_whatsapp_appservice_address }}
|
||||
|
||||
# The hostname and port where this appservice should listen.
|
||||
hostname: 0.0.0.0
|
||||
port: 8080
|
||||
|
||||
# Database config.
|
||||
database:
|
||||
# The database type. Only "sqlite3" is supported.
|
||||
type: sqlite3
|
||||
# The database URI. Usually file name. https://github.com/mattn/go-sqlite3#connection-string
|
||||
uri: mautrix-whatsapp.db
|
||||
# Path to the Matrix room state store.
|
||||
state_store_path: ./mx-state.json
|
||||
|
||||
# The unique ID of this appservice.
|
||||
id: whatsapp
|
||||
# Appservice bot details.
|
||||
bot:
|
||||
# Username of the appservice bot.
|
||||
username: whatsappbot
|
||||
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
|
||||
# to leave display name/avatar as-is.
|
||||
displayname: WhatsApp bridge bot
|
||||
avatar: remove
|
||||
|
||||
# Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
|
||||
as_token: "This value is generated when generating the registration"
|
||||
hs_token: "This value is generated when generating the registration"
|
||||
|
||||
# Bridge config. Currently unused.
|
||||
bridge:
|
||||
# {% raw %}
|
||||
# protecting the go templates inside the raw section.
|
||||
# Localpart template of MXIDs for WhatsApp users.
|
||||
# {{.}} is replaced with the phone number of the WhatsApp user.
|
||||
username_template: whatsapp_{{.}}
|
||||
# Displayname template for WhatsApp users.
|
||||
# {{.Notify}} - nickname set by the WhatsApp user
|
||||
# {{.Jid}} - phone number (international format)
|
||||
# The following variables are also available, but will cause problems on multi-user instances:
|
||||
# {{.Name}} - display name from contact list
|
||||
# {{.Short}} - short display name from contact list
|
||||
displayname_template: "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WA)"
|
||||
# {% endraw %}
|
||||
|
||||
# The prefix for commands. Only required in non-management rooms.
|
||||
command_prefix: "!wa"
|
||||
|
||||
# Permissions for using the bridge.
|
||||
# Permitted values:
|
||||
# user - Access to use the bridge to chat with a WhatsApp account.
|
||||
# admin - User level and some additional administration tools
|
||||
# Permitted keys:
|
||||
# * - All Matrix users
|
||||
# domain - All users on that homeserver
|
||||
# mxid - Specific user
|
||||
permissions:
|
||||
'{{ matrix_mautrix_whatsapp_homeserver_domain }}': user
|
||||
|
||||
# Logging config.
|
||||
logging:
|
||||
# The directory for log files. Will be created if not found.
|
||||
directory: ./logs
|
||||
# Available variables: .Date for the file date and .Index for different log files on the same day.
|
||||
file_name_format: {% raw %}"{{.Date}}-{{.Index}}.log"{% endraw %}
|
||||
# Date format for file names in the Go time format: https://golang.org/pkg/time/#pkg-constants
|
||||
file_date_format: 2006-01-02
|
||||
# Log file permissions.
|
||||
file_mode: 0600
|
||||
# Timestamp format for log entries in the Go time format.
|
||||
timestamp_format: Jan _2, 2006 15:04:05
|
||||
# Minimum severity for log messages.
|
||||
# Options: debug, info, warn, error, fatal
|
||||
print_level: debug
|
@ -0,0 +1,36 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Mautrix Whatsapp server
|
||||
{% for service in matrix_mautrix_whatsapp_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_mautrix_whatsapp_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-/usr/bin/docker kill matrix-mautrix-whatsapp
|
||||
ExecStartPre=-/usr/bin/docker rm matrix-mautrix-whatsapp
|
||||
|
||||
ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-whatsapp \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_mautrix_whatsapp_base_path }}:/data:z \
|
||||
--workdir=/data \
|
||||
{% for arg in matrix_mautrix_whatsapp_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_mautrix_whatsapp_docker_image }} \
|
||||
/usr/bin/mautrix-whatsapp
|
||||
|
||||
ExecStop=-/usr/bin/docker kill matrix-mautrix-whatsapp
|
||||
ExecStop=-/usr/bin/docker rm matrix-mautrix-whatsapp
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user