Make Discord bridge configuration playbook-managed

Well, `config.yaml` has been playbook-managed for a long time.
It's now extended to match the default sample config of the Discord
bridge.

With this patch, we also make `registration.yaml` playbook-managed,
which leads us to consistency with all other bridges.

Along with that, we introduce `./config` and `./data` separation,
like we do for the other bridges.
This commit is contained in:
Slavi Pantaleev 2019-06-26 10:30:51 +03:00
parent 782356d421
commit 8529efcd1c
9 changed files with 224 additions and 153 deletions

View File

@ -1,3 +1,23 @@
# 2019-06-26
## (BC Break) Discord bridge configuration is now entirely managed by the playbook
Until now, the `config.yaml` file for the [Discord bridge](docs/configuring-playbook-bridge-appservice-discord.md) was managed by the playbook, but the `registration.yaml` file was not.
From now on, the playbook will keep both configuration files sync for you.
This means that if you were making manual changes to the `/matrix/appservice-discord/discord-registration.yaml` configuration file, those would be lost the next time you run the playbook.
The bridge now stores configuration in a subdirectory (`/matrix/appservice-discord/config`).
Likewise, data is now also stored in a subdirectory (`/matrix/mautrix-whatsapp/data`). When you run the playbook with an existing database file (`/matrix/appservice-discord/discord.db`), the playbook will stop the bridge and relocate the database file to the `./data` directory. There's no data-loss involved. You'll need to restart the bridge manually though (`--tags=start`).
The main directory (`/matrix/appservice-discord`) may contain some leftover files (`user-store.db`, `room-store.db`, `config.yaml`, `discord-registration.yaml`, `invite_link`). These are no longer necessary and can be deleted manually.
We're now following the default sample configuration for the Discord bridge.
If you need to override some values, define them in `matrix_appservice_discord_configuration_extension_yaml`.
# 2019-06-24 # 2019-06-24
## (BC Break) WhatsApp bridge configuration is now entirely managed by the playbook ## (BC Break) WhatsApp bridge configuration is now entirely managed by the playbook
@ -15,6 +35,7 @@ Likewise, data is now also stored in a subdirectory (`/matrix/mautrix-whatsapp/d
We're now following the default configuration for the WhatsApp bridge. We're now following the default configuration for the WhatsApp bridge.
# 2019-06-20 # 2019-06-20
## (BC Break) IRC bridge configuration is now entirely managed by the playbook ## (BC Break) IRC bridge configuration is now entirely managed by the playbook

View File

@ -19,8 +19,8 @@ matrix_appservice_discord_bot_token: "YOUR DISCORD APP BOT TOKEN"
``` ```
4. If you've already installed Matrix services using the playbook before, you'll need to re-run it (`--tags=setup-all,start`). If not, proceed with [configuring other playbook services](configuring-playbook.md) and then with [Installing](installing.md). Get back to this guide once ready. 4. If you've already installed Matrix services using the playbook before, you'll need to re-run it (`--tags=setup-all,start`). If not, proceed with [configuring other playbook services](configuring-playbook.md) and then with [Installing](installing.md). Get back to this guide once ready.
5. Retrieve Discord invitelink from the `{{ matrix_appservice_discord_base_path }}/invite_link` file on the server (this defaults to `/matrix/appservice-discord/invite_link`) 5. Retrieve Discord invite link from the `{{ matrix_appservice_discord_config_path }}/invite_link` file on the server (this defaults to `/matrix/appservice-discord/config/invite_link`)
6. Invite the Bot to Discord servers you wish to bridge. Administrator permission is recommended. 6. Invite the Bot to Discord servers you wish to bridge. Administrator permission is recommended.
7. Join the rooms by following this syntax `#_discord_guildid_channelid` - can be easily retrieved by logging into Discord in a browser and opening the desired channel. URL will have this format: discordapp.com/channels/guild_id/channel_id 7. Join the rooms by following this syntax `#_discord_guildid_channelid` - can be easily retrieved by logging into Discord in a browser and opening the desired channel. URL will have this format: `discordapp.com/channels/guild_id/channel_id`
Other configuration options are available via the `matrix_appservice_discord_configuration_extension_yaml` variable. Other configuration options are available via the `matrix_appservice_discord_configuration_extension_yaml` variable.

View File

@ -39,6 +39,9 @@ matrix_appservice_discord_enabled: false
# matrix-appservice-discord's client-server port to the local host. # matrix-appservice-discord's client-server port to the local host.
matrix_appservice_discord_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:9005' }}" matrix_appservice_discord_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:9005' }}"
# If the homeserver disables presence, it's likely better (less wasteful) to also disable presence on the bridge side.
matrix_appservice_discord_bridge_disablePresence: "{{ matrix_synapse_use_presence }}"
matrix_appservice_discord_systemd_required_services_list: | matrix_appservice_discord_systemd_required_services_list: |
{{ {{
['docker.service'] ['docker.service']
@ -46,6 +49,10 @@ matrix_appservice_discord_systemd_required_services_list: |
(['matrix-synapse.service'] if matrix_synapse_enabled else []) (['matrix-synapse.service'] if matrix_synapse_enabled else [])
}} }}
matrix_appservice_discord_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'discord.as.token') | to_uuid }}"
matrix_appservice_discord_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'discord.hs.token') | to_uuid }}"
###################################################################### ######################################################################
# #
# /matrix-bridge-appservice-discord # /matrix-bridge-appservice-discord

