mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-11-10 04:37:36 +01:00
matrix-sms-bridge:
added docs, added seperate service for database, pr comments
This commit is contained in:
parent
4913ca4bb2
commit
1ffa4a326c
@ -52,6 +52,8 @@ Using this playbook, you can get the following services configured on your serve
|
||||
|
||||
- (optional) the [matrix-appservice-webhooks](https://github.com/turt2live/matrix-appservice-webhooks) bridge for slack compatible webhooks ([ConcourseCI](https://concourse-ci.org/), [Slack](https://slack.com/) etc. pp.)
|
||||
|
||||
- (optional) the [matrix-sms-bridge](https://github.com/benkuly/matrix-sms-bridge) for bridging your Matrix server to SMS
|
||||
|
||||
- (optional) [Email2Matrix](https://github.com/devture/email2matrix) for relaying email messages to Matrix rooms
|
||||
|
||||
- (optional) [Dimension](https://github.com/turt2live/matrix-dimension), an open source integrations manager for matrix clients
|
||||
@ -144,6 +146,8 @@ This playbook sets up your server using the following Docker images:
|
||||
|
||||
- [turt2live/matrix-appservice-webhooks](https://hub.docker.com/r/turt2live/matrix-appservice-webhooks) - the [Appservice Webhooks](https://github.com/turt2live/matrix-appservice-webhooks) bridge (optional)
|
||||
|
||||
- [folivonet/matrix-sms-bridge](https://hub.docker.com/repository/docker/folivonet/matrix-sms-bridge) - the [matrix-sms-brdige](https://github.com/benkuly/matrix-sms-bridge) (optional)
|
||||
|
||||
- [sorunome/mx-puppet-skype](https://hub.docker.com/r/sorunome/mx-puppet-skype) - the [mx-puppet-skype](https://github.com/Sorunome/mx-puppet-skype) bridge to [Skype](https:/www.skype.com) (optional)
|
||||
|
||||
- [sorunome/mx-puppet-slack](https://hub.docker.com/r/sorunome/mx-puppet-slack) - the [mx-puppet-slack](https://github.com/Sorunome/mx-puppet-slack) bridge to [Slack](https:/slack.com) (optional)
|
||||
|
24
docs/configuring-playbook-matrix-sms-bridge.md
Normal file
24
docs/configuring-playbook-matrix-sms-bridge.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Setting up matrix-sms-bridge (optional)
|
||||
|
||||
The playbook can install and configure
|
||||
[matrix-sms-brdige](https://github.com/benkuly/matrix-sms-bridge) for you.
|
||||
|
||||
See the project page to learn what it does and why it might be useful to you.
|
||||
|
||||
To enable the bridge just use the following
|
||||
playbook configuration:
|
||||
|
||||
|
||||
```yaml
|
||||
matrix_sms_bridge_enabled: true
|
||||
matrix_sms_bridge_gammu_modem: "/path/to/modem"
|
||||
# generate a secret passwort e.g. with pwgen -s 64 1
|
||||
matrix_sms_bridge_database_password: ""
|
||||
# (optional) a room id to a default room
|
||||
matrix_sms_bridge_default_room: ""
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Read the [user guide](https://github.com/benkuly/matrix-sms-bridge/blob/master/README.md#user-guide) to see how this bridge works.
|
@ -102,3 +102,5 @@ When you're done with all the configuration you'd like to do, continue with [Ins
|
||||
- [Setting up MX Puppet Slack bridging](configuring-playbook-bridge-mx-puppet-slack.md) (optional)
|
||||
|
||||
- [Setting up Email2Matrix](configuring-playbook-email2matrix.md) (optional)
|
||||
|
||||
- [Setting up Matrix SMS bridging](configuring-playbook-matrix-sms-bridge.md) (optional)
|
||||
|
@ -324,8 +324,6 @@ matrix_sms_bridge_appservice_token: "{{ matrix_synapse_macaroon_secret_key | pas
|
||||
|
||||
matrix_sms_bridge_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'sms.hs.token') | to_uuid }}"
|
||||
|
||||
matrix_sms_bridge_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'sms.db.password') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-sms-bridge
|
||||
|
@ -31,11 +31,13 @@ matrix_sms_bridge_container_http_host_bind_port: ''
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_sms_bridge_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-appservice-discord.service depends on.
|
||||
matrix_sms_bridge_systemd_required_services_list: ['docker.service']
|
||||
# List of systemd services that service depends on.
|
||||
matrix_sms_bridge_systemd_required_services_list: ['docker.service','matrix-sms-bridge-database.service']
|
||||
matrix_sms_bridge_database_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-appservice-discord.service wants
|
||||
# List of systemd services that service wants
|
||||
matrix_sms_bridge_systemd_wanted_services_list: []
|
||||
matrix_sms_bridge_database_systemd_wanted_services_list: []
|
||||
|
||||
matrix_sms_bridge_appservice_url: 'http://matrix-sms-bridge:8080'
|
||||
matrix_sms_bridge_database_url: 'bolt://matrix-sms-bridge-database:7687'
|
||||
|
@ -66,7 +66,14 @@
|
||||
mode: 0644
|
||||
register: matrix_sms_bridge_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service installation
|
||||
- name: Ensure matrix-sms-bridge-database.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-sms-bridge-database.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-sms-bridge-database.service"
|
||||
mode: 0644
|
||||
register: matrix_sms_bridge_database_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service or matrix-sms-bridge-database.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_sms_bridge_systemd_service_result.changed"
|
||||
when: matrix_sms_bridge_systemd_service_result.changed or matrix_sms_bridge_database_systemd_service_result.changed
|
||||
|
@ -5,6 +5,11 @@
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge.service"
|
||||
register: matrix_sms_bridge_service_stat
|
||||
|
||||
- name: Check existence of matrix-sms-bridge-database service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge-database.service"
|
||||
register: matrix_sms_bridge_database_service_stat
|
||||
|
||||
- name: Ensure matrix-sms-bridge is stopped
|
||||
service:
|
||||
name: matrix-sms-bridge
|
||||
@ -12,13 +17,26 @@
|
||||
daemon_reload: yes
|
||||
when: "matrix_sms_bridge_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-sms-bridge-database is stopped
|
||||
service:
|
||||
name: matrix-sms-bridge-database
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
when: "matrix_sms_bridge_database_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-sms-bridge.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge.service"
|
||||
state: absent
|
||||
when: "matrix_sms_bridge_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service removal
|
||||
- name: Ensure matrix-sms-bridge-database.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-sms-bridge-database.service"
|
||||
state: absent
|
||||
when: "matrix_sms_bridge_database_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-sms-bridge.service or matrix-sms-bridge-database.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_sms_bridge_service_stat.stat.exists"
|
||||
when: matrix_sms_bridge_service_stat.stat.exists or matrix_sms_bridge_database_service_stat.stat.exists
|
||||
|
@ -0,0 +1,36 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=matrix-sms-bridge-database server
|
||||
{% for service in matrix_sms_bridge_database_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_sms_bridge_database_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-/usr/bin/docker kill matrix-sms-bridge-database
|
||||
ExecStartPre=-/usr/bin/docker rm matrix-sms-bridge-database
|
||||
|
||||
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
|
||||
ExecStartPre=/bin/sleep 5
|
||||
|
||||
ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge-database \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_sms_bridge_database_path }}:/data:z \
|
||||
-e NEO4J_AUTH={{ matrix_sms_bridge_database_username }}/{{ matrix_sms_bridge_database_password }} \
|
||||
{{ matrix_sms_bridge_database_docker_image }}
|
||||
|
||||
ExecStop=-/usr/bin/docker kill matrix-sms-bridge-database
|
||||
ExecStop=-/usr/bin/docker rm matrix-sms-bridge-database
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-sms-bridge
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -13,20 +13,6 @@ Wants={{ service }}
|
||||
Type=simple
|
||||
ExecStartPre=-/usr/bin/docker kill matrix-sms-bridge
|
||||
ExecStartPre=-/usr/bin/docker rm matrix-sms-bridge
|
||||
ExecStartPre=-/usr/bin/docker kill matrix-sms-bridge-database
|
||||
ExecStartPre=-/usr/bin/docker rm matrix-sms-bridge-database
|
||||
|
||||
ExecStartPre=/usr/bin/docker run --rm --name matrix-sms-bridge-database \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_sms_bridge_container_http_host_bind_port %}
|
||||
-p {{ matrix_sms_bridge_container_http_host_bind_port }}:7687 \
|
||||
{% endif %}
|
||||
-v {{ matrix_sms_bridge_database_path }}:/data:z \
|
||||
-e NEO4J_AUTH={{ matrix_sms_bridge_database_username }}/{{ matrix_sms_bridge_database_password }}
|
||||
{{ matrix_sms_bridge_database_docker_image }}
|
||||
|
||||
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
|
||||
ExecStartPre=/bin/sleep 5
|
||||
@ -41,7 +27,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge \
|
||||
{% endif %}
|
||||
-v {{ matrix_sms_bridge_config_path }}:/config:z \
|
||||
-v {{ matrix_sms_bridge_data_path }}:/data:z \
|
||||
--device {{ matrix_sms_bridge_gammu_modem }}:/dev/ttyModem
|
||||
--device {{ matrix_sms_bridge_gammu_modem }}:/dev/ttyModem \
|
||||
{% for arg in matrix_sms_bridge_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
@ -49,8 +35,6 @@ ExecStart=/usr/bin/docker run --rm --name matrix-sms-bridge \
|
||||
|
||||
ExecStop=-/usr/bin/docker kill matrix-sms-bridge
|
||||
ExecStop=-/usr/bin/docker rm matrix-sms-bridge
|
||||
ExecStop=-/usr/bin/docker kill matrix-sms-database
|
||||
ExecStop=-/usr/bin/docker rm matrix-sms-database
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-sms-bridge
|
||||
|
Loading…
Reference in New Issue
Block a user