mirror of
https://github.com/status-im/infra-role-matterbridge.git
synced 2025-02-18 17:56:36 +00:00
use generic api and add consul service check
Signed-off-by: Arthur Koziel <arthur@arthurkoziel.com>
This commit is contained in:
parent
f0a1446830
commit
10f34e0c67
14
README.md
14
README.md
@ -30,6 +30,20 @@ matterbridge_gateways:
|
||||
- { status: "movies", discord: [{ srv: "status-pub", ch: "movies" }] }
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
To use the Matterbridge API it must be enabled with `matterbridge_api_enabled: true`.
|
||||
Currently only a single API (called `api`) is supported.
|
||||
|
||||
It can be used in a gateway like this:
|
||||
|
||||
```
|
||||
- { discord: [{ srv: "vac", ch: "waku" }], api: ["api"]}
|
||||
```
|
||||
|
||||
The API is running on port 4242 by default (`matterbridge_api_port`). More info
|
||||
about the API can be found on the [Matterbridge wiki](https://github.com/42wim/matterbridge/wiki/Api).
|
||||
|
||||
# Known Issues
|
||||
|
||||
If your bridge is posting in a Discord channel but doesn't receive mesages from it you might have to adjust the channel-level permissions to give the bot message read rights.
|
||||
|
@ -7,6 +7,10 @@ matterbridge_debug: false
|
||||
matterbridge_nick: bridge
|
||||
matterbridge_ens_name: bridge.stateofus.eth
|
||||
|
||||
# configuration for API
|
||||
matterbridge_api_enabled: false
|
||||
matterbridge_api_port: 4242
|
||||
|
||||
# configuration for gateways
|
||||
matterbridge_gateways: []
|
||||
|
||||
|
@ -11,3 +11,17 @@
|
||||
name: 'MatterBridge health'
|
||||
type: 'script'
|
||||
script: '/usr/bin/pgrep -xl matterbridge'
|
||||
|
||||
- name: Create Consul service definition for API
|
||||
include_role: name=consul-service
|
||||
when: '{{ matterbridge_api_enabled }}'
|
||||
vars:
|
||||
consul_config_name: '{{ matterbridge_cont_name }}-api'
|
||||
consul_services:
|
||||
- name: '{{ matterbridge_cont_name }}-api'
|
||||
tags: ['matterbridge', 'bridge']
|
||||
checks:
|
||||
- id: '{{ matterbridge_cont_name }}-api-health'
|
||||
name: 'MatterBridge API health'
|
||||
type: 'script'
|
||||
script: 'curl --fail http://localhost:{{ matterbridge_api_port }}/api/health'
|
||||
|
@ -10,6 +10,9 @@
|
||||
restart: '{{ config_file.changed or cont_restart }}'
|
||||
volumes:
|
||||
- '{{ matterbridge_cont_vol }}/matterbridge.yaml:/matterbridge.yaml'
|
||||
ports: '{{ [lookup("vars", "docker_api_port")] if lookup("vars", "matterbridge_api_enabled") else [] }}'
|
||||
command: |
|
||||
-conf=/matterbridge.yaml
|
||||
{% if matterbridge_debug %}-debug{% endif %}
|
||||
vars:
|
||||
docker_api_port: '{{ matterbridge_api_port }}:{{ matterbridge_api_port }}'
|
||||
|
@ -12,6 +12,13 @@ general:
|
||||
{{ matterbridge_bridges | to_nice_yaml }}
|
||||
{% endif %}
|
||||
|
||||
{% if matterbridge_api_enabled %}
|
||||
api.api:
|
||||
BindAddress: 0.0.0.0:{{ matterbridge_api_port }}
|
||||
Buffer: 1000
|
||||
RemoteNickFormat: '{NICK}@api'
|
||||
{% endif %}
|
||||
|
||||
#######################################
|
||||
# These are auto generated by Ansible #
|
||||
#######################################
|
||||
@ -31,6 +38,7 @@ gateway:
|
||||
- account: "api.{{ api_name }}"
|
||||
channel: "api"
|
||||
{% endfor %}
|
||||
|
||||
{% if gtw.get("gitter", false) %}
|
||||
|
||||
- account: "gitter.autobot"
|
||||
|
Loading…
x
Reference in New Issue
Block a user