View File

@ -7,11 +7,16 @@ matrix_appservice_discord_docker_image: "halfshot/matrix-appservice-discord:late
matrix_appservice_discord_docker_image_force_pull: "{{ matrix_appservice_discord_docker_image.endswith(':latest') }}" matrix_appservice_discord_docker_image_force_pull: "{{ matrix_appservice_discord_docker_image.endswith(':latest') }}"
matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord" matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord"
matrix_appservice_discord_config_path: "{{ matrix_base_data_path }}/appservice-discord/config"
matrix_appservice_discord_data_path: "{{ matrix_base_data_path }}/appservice-discord/data"
# Get your own keys at https://discordapp.com/developers/applications/me/create # Get your own keys at https://discordapp.com/developers/applications/me/create
matrix_appservice_discord_client_id: '' matrix_appservice_discord_client_id: ''
matrix_appservice_discord_bot_token: '' matrix_appservice_discord_bot_token: ''
matrix_appservice_discord_appservice_token: ''
matrix_appservice_discord_homeserver_token: ''
# Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9005 in the container). # Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9005 in the container).
# #
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9005"), or empty string to not expose. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9005"), or empty string to not expose.
@ -26,56 +31,50 @@ matrix_appservice_discord_systemd_required_services_list: ['docker.service']
# List of systemd services that matrix-appservice-discord.service wants # List of systemd services that matrix-appservice-discord.service wants
matrix_appservice_discord_systemd_wanted_services_list: [] matrix_appservice_discord_systemd_wanted_services_list: []
matrix_appservice_discord_configuration_yaml: | matrix_appservice_discord_appservice_url: 'http://matrix-appservice-discord:9005'
bridge:
domain: "{{ matrix_domain }}"
homeserverUrl: "{{ matrix_homeserver_url }}"
auth:
clientID: "{{matrix_appservice_discord_client_id}}"
botToken: "{{matrix_appservice_discord_bot_token}}"
database:
filename: "/data/discord.db"
userStorePath: "/data/user-store.db"
roomStorePath: "/data/room-store.db"
matrix_appservice_discord_configuration_extension_yaml: | matrix_appservice_discord_bridge_domain: "{{ matrix_domain }}"
# This is a sample of the config file showing all avaliable options. # As of right now, the homeserver URL must be a public URL. See below.
# Where possible we have documented what they do, and all values are the matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}"
# default values. matrix_appservice_discord_bridge_disablePresence: false
#
#bridge: matrix_appservice_discord_configuration_yaml: |
# # Domain part of the bridge, e.g. matrix.org #jinja2: lstrip_blocks: "True"
# domain: "localhost" bridge:
# # This should be your publically facing URL because Discord may use it to # Domain part of the bridge, e.g. matrix.org
# # fetch media from the media store. domain: {{ matrix_appservice_discord_bridge_domain }}
# homeserverUrl: "http://localhost:8008" # This should be your publically facing URL because Discord may use it to
# # Interval at which to process users in the 'presence queue'. If you have # fetch media from the media store.
# # 5 users, one user will be processed every 500 milliseconds according to the homeserverUrl: {{ matrix_appservice_discord_bridge_homeserverUrl }}
# # value below. This has a minimum value of 250. # Interval at which to process users in the 'presence queue'. If you have
# # WARNING: This has a high chance of spamming the homeserver with presence # 5 users, one user will be processed every 500 milliseconds according to the
# # updates since it will send one each time somebody changes state or is online. # value below. This has a minimum value of 250.
# presenceInterval: 500 # WARNING: This has a high chance of spamming the homeserver with presence
# # Disable setting presence for 'ghost users' which means Discord users on Matrix # updates since it will send one each time somebody changes state or is online.
# # will not be shown as away or online. presenceInterval: 500
# disablePresence: false # Disable setting presence for 'ghost users' which means Discord users on Matrix
# # Disable sending typing notifications when somebody on Discord types. # will not be shown as away or online.
# disableTypingNotifications: false disablePresence: {{ matrix_appservice_discord_bridge_disablePresence|to_json }}
# # Disable deleting messages on Discord if a message is redacted on Matrix. # Disable sending typing notifications when somebody on Discord types.
# disableDeletionForwarding: false disableTypingNotifications: false
# # Enable users to bridge rooms using !discord commands. See # Disable deleting messages on Discord if a message is redacted on Matrix.
# # https://t2bot.io/discord for instructions. disableDeletionForwarding: false
# enableSelfServiceBridging: false # Enable users to bridge rooms using !discord commands. See
# # Disable sending of read receipts for Matrix events which have been # https://t2bot.io/discord for instructions.
# # successfully bridged to Discord. enableSelfServiceBridging: false
# disableReadReceipts: false # Disable sending of read receipts for Matrix events which have been
# successfully bridged to Discord.
disableReadReceipts: false
# Disable Join Leave echos from matrix
disableJoinLeaveNotifications: false
# Authentication configuration for the discord bot. # Authentication configuration for the discord bot.
#auth: auth:
# clientID: "12345" clientID: {{ matrix_appservice_discord_client_id }}
# botToken: "foobar" botToken: {{ matrix_appservice_discord_bot_token }}
#logging: logging:
# # What level should the logger output to the console at. # What level should the logger output to the console at.
# console: "warn" #silly, verbose, info, http, warn, error, silent console: "warn" #silly, verbose, info, http, warn, error, silent
# lineDateFormat: "MMM-D HH:mm:ss.SSS" # This is in moment.js format lineDateFormat: "MMM-D HH:mm:ss.SSS" # This is in moment.js format
# files: # files:
# - file: "debug.log" # - file: "debug.log"
# disable: # disable:
@ -86,49 +85,81 @@ matrix_appservice_discord_configuration_extension_yaml: |
# level: "info" # level: "info"
# enable: # enable:
# - "DiscordBot" # - "DiscordBot"
#database: database:
# userStorePath: "user-store.db" # You may either use SQLite or Postgresql for the bridge database, which contains
# roomStorePath: "room-store.db" # important mappings for events and user puppeting configurations.
# # You may either use SQLite or Postgresql for the bridge database, which contains # Use the filename option for SQLite, or connString for Postgresql.
# # important mappings for events and user puppeting configurations. # If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite
# # Use the filename option for SQLite, or connString for Postgresql. # WARNING: You will almost certainly be fine with sqlite unless your bridge
# # If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite # is in heavy demand and you suffer from IO slowness.
# # WARNING: You will almost certainly be fine with sqlite unless your bridge filename: "/data/discord.db"
# # is in heavy demand and you suffer from IO slowness. # connString: "postgresql://user:password@localhost/database_name"
# filename: "discord.db" room:
# # connString: "postgresql://user:password@localhost/database_name" # Set the default visibility of alias rooms, defaults to "public".
#room: # One of: "public", "private"
# # Set the default visibility of alias rooms, defaults to "public". defaultVisibility: "public"
# # One of: "public", "private" channel:
# defaultVisibility: "public" # Pattern of the name given to bridged rooms.
#channel: # Can use :guild for the guild name and :name for the channel name.
# # Pattern of the name given to bridged rooms. namePattern: "[Discord] :guild :name"
# # Can use :guild for the guild name and :name for the channel name. # Changes made to rooms when a channel is deleted.
# namePattern: "[Discord] :guild :name" deleteOptions:
# # Changes made to rooms when a channel is deleted. # Prefix the room name with a string.
# deleteOptions: #namePrefix: "[Deleted]"
# # Prefix the room name with a string. # Prefix the room topic with a string.
# #namePrefix: "[Deleted]" #topicPrefix: "This room has been deleted"
# # Prefix the room topic with a string. # Disable people from talking in the room by raising the event PL to 50
# #topicPrefix: "This room has been deleted" disableMessaging: false
# # Disable people from talking in the room by raising the event PL to 50 # Remove the discord alias from the room.
# disableMessaging: false unsetRoomAlias: true
# # Remove the discord alias from the room. # Remove the room from the directory.
# unsetRoomAlias: true unlistFromDirectory: true
# # Remove the room from the directory. # Set the room to be unavaliable for joining without an invite.
# unlistFromDirectory: true setInviteOnly: true
# # Set the room to be unavaliable for joining without an invite. # Make all the discord users leave the room.
# setInviteOnly: true ghostsLeave: true
# # Make all the discord users leave the room. limits:
# ghostsLeave: true # Delay in milliseconds between discord users joining a room.
#limits: roomGhostJoinDelay: 6000
# # Delay in milliseconds between discord users joining a room. # Delay in milliseconds before sending messages to discord to avoid echos.
# roomGhostJoinDelay: 6000 # (Copies of a sent message may arrive from discord before we've
# # Delay in milliseconds before sending messages to discord to avoid echos. # fininished handling it, causing us to echo it back to the room)
# # (Copies of a sent message may arrive from discord before we've discordSendDelay: 750
# # fininished handling it, causing us to echo it back to the room) ghosts:
# discordSendDelay: 750 # Pattern for the ghosts nick, available is :nick, :username, :tag and :id
nickPattern: ":nick"
# Pattern for the ghosts username, available is :username, :tag and :id
usernamePattern: ":username#:tag"
matrix_appservice_discord_configuration_extension_yaml: |
# Your custom YAML configuration goes here.
# This configuration extends the default starting configuration (`matrix_appservice_discord_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_discord_configuration_yaml`.
matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml|from_yaml if matrix_appservice_discord_configuration_extension_yaml|from_yaml is mapping else {} }}" matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml|from_yaml if matrix_appservice_discord_configuration_extension_yaml|from_yaml is mapping else {} }}"
matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml|from_yaml|combine(matrix_appservice_discord_configuration_extension, recursive=True) }}" matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml|from_yaml|combine(matrix_appservice_discord_configuration_extension, recursive=True) }}"
matrix_appservice_discord_registration_yaml: |
#jinja2: lstrip_blocks: "True"
id: appservice-discord
as_token: "{{ matrix_appservice_discord_appservice_token }}"
hs_token: "{{ matrix_appservice_discord_homeserver_token }}"
namespaces:
users:
- exclusive: true
regex: '^@_discord_.*'
aliases:
- exclusive: true
regex: '^#_discord_.*'
url: {{ matrix_appservice_discord_appservice_url }}
sender_localpart: _discord_bot
rate_limited: false
protocols:
- discord
matrix_appservice_discord_registration: "{{ matrix_appservice_discord_registration_yaml|from_yaml }}"

View File

@ -1,3 +1,11 @@
# 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
fail:
msg: >-
The matrix-bridge-appservice-discord role needs to execute before the matrix-synapse role.
when: "matrix_appservice_discord_enabled and matrix_synapse_role_executed|default(False)"
- set_fact: - set_fact:
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord'] }}" matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord'] }}"
when: matrix_appservice_discord_enabled|bool when: matrix_appservice_discord_enabled|bool
@ -7,7 +15,7 @@
matrix_synapse_container_extra_arguments: > matrix_synapse_container_extra_arguments: >
{{ matrix_synapse_container_extra_arguments|default([]) }} {{ matrix_synapse_container_extra_arguments|default([]) }}
+ +
{{ ["--mount type=bind,src={{ matrix_appservice_discord_base_path }}/discord-registration.yaml,dst=/matrix-appservice-discord-registration.yaml,ro"] }} {{ ["--mount type=bind,src={{ matrix_appservice_discord_config_path }}/registration.yaml,dst=/matrix-appservice-discord-registration.yaml,ro"] }}
matrix_synapse_app_service_config_files: > matrix_synapse_app_service_config_files: >
{{ matrix_synapse_app_service_config_files|default([]) }} {{ matrix_synapse_app_service_config_files|default([]) }}

View File

@ -1,13 +1,5 @@
--- ---
# 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
fail:
msg: >-
The matrix-bridge-appservice-discord role needs to execute before the matrix-synapse role.
when: "matrix_synapse_role_executed|default(False)"
- name: Ensure Appservice Discord image is pulled - name: Ensure Appservice Discord image is pulled
docker_image: docker_image:
name: "{{ matrix_appservice_discord_docker_image }}" name: "{{ matrix_appservice_discord_docker_image }}"
@ -15,22 +7,66 @@
force_source: "{{ matrix_appservice_discord_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" force_source: "{{ matrix_appservice_discord_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_discord_docker_image_force_pull }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_discord_docker_image_force_pull }}"
- name: Ensure Appservice Discord base directory exists - name: Ensure AppService Discord paths exist
file: file:
path: "{{ matrix_appservice_discord_base_path }}" path: "{{ item }}"
state: directory state: directory
mode: 0750 mode: 0750
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}"
with_items:
- "{{ matrix_appservice_discord_base_path }}"
- "{{ matrix_appservice_discord_config_path }}"
- "{{ matrix_appservice_discord_data_path }}"
- name: Ensure Matrix Appservice Discord config installed - name: Check if an old database file already exists
stat:
path: "{{ matrix_appservice_discord_base_path }}/discord.db"
register: matrix_appservice_discord_stat_db
- name: (Data relocation) Ensure matrix-appservice-discord.service is stopped
service:
name: matrix-appservice-discord
state: stopped
daemon_reload: yes
failed_when: false
when: "matrix_appservice_discord_stat_db.stat.exists"
# In addition to this, there used to be some `user-store-db` and `room-store.db` files.
# They're no longer in use, so we're not relocating them in an effort to point them out as neither `./data`, nor `./config`.
- name: (Data relocation) Move AppService Discord discord.db file to ./data directory
command: "mv {{ matrix_appservice_discord_base_path }}/discord.db {{ matrix_appservice_discord_data_path }}/discord.db"
when: "matrix_appservice_discord_stat_db.stat.exists"
- name: Ensure AppService Discord config.yaml installed
copy: copy:
content: "{{ matrix_appservice_discord_configuration|to_nice_yaml }}" content: "{{ matrix_appservice_discord_configuration|to_nice_yaml }}"
dest: "{{ matrix_appservice_discord_base_path }}/config.yaml" dest: "{{ matrix_appservice_discord_config_path }}/config.yaml"
mode: 0644 mode: 0644
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}"
- name: Ensure AppService Discord registration.yaml installed
copy:
content: "{{ matrix_appservice_discord_registration|to_nice_yaml }}"
dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml"
mode: 0644
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
# If `matrix_appservice_discord_client_id` hasn't changed, the same invite link would be generated.
# We intentionally suppress Ansible changes.
- name: Generate AppService Discord invite link
shell: >-
/usr/bin/docker run --rm --name matrix-appservice-discord-link-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL
-v {{ matrix_appservice_discord_config_path }}:/cfg
-w /cfg
{{ matrix_appservice_discord_docker_image }}
/bin/sh -c "node /build/tools/addbot.js > /cfg/invite_link"
changed_when: false
- name: Ensure matrix-appservice-discord.service installed - name: Ensure matrix-appservice-discord.service installed
template: template:
src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2" src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2"
@ -42,39 +78,3 @@
service: service:
daemon_reload: yes daemon_reload: yes
when: "matrix_appservice_discord_systemd_service_result.changed" when: "matrix_appservice_discord_systemd_service_result.changed"
- name: Check if a matrix-appservice-discord registration file exists
stat:
path: "{{ matrix_appservice_discord_base_path }}/discord-registration.yaml"
register: appservice_discord_registration_file
- name: Generate matrix-appservice-discord discord-registration.yaml if it doesn't exist
shell: >-
/usr/bin/docker run --rm --name matrix-appservice-discord-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL
-v {{ matrix_appservice_discord_base_path }}:/data:z
{{ matrix_appservice_discord_docker_image }}
node build/src/discordas.js
-r
-u "http://matrix-appservice-discord:9005"
-c /data/config.yaml
-f /data/discord-registration.yaml
-l discord_bot
when: "not appservice_discord_registration_file.stat.exists"
- name: Check if a matrix-appservice-discord invite_link file exists
stat:
path: "{{ matrix_appservice_discord_base_path }}/invite_link"
register: appservice_discord_link_generated
- name: Generate your discord invite link
shell: >-
/usr/bin/docker run --rm --name matrix-appservice-discord-link-gen
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
--cap-drop=ALL
-v {{ matrix_appservice_discord_base_path }}:/data
-w /data
{{ matrix_appservice_discord_docker_image }}
/bin/sh -c "node .././build/tools/addbot.js > invite_link"
when: "not appservice_discord_link_generated.stat.exists"

View File

@ -8,6 +8,8 @@
with_items: with_items:
- "matrix_appservice_discord_client_id" - "matrix_appservice_discord_client_id"
- "matrix_appservice_discord_bot_token" - "matrix_appservice_discord_bot_token"
- "matrix_appservice_discord_appservice_token"
- "matrix_appservice_discord_homeserver_token"
- name: (Deprecation) Catch and report renamed appservice-discord variables - name: (Deprecation) Catch and report renamed appservice-discord variables
fail: fail:

View File

@ -25,11 +25,13 @@ ExecStart=/usr/bin/docker run --rm --name matrix-appservice-discord \
{% if matrix_appservice_discord_container_http_host_bind_port %} {% if matrix_appservice_discord_container_http_host_bind_port %}
-p {{ matrix_appservice_discord_container_http_host_bind_port }}:9005 \ -p {{ matrix_appservice_discord_container_http_host_bind_port }}:9005 \
{% endif %} {% endif %}
-v {{ matrix_appservice_discord_base_path }}:/data \ -v {{ matrix_appservice_discord_config_path }}:/cfg \
-v {{ matrix_appservice_discord_data_path }}:/data \
{% for arg in matrix_appservice_discord_container_extra_arguments %} {% for arg in matrix_appservice_discord_container_extra_arguments %}
{{ arg }} \ {{ arg }} \
{% endfor %} {% endfor %}
{{ matrix_appservice_discord_docker_image }} {{ matrix_appservice_discord_docker_image }} \
node /build/src/discordas.js -p 9005 -c /cfg/config.yaml -f /cfg/registration.yaml
ExecStop=-/usr/bin/docker kill matrix-appservice-discord ExecStop=-/usr/bin/docker kill matrix-appservice-discord
ExecStop=-/usr/bin/docker rm matrix-appservice-discord ExecStop=-/usr/bin/docker rm matrix-appservice-discord

View File

@ -36,7 +36,7 @@
command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem" command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem"
when: "matrix_appservice_irc_stat_passkey.stat.exists" when: "matrix_appservice_irc_stat_passkey.stat.exists"
- name: (Data relocation) Move AppService database files to ./data directory - name: (Data relocation) Move AppService IRC database files to ./data directory
command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}" command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}"
with_items: with_items:
- rooms.db - rooms.db