Merge branch 'master' into pub.solar
This commit is contained in:
commit
8b39c769ec
70
CHANGELOG.md
70
CHANGELOG.md
|
@ -1,3 +1,73 @@
|
|||
# 2021-01-03
|
||||
|
||||
## Signal bridging support via mautrix-signal
|
||||
|
||||
Thanks to [laszabine](https://github.com/laszabine)'s efforts, the playbook now supports bridging to [Signal](https://www.signal.org/) via the [mautrix-signal](https://github.com/tulir/mautrix-signal) bridge. See our [Setting up Mautrix Signal bridging](docs/configuring-playbook-bridge-mautrix-signal.md) documentation page for getting started.
|
||||
|
||||
If you had installed the mautrix-signal bridge while its Pull Request was still work-in-progress, you can migrate your data to the new and final setup by referring to [this comment](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/686#issuecomment-753510789).
|
||||
|
||||
|
||||
# 2020-12-23
|
||||
|
||||
## The big move to all-on-Postgres (potentially dangerous)
|
||||
|
||||
**TLDR**: all your bridges (and other services) will likely be auto-migrated from SQLite/nedb to Postgres, hopefully without trouble. You can opt-out (see how below), if too worried about breakage.
|
||||
|
||||
Until now, we've only used Postgres as a database for Synapse. All other services (bridges, bots, etc.) were kept simple and used a file-based database (SQLite or nedb).
|
||||
|
||||
Since [this huge pull request](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/740), **all of our services now use Postgres by default**. Thanks to [Johanna Dorothea Reichmann](https://github.com/jdreichmann) for starting the work on it and for providing great input!
|
||||
|
||||
Moving all services to Postgres brings a few **benefits** to us:
|
||||
|
||||
- **improved performance**
|
||||
- **improved compatibility**. Most bridges are deprecating SQLite/nedb support or offer less features when not on Postgres.
|
||||
- **easier backups**. It's still some effort to take a proper backup (Postgres dump + various files, keys), but a Postgres dump now takes you much further.
|
||||
- we're now **more prepared to introduce other services** that need a Postgres database - [Dendrite](https://github.com/matrix-org/dendrite), the [mautrix-signal](https://github.com/tulir/mautrix-signal) bridge (existing [pull request](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/686)), etc.
|
||||
|
||||
### Key takeway
|
||||
|
||||
- existing installations that use an [external Postgres](https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/configuring-playbook-external-postgres.md) server should be unaffected (they remain on SQLite/nedb for all services, except Synapse)
|
||||
|
||||
- for existing installations which use our integrated Postgres database server (`matrix-postgres`, which is the default), **we automatically migrate data** from SQLite/nedb to Postgres and **archive the database files** (`something.db` -> `something.db.backup`), so you can restore them if you need to go back (see how below).
|
||||
|
||||
### Opting-out of the Postgres migration
|
||||
|
||||
This is a **very large and somewhat untested change** (potentially dangerous), so **if you're not feeling confident/experimental, opt-out** of it for now. Still, it's the new default and what we (and various bridges) will focus on going forward, so don't stick to old ways for too long.
|
||||
|
||||
You can remain on SQLite/nedb (at least for now) by adding a variable like this to your `vars.yml` file for each service you use: `matrix_COMPONENT_database_engine: sqlite` (e.g. `matrix_mautrix_facebook_database_engine: sqlite`).
|
||||
|
||||
Some services (like `appservice-irc` and `appservice-slack`) don't use SQLite, so use `nedb`, instead of `sqlite` for them.
|
||||
|
||||
### Going back to SQLite/nedb if things went wrong
|
||||
|
||||
If you went with the Postgres migration and it went badly for you (some bridge not working as expected or not working at all), do this:
|
||||
|
||||
- stop all services (`ansible-playbook -i inventory/hosts setup.yml --tags=stop`)
|
||||
- SSH into the server and rename the old database files (`something.db.backup` -> `something.db`). Example: `mv /matrix/mautrix-facebook/data/mautrix-facebook.db.backup /matrix/mautrix-facebook/data/mautrix-facebook.db`
|
||||
- switch the affected service back to SQLite (e.g. `matrix_mautrix_facebook_database_engine: sqlite`). Some services (like `appservice-irc` and `appservice-slack`) don't use SQLite, so use `nedb`, instead of `sqlite` for them.
|
||||
- re-run the playbook (`ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start`)
|
||||
- [get in touch](README.md#support) with us
|
||||
|
||||
|
||||
# 2020-12-11
|
||||
|
||||
## synapse-janitor support removed
|
||||
|
||||
We've removed support for the unmaintained [synapse-janitor](https://github.com/xwiki-labs/synapse_scripts) script. There's been past reports of it corrupting the Synapse database. Since there hasn't been any new development on it and it doesn't seem too useful nowadays, there's no point in including it in the playbook.
|
||||
|
||||
If you need to clean up or compact your database, consider using the Synapse Admin APIs directly. See our [Synapse maintenance](docs/maintenance-synapse.md) and [Postgres maintenance](docs/maintenance-postgres.md) documentation pages for more details.
|
||||
|
||||
|
||||
## Docker 20.10 is here
|
||||
|
||||
(No need to do anything special in relation to this. Just something to keep in mind)
|
||||
|
||||
Docker 20.10 got released recently and your server will likely get it the next time you update.
|
||||
|
||||
This is the first major Docker update in a long time and it packs a lot of changes.
|
||||
Some of them introduced some breakage for us initially (see [here](https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/d08b27784f222effcbce2abf924bf07bbe0893be) and [here](https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/7593d969e316cc0144bce378a5be58c76c2c37ee)), but it should be all good now.
|
||||
|
||||
|
||||
# 2020-12-08
|
||||
|
||||
## openid APIs exposed by default on the federation port when federation disabled
|
||||
|
|
12
README.md
12
README.md
|
@ -46,6 +46,8 @@ Using this playbook, you can get the following services configured on your serve
|
|||
|
||||
- (optional) the [mautrix-hangouts](https://github.com/tulir/mautrix-hangouts) bridge for bridging your Matrix server to [Google Hangouts](https://en.wikipedia.org/wiki/Google_Hangouts)
|
||||
|
||||
- (optional) the [mautrix-signal](https://github.com/tulir/mautrix-signal) bridge for bridging your Matrix server to [Signal](https://www.signal.org/)
|
||||
|
||||
- (optional) the [matrix-appservice-irc](https://github.com/matrix-org/matrix-appservice-irc) bridge for bridging your Matrix server to [IRC](https://wikipedia.org/wiki/Internet_Relay_Chat)
|
||||
|
||||
- (optional) the [matrix-appservice-discord](https://github.com/Half-Shot/matrix-appservice-discord) bridge for bridging your Matrix server to [Discord](https://discordapp.com/)
|
||||
|
@ -150,13 +152,15 @@ This playbook sets up your server using the following Docker images:
|
|||
|
||||
- [certbot/certbot](https://hub.docker.com/r/certbot/certbot/) - the [certbot](https://certbot.eff.org/) tool for obtaining SSL certificates from [Let's Encrypt](https://letsencrypt.org/) (optional)
|
||||
|
||||
- [tulir/mautrix-telegram](https://hub.docker.com/r/tulir/mautrix-telegram/) - the [mautrix-telegram](https://github.com/tulir/mautrix-telegram) bridge to [Telegram](https://telegram.org/) (optional)
|
||||
- [tulir/mautrix-telegram](https://mau.dev/tulir/mautrix-telegram/container_registry) - the [mautrix-telegram](https://github.com/tulir/mautrix-telegram) bridge to [Telegram](https://telegram.org/) (optional)
|
||||
|
||||
- [tulir/mautrix-whatsapp](https://hub.docker.com/r/tulir/mautrix-whatsapp/) - the [mautrix-whatsapp](https://github.com/tulir/mautrix-whatsapp) bridge to [Whatsapp](https://www.whatsapp.com/) (optional)
|
||||
- [tulir/mautrix-whatsapp](https://mau.dev/tulir/mautrix-whatsapp/container_registry) - the [mautrix-whatsapp](https://github.com/tulir/mautrix-whatsapp) bridge to [Whatsapp](https://www.whatsapp.com/) (optional)
|
||||
|
||||
- [tulir/mautrix-facebook](https://hub.docker.com/r/tulir/mautrix-facebook/) - the [mautrix-facebook](https://github.com/tulir/mautrix-facebook) bridge to [Facebook](https://facebook.com/) (optional)
|
||||
- [tulir/mautrix-facebook](https://mau.dev/tulir/mautrix-facebook/container_registry) - the [mautrix-facebook](https://github.com/tulir/mautrix-facebook) bridge to [Facebook](https://facebook.com/) (optional)
|
||||
|
||||
- [tulir/mautrix-hangouts](https://hub.docker.com/r/tulir/mautrix-hangouts/) - the [mautrix-hangouts](https://github.com/tulir/mautrix-hangouts) bridge to [Google Hangouts](https://en.wikipedia.org/wiki/Google_Hangouts) (optional)
|
||||
- [tulir/mautrix-hangouts](https://mau.dev/tulir/mautrix-hangouts/container_registry) - the [mautrix-hangouts](https://github.com/tulir/mautrix-hangouts) bridge to [Google Hangouts](https://en.wikipedia.org/wiki/Google_Hangouts) (optional)
|
||||
|
||||
- [tulir/mautrix-signal](https://mau.dev/tulir/mautrix-signal/container_registry) - the [mautrix-signal](https://github.com/tulir/mautrix-signal) bridge to [Signal](https://www.signal.org/) (optional)
|
||||
|
||||
- [matrixdotorg/matrix-appservice-irc](https://hub.docker.com/r/matrixdotorg/matrix-appservice-irc) - the [matrix-appservice-irc](https://github.com/matrix-org/matrix-appservice-irc) bridge to [IRC](https://wikipedia.org/wiki/Internet_Relay_Chat) (optional)
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
- [Installing](installing.md)
|
||||
|
||||
- **Importing data from another Synapse server installation**
|
||||
- **Importing data from another server installation**
|
||||
|
||||
- [Importing an existing SQLite database (from another installation)](importing-sqlite.md) (optional)
|
||||
- [Importing an existing SQLite database (from another Synapse installation)](importing-synapse-sqlite.md) (optional)
|
||||
|
||||
- [Importing an existing Postgres database (from another installation)](importing-postgres.md) (optional)
|
||||
|
||||
- [Importing `media_store` data files from an existing installation](importing-media-store.md) (optional)
|
||||
- [Importing `media_store` data files from an existing Synapse installation](importing-synapse-media-store.md) (optional)
|
||||
|
||||
- [Registering users](registering-users.md)
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ If your local computer cannot run Ansible, you can also run Ansible on some serv
|
|||
|
||||
## Supported Ansible versions
|
||||
|
||||
Ansible 2.7.0 or newer is required.
|
||||
Ansible 2.7.1 or newer is required ([last discussion about Ansible versions](https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/743)).
|
||||
|
||||
Ubuntu (at least 20.04) ships with a buggy version (see this [bug](https://bugs.launchpad.net/ubuntu/+source/ansible/+bug/1880359)), which can't be used in combination with a host running new systemd (more detaisl in [#517](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/517), [#669]([669](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/669))). If this problem affects you, you can: avoid running Ubuntu 20.04 on your host; run Ansible from another machine targeting your host; or try to upgrade to a newer Ansible version (see below).
|
||||
Note: Ubuntu 20.04 ships with Ansible 2.9.6 which is a buggy version (see this [bug](https://bugs.launchpad.net/ubuntu/+source/ansible/+bug/1880359)), which can't be used in combination with a host running new systemd (more details in [#517](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/517), [#669](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/669)). If this problem affects you, you can: avoid running Ubuntu 20.04 on your host; run Ansible from another machine targeting your host; or try to upgrade to a newer Ansible version (see below).
|
||||
|
||||
|
||||
## Checking your Ansible version
|
||||
|
|
|
@ -14,20 +14,18 @@ Instructions loosely based on [this](https://github.com/Half-Shot/matrix-appserv
|
|||
1. Create a Discord Application [here](https://discordapp.com/developers/applications).
|
||||
2. Retrieve Client ID.
|
||||
3. Create a bot from the Bot tab and retrieve the Bot token.
|
||||
4. From the Bot tab, enable all checkboxes related to Privileged Gateway Intents (you can skip this step if you're not using `matrix_appservice_discord_auth_usePrivilegedIntents: true` below)
|
||||
5. Enable the bridge with the following configuration in your `vars.yml` file:
|
||||
4. Enable the bridge with the following configuration in your `vars.yml` file:
|
||||
|
||||
```yaml
|
||||
matrix_appservice_discord_enabled: true
|
||||
matrix_appservice_discord_client_id: "YOUR DISCORD APP CLIENT ID"
|
||||
matrix_appservice_discord_bot_token: "YOUR DISCORD APP BOT TOKEN"
|
||||
matrix_appservice_discord_auth_usePrivilegedIntents: true
|
||||
```
|
||||
|
||||
6. 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.
|
||||
7. 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`). You need to peek at the file on the server via SSH, etc., because it's not available via HTTP(S).
|
||||
8. Invite the Bot to Discord servers you wish to bridge. Administrator permission is recommended.
|
||||
9. Room addresses follow this syntax: `#_discord_guildid_channelid`. You can easily find the guild and channel ids by logging into Discord in a browser and opening the desired channel. The URL will have this format: `discordapp.com/channels/guild_id/channel_id`. Once you have figured out the appropriate room addrss, you can join by doing `/join #_discord_guildid_channelid` in your Matrix client.
|
||||
5. 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.
|
||||
6. 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`). You need to peek at the file on the server via SSH, etc., because it's not available via HTTP(S).
|
||||
7. Invite the Bot to Discord servers you wish to bridge. Administrator permission is recommended.
|
||||
8. Room addresses follow this syntax: `#_discord_guildid_channelid`. You can easily find the guild and channel ids by logging into Discord in a browser and opening the desired channel. The URL will have this format: `discordapp.com/channels/guild_id/channel_id`. Once you have figured out the appropriate room addrss, you can join by doing `/join #_discord_guildid_channelid` in your Matrix client.
|
||||
|
||||
Other configuration options are available via the `matrix_appservice_discord_configuration_extension_yaml` variable.
|
||||
|
||||
|
|
46
docs/configuring-playbook-bridge-mautrix-signal.md
Normal file
46
docs/configuring-playbook-bridge-mautrix-signal.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Setting up Mautrix Signal (optional)
|
||||
|
||||
The playbook can install and configure [mautrix-signal](https://github.com/tulir/mautrix-signal) for you.
|
||||
|
||||
See the project's [documentation](https://github.com/tulir/mautrix-signal/wiki) to learn what it does and why it might be useful to you.
|
||||
|
||||
**Note/Prerequisite**: If you're running with the Postgres database server integrated by the playbook (which is the default), you don't need to do anything special and can easily proceed with installing. However, if you're [using an external Postgres server](configuring-playbook-external-postgres.md), you'd need to manually prepare a Postgres database for this bridge and adjust the variables related to that (`matrix_mautrix_signal_database_*`).
|
||||
|
||||
Use the following playbook configuration:
|
||||
|
||||
```yaml
|
||||
matrix_mautrix_signal_enabled: true
|
||||
```
|
||||
|
||||
## Set up Double Puppeting
|
||||
|
||||
If you'd like to use [Double Puppeting](https://github.com/tulir/mautrix-whatsapp/wiki/Authentication#replacing-whatsapp-accounts-matrix-puppet-with-matrix-account) (hint: you most likely do), you have 2 ways of going about it.
|
||||
|
||||
### Method 1: automatically, by enabling Shared Secret Auth
|
||||
|
||||
The bridge will automatically perform Double Puppeting if you enable [Shared Secret Auth](configuring-playbook-shared-secret-auth.md) for this playbook.
|
||||
|
||||
This is the recommended way of setting up Double Puppeting, as it's easier to accomplish, works for all your users automatically, and has less of a chance of breaking in the future.
|
||||
|
||||
### Method 2: manually, by asking each user to provide a working access token
|
||||
|
||||
**Note**: This method for enabling Double Puppeting can be configured only after you've already set up bridging (see [Usage](#usage)).
|
||||
|
||||
When using this method, **each user** that wishes to enable Double Puppeting needs to follow the following steps:
|
||||
|
||||
- retrieve a Matrix access token for yourself. You can use the following command:
|
||||
|
||||
```
|
||||
curl \
|
||||
--data '{"identifier": {"type": "m.id.user", "user": "YOUR_MATRIX_USERNAME" }, "password": "YOUR_MATRIX_PASSWORD", "type": "m.login.password", "device_id": "Mautrix-Signal", "initial_device_display_name": "Mautrix-Signal"}' \
|
||||
https://matrix.DOMAIN/_matrix/client/r0/login
|
||||
```
|
||||
|
||||
- send the access token to the bot. Example: `login-matrix MATRIX_ACCESS_TOKEN_HERE`
|
||||
|
||||
- make sure you don't log out the `Mautrix-Signal` device some time in the future, as that would break the Double Puppeting feature
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
You then need to start a chat with `@signalbot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base domain, not the `matrix.` domain).
|
|
@ -24,7 +24,6 @@ matrix_nginx_proxy_proxy_matrix_nginx_status_allowed_addresses:
|
|||
- 1.1.1.1
|
||||
```
|
||||
|
||||
|
||||
## Synapse + OpenID Connect for Single-Sign-On
|
||||
|
||||
If you want to use OpenID Connect as an SSO provider (as per the [Synapse OpenID docs](https://github.com/matrix-org/synapse/blob/develop/docs/openid.md)), you need to use the following configuration (in your `vars.yml` file) to instruct nginx to forward `/_synapse/oidc` to Synapse:
|
||||
|
@ -32,3 +31,11 @@ If you want to use OpenID Connect as an SSO provider (as per the [Synapse OpenID
|
|||
```yaml
|
||||
matrix_nginx_proxy_proxy_matrix_client_api_forwarded_location_synapse_oidc_api_enabled: true
|
||||
```
|
||||
|
||||
## Disable Nginx access logs
|
||||
|
||||
This will disable the access logging for nginx.
|
||||
|
||||
```yaml
|
||||
matrix_nginx_proxy_access_log_enabled: false
|
||||
```
|
||||
|
|
|
@ -144,7 +144,7 @@ matrix_nginx_proxy_container_extra_arguments:
|
|||
- '--label "traefik.enable=true"'
|
||||
|
||||
# The Nginx proxy container will receive traffic from these subdomains
|
||||
- '--label "traefik.http.routers.matrix-nginx-proxy.rule=Host(`{{ matrix_server_fqn_matrix }}`,`{{ matrix_server_fqn_element }}`,`{{ matrix_server_fqn_dimension }},`{{ matrix_server_fqn_jitsi }}`)"'
|
||||
- '--label "traefik.http.routers.matrix-nginx-proxy.rule=Host(`{{ matrix_server_fqn_matrix }}`,`{{ matrix_server_fqn_element }}`,`{{ matrix_server_fqn_dimension }}`,`{{ matrix_server_fqn_jitsi }}`)"'
|
||||
|
||||
# (The 'web-secure' entrypoint must bind to port 443 in Traefik config)
|
||||
- '--label "traefik.http.routers.matrix-nginx-proxy.entrypoints=web-secure"'
|
||||
|
@ -219,7 +219,7 @@ services:
|
|||
- "--certificatesresolvers.default.acme.storage=/letsencrypt/acme.json"
|
||||
ports:
|
||||
- "443:443"
|
||||
- "8080:8080"
|
||||
- "8448:8448"
|
||||
volumes:
|
||||
- "./letsencrypt:/letsencrypt"
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
|
|
|
@ -67,6 +67,7 @@ By default, it obtains certificates for:
|
|||
- possibly for `element.<your-domain>`, unless you have disabled the [Element client component](configuring-playbook-client-element.md) using `matrix_client_element_enabled: false`
|
||||
- possibly for `riot.<your-domain>`, if you have explicitly enabled Riot to Element redirection (for background compatibility) using `matrix_nginx_proxy_proxy_riot_compat_redirect_enabled: true`
|
||||
- possibly for `dimension.<your-domain>`, if you have explicitly [set up Dimension](configuring-playbook-dimension.md).
|
||||
- possibly for `jitsi.<your-domain>`, if you have explicitly [set up Jitsi](configuring-playbook-jitsi.md).
|
||||
- possibly for your base domain (`<your-domain>`), if you have explicitly configured [Serving the base domain](configuring-playbook-base-domain-serving.md)
|
||||
|
||||
If you are hosting other domains on the Matrix machine, you can make the playbook obtain and renew certificates for those other domains too.
|
||||
|
@ -80,6 +81,7 @@ matrix_ssl_domains_to_obtain_certificates_for:
|
|||
- '{{ matrix_server_fqn_matrix }}'
|
||||
- '{{ matrix_server_fqn_element }}'
|
||||
- '{{ matrix_server_fqn_dimension }}'
|
||||
- '{{ matrix_server_fqn_jitsi }}'
|
||||
- '{{ matrix_domain }}'
|
||||
```
|
||||
|
||||
|
|
|
@ -94,6 +94,8 @@ When you're done with all the configuration you'd like to do, continue with [Ins
|
|||
|
||||
- [Setting up Mautrix Hangouts bridging](configuring-playbook-bridge-mautrix-hangouts.md) (optional)
|
||||
|
||||
- [Setting up Mautrix Signal bridging](configuring-playbook-bridge-mautrix-signal.md) (optional)
|
||||
|
||||
- [Setting up Appservice IRC bridging](configuring-playbook-bridge-appservice-irc.md) (optional)
|
||||
|
||||
- [Setting up Appservice Discord bridging](configuring-playbook-bridge-appservice-discord.md) (optional)
|
||||
|
|
|
@ -22,20 +22,20 @@ If this is okay with you, feel free to not read ahead.
|
|||
|
||||
Server Delegation by means of a `/.well-known/matrix/server` file is the most straightforward, but suffers from the following downsides:
|
||||
|
||||
- you need to have a working HTTPS server for the base domain (`<your-domain>`)
|
||||
- you need to have a working HTTPS server for the base domain (`<your-domain>`). If you don't have any server for the base domain at all, you can easily solve it by making the playbook [serve the base domain from the Matrix server](configuring-playbook-base-domain-serving.md).
|
||||
|
||||
- any downtime on the base domain (`<your-domain>`) or network trouble between the matrix subdomain (`matrix.<your-domain>`) and the base `<domain>` may cause Matrix Federation outages. As the [Server-Server spec says](https://matrix.org/docs/spec/server_server/r0.1.0.html#server-discovery):
|
||||
|
||||
> Errors are recommended to be cached for up to an hour, and servers are encouraged to exponentially back off for repeated failures.
|
||||
|
||||
If this is not a concern for you, feel free to not read ahead.
|
||||
**For most people, this is a reasonable tradeoff** given that it's easy and straightforward to set up. We recommend you stay on this path.
|
||||
|
||||
Otherwise, you can decide to go against the default for this playbook, and instead set up [Server Delegation via a DNS SRV record (advanced)](#server-delegation-via-a-dns-srv-record-advanced).
|
||||
Otherwise, you can decide to go against the default for this playbook, and instead set up [Server Delegation via a DNS SRV record (advanced)](#server-delegation-via-a-dns-srv-record-advanced) (much more complicated).
|
||||
|
||||
|
||||
## Server Delegation via a DNS SRV record (advanced)
|
||||
|
||||
**NOTE**: doing Server Delegation via a DNS SRV record is a more advanced way to do it and is not the default for this playbook.
|
||||
**NOTE**: doing Server Delegation via a DNS SRV record is a more **advanced** way to do it and is not the default for this playbook. This is usually **much more complicated** to set up, so **we don't recommend it**. If you're not an experience sysadmin, you'd better stay away from this.
|
||||
|
||||
As per the [Server-Server spec](https://matrix.org/docs/spec/server_server/r0.1.0.html#server-discovery), it's possible to do Server Delegation using only a SRV record (without a `/.well-known/matrix/server` file).
|
||||
|
||||
|
@ -47,7 +47,7 @@ To use DNS SRV record validation, you need to:
|
|||
|
||||
- ensure that you have a `_matrix._tcp` DNS SRV record for your base domain (`<your-domain>`) with a value of `10 0 8448 matrix.<your-domain>`
|
||||
|
||||
- ensure that you are serving the Matrix Federation API (tcp/8448) with a certificate for `<your-domain>` (not `matrix.<your-domain>`!). See below.
|
||||
- ensure that you are serving the Matrix Federation API (tcp/8448) with a certificate for `<your-domain>` (not `matrix.<your-domain>`!). Getting this certificate to the `matrix.<your-domain>` server may be complicated. The playbook's automatic SSL obtaining/renewal flow will likely not work and you'll need to copy certificates around manually. See below.
|
||||
|
||||
|
||||
### Obtaining certificates
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Importing an existing Postgres database from another installation (optional)
|
||||
|
||||
Run this if you'd like to import your database from a previous installation of Synapse.
|
||||
(don't forget to import your `media_store` files as well - see [the importing-media-store guide](importing-media-store.md)).
|
||||
Run this if you'd like to import your database from a previous installation.
|
||||
(don't forget to import your Synapse `media_store` files as well - see [the importing-synape-media-store guide](importing-synapse-media-store.md)).
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Importing `media_store` data files from an existing installation (optional)
|
||||
# Importing `media_store` data files from an existing Synapse installation (optional)
|
||||
|
||||
Run this if you'd like to import your `media_store` files from a previous installation of Synapse.
|
||||
|
||||
|
@ -17,6 +17,6 @@ As an alternative, you can perform a manual restore using the [AWS CLI tool](htt
|
|||
|
||||
Run this command (make sure to replace `<server-path-to-media_store>` with a path on your server):
|
||||
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='server_path_media_store=<server-path-to-media_store>' --tags=import-media-store
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='server_path_media_store=<server-path-to-media_store>' --tags=import-synapse-media-store
|
||||
|
||||
**Note**: `<server-path-to-media_store>` must be a file path to a `media_store` directory on the server (not on your local machine!).
|
|
@ -1,7 +1,7 @@
|
|||
# Importing an existing SQLite database from another installation (optional)
|
||||
# Importing an existing SQLite database from another Synapse installation (optional)
|
||||
|
||||
Run this if you'd like to import your database from a previous default installation of Synapse.
|
||||
(don't forget to import your `media_store` files as well - see [the importing-media-store guide](importing-media-store.md)).
|
||||
(don't forget to import your `media_store` files as well - see [the importing-synapse-media-store guide](importing-synapse-media-store.md)).
|
||||
|
||||
While this playbook always sets up PostgreSQL, by default a Synapse installation would run
|
||||
using an SQLite database.
|
||||
|
@ -18,7 +18,7 @@ Before doing the actual import, **you need to upload your SQLite database file t
|
|||
|
||||
Run this command (make sure to replace `<server-path-to-homeserver.db>` with a file path on your server):
|
||||
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='server_path_homeserver_db=<server-path-to-homeserver.db>' --tags=import-sqlite-db
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='server_path_homeserver_db=<server-path-to-homeserver.db>' --tags=import-synapse-sqlite-db
|
||||
|
||||
**Notes**:
|
||||
|
|
@ -21,11 +21,11 @@ Feel free to **re-run this setup command any time** you think something is off w
|
|||
|
||||
After installing, but before starting the services, you may want to do additional things like:
|
||||
|
||||
- [Importing an existing SQLite database (from another installation)](importing-sqlite.md) (optional)
|
||||
- [Importing an existing SQLite database (from another Synapse installation)](importing-synapse-sqlite.md) (optional)
|
||||
|
||||
- [Importing an existing Postgres database (from another installation)](importing-postgres.md) (optional)
|
||||
|
||||
- [Importing `media_store` data files from an existing installation](importing-media-store.md) (optional)
|
||||
- [Importing `media_store` data files from an existing Synapse installation](importing-synapse-media-store.md) (optional)
|
||||
|
||||
|
||||
## Starting the services
|
||||
|
|
|
@ -69,7 +69,7 @@ This playbook can upgrade your existing Postgres setup with the following comman
|
|||
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=upgrade-postgres
|
||||
|
||||
**The old Postgres data directory is backed up** automatically, by renaming it to `/matrix/postgres-auto-upgrade-backup`.
|
||||
**The old Postgres data directory is backed up** automatically, by renaming it to `/matrix/postgres/data-auto-upgrade-backup`.
|
||||
To rename to a different path, pass some extra flags to the command above, like this: `--extra-vars="postgres_auto_upgrade_backup_data_path=/another/disk/matrix-postgres-before-upgrade"`
|
||||
|
||||
The auto-upgrade-backup directory stays around forever, until you **manually decide to delete it**.
|
||||
|
|
|
@ -4,14 +4,11 @@ This document shows you how to perform various maintenance tasks related to the
|
|||
|
||||
Table of contents:
|
||||
|
||||
- [Purging unused data with synapse-janitor](#purging-unused-data-with-synapse-janitor), for when you wish to delete unused data from the Synapse database
|
||||
|
||||
- [Purging old data with the Purge History API](#purging-old-data-with-the-purge-history-api), for when you wish to delete in-use (but old) data from the Synapse database
|
||||
|
||||
- [Synapse maintenance](#synapse-maintenance)
|
||||
- [Purging old data with the Purge History API](#purging-old-data-with-the-purge-history-api)
|
||||
- [Compressing state with rust-synapse-compress-state](#compressing-state-with-rust-synapse-compress-state)
|
||||
- [Purging unused data with synapse-janitor](#purging-unused-data-with-synapse-janitor)
|
||||
- [Browse and manipulate the database](#browse-and-manipulate-the-database)
|
||||
|
||||
- [Browse and manipulate the database](#browse-and-manipulate-the-database), for when you really need to take matters into your own hands
|
||||
|
@ -57,27 +54,6 @@ If you need to adjust this, pass: `--extra-vars='matrix_synapse_rust_synapse_com
|
|||
After state compression, you may wish to run a [`FULL` Postgres `VACUUM`](./maintenance-postgres.md#vacuuming-postgresql).
|
||||
|
||||
|
||||
## Purging unused data with synapse-janitor
|
||||
|
||||
**NOTE**: There are [reports](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/465) that **synapse-janitor is dangerous to use and causes database corruption**. You may wish to refrain from using it.
|
||||
|
||||
When you **leave** and **forget** a room, Synapse can clean up its data, but currently doesn't.
|
||||
This **unused and unreachable data** remains in your database forever.
|
||||
|
||||
There are external tools (like [synapse-janitor](https://github.com/xwiki-labs/synapse_scripts)), which are meant to solve this problem.
|
||||
|
||||
To ask the playbook to run synapse-janitor, execute:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=run-postgres-synapse-janitor,start
|
||||
```
|
||||
|
||||
**Note**: this will automatically stop Synapse temporarily and restart it later.
|
||||
|
||||
Running synapse-janitor potentially deletes a lot of data from the Postgres database.
|
||||
You may wish to run a [`FULL` Postgres `VACUUM`](./maintenance-postgres.md#vacuuming-postgresql) after that.
|
||||
|
||||
|
||||
## Browse and manipulate the database
|
||||
|
||||
When the [matrix admin API](https://github.com/matrix-org/synapse/tree/master/docs/admin_api) and the other tools do not provide a more convenient way, having a look at synapse's postgresql database can satisfy a lot of admins' needs.
|
||||
|
|
|
@ -10,7 +10,7 @@ This playbook doesn't support running on ARM (see [this issue](https://github.co
|
|||
|
||||
- `root` access to your server (or a user capable of elevating to `root` via `sudo`).
|
||||
|
||||
- [Python](https://www.python.org/) being installed on the server. Most distributions install Python by default, but some don't (e.g. Ubuntu 18.04) and require manual installation (something like `apt-get install python`).
|
||||
- [Python](https://www.python.org/) being installed on the server. Most distributions install Python by default, but some don't (e.g. Ubuntu 18.04) and require manual installation (something like `apt-get install python3`). On some distros, Ansible may incorrectly [detect the Python version](https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html) (2 vs 3) and you may need to explicitly specify the interpreter path in `inventory/hosts` during installation (e.g. `ansible_python_interpreter=/usr/bin/python3`)
|
||||
|
||||
- A `cron`-like tool installed on the server such as `cron` or `anacron` to automatically schedule the Let's Encrypt SSL certificates's renewal. *This can be ignored if you use your own SSL certificates.*
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ and then connecting to the postgres server and executing:
|
|||
```
|
||||
UPDATE users SET password_hash = '<password-hash>' WHERE name = '@someone:server.com'
|
||||
```
|
||||
`
|
||||
|
||||
where `<password-hash>` is the hash returned by the docker command above.
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
matrix.DOMAIN.tld {
|
||||
|
||||
# creates letsencrypt certificate
|
||||
# tls your@email.com
|
||||
|
||||
@identity {
|
||||
path /_matrix/identity/*
|
||||
}
|
||||
|
@ -93,35 +97,12 @@ matrix.DOMAIN.tld:8448 {
|
|||
}
|
||||
}
|
||||
|
||||
dimension.DOMAIN.tld {
|
||||
header {
|
||||
# Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS
|
||||
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
|
||||
# Enable cross-site filter (XSS) and tell browser to block detected attacks
|
||||
X-XSS-Protection "1; mode=block"
|
||||
# Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
|
||||
X-Content-Type-Options "nosniff"
|
||||
# Disallow the site to be rendered within a frame (clickjacking protection)
|
||||
X-Frame-Options "DENY"
|
||||
# X-Robots-Tag
|
||||
X-Robots-Tag "noindex, noarchive, nofollow"
|
||||
}
|
||||
|
||||
handle {
|
||||
encode zstd gzip
|
||||
|
||||
reverse_proxy localhost:8184 {
|
||||
header_up X-Forwarded-Port {http.request.port}
|
||||
header_up X-Forwarded-Proto {http.request.scheme}
|
||||
header_up X-Forwarded-TlsProto {tls_protocol}
|
||||
header_up X-Forwarded-TlsCipher {tls_cipher}
|
||||
header_up X-Forwarded-HttpsProto {proto}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
element.DOMAIN.tld {
|
||||
header {
|
||||
|
||||
# creates letsencrypt certificate
|
||||
# tls your@email.com
|
||||
|
||||
header {
|
||||
# Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS
|
||||
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
|
||||
# Enable cross-site filter (XSS) and tell browser to block detected attacks
|
||||
|
@ -145,3 +126,79 @@ element.DOMAIN.tld {
|
|||
header_up X-Forwarded-HttpsProto {proto}
|
||||
}
|
||||
}
|
||||
|
||||
#dimension.DOMAIN.tld {
|
||||
#
|
||||
# # creates letsencrypt certificate
|
||||
# # tls your@email.com
|
||||
#
|
||||
# header {
|
||||
# # Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS
|
||||
# Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
|
||||
# # Enable cross-site filter (XSS) and tell browser to block detected attacks
|
||||
# X-XSS-Protection "1; mode=block"
|
||||
# # Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
|
||||
# X-Content-Type-Options "nosniff"
|
||||
# # Disallow the site to be rendered within a frame (clickjacking protection)
|
||||
# X-Frame-Options "DENY"
|
||||
# # X-Robots-Tag
|
||||
# X-Robots-Tag "noindex, noarchive, nofollow"
|
||||
# }
|
||||
#
|
||||
# handle {
|
||||
# encode zstd gzip
|
||||
#
|
||||
# reverse_proxy localhost:8184 {
|
||||
# header_up X-Forwarded-Port {http.request.port}
|
||||
# header_up X-Forwarded-Proto {http.request.scheme}
|
||||
# header_up X-Forwarded-TlsProto {tls_protocol}
|
||||
# header_up X-Forwarded-TlsCipher {tls_cipher}
|
||||
# header_up X-Forwarded-HttpsProto {proto}
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
|
||||
|
||||
#jitsi.DOMAIN.tld {
|
||||
#
|
||||
# creates letsencrypt certificate
|
||||
# tls your@email.com
|
||||
#
|
||||
# header {
|
||||
# # Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS
|
||||
# Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
|
||||
#
|
||||
# # Enable cross-site filter (XSS) and tell browser to block detected attacks
|
||||
# X-XSS-Protection "1; mode=block"
|
||||
#
|
||||
# # Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
|
||||
# X-Content-Type-Options "nosniff"
|
||||
#
|
||||
# # Disallow the site to be rendered within a frame (clickjacking protection)
|
||||
# X-Frame-Options "SAMEORIGIN"
|
||||
#
|
||||
# # Disable some features
|
||||
# Feature-Policy "accelerometer 'none';ambient-light-sensor 'none'; autoplay 'none';camera 'none';encrypted-media 'none';focus-without-user-activation 'none'; geolocation 'none';gyroscope #'none';magnetometer 'none';microphone 'none';midi 'none';payment 'none';picture-in-picture 'none'; speaker 'none';sync-xhr 'none';usb 'none';vr 'none'"
|
||||
#
|
||||
# # Referer
|
||||
# Referrer-Policy "no-referrer"
|
||||
#
|
||||
# # X-Robots-Tag
|
||||
# X-Robots-Tag "none"
|
||||
#
|
||||
# # Remove Server header
|
||||
# -Server
|
||||
# }
|
||||
#
|
||||
# handle {
|
||||
# encode zstd gzip
|
||||
#
|
||||
# reverse_proxy 127.0.0.1:12080 {
|
||||
# header_up X-Forwarded-Port {http.request.port}
|
||||
# header_up X-Forwarded-Proto {http.request.scheme}
|
||||
# header_up X-Forwarded-TlsProto {tls_protocol}
|
||||
# header_up X-Forwarded-TlsCipher {tls_cipher}
|
||||
# header_up X-Forwarded-HttpsProto {proto}
|
||||
# }
|
||||
# }
|
||||
#}
|
12
examples/caddy2/README.md
Normal file
12
examples/caddy2/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Caddyfile
|
||||
|
||||
This directory contains sample files that show you how to do reverse-proxying using Caddy2.
|
||||
|
||||
## Config
|
||||
|
||||
| Variable | Function |
|
||||
| ------------------ | -------- |
|
||||
| tls your@email.com | Specify an email address for your [ACME account](https://caddyserver.com/docs/caddyfile/directives/tls) (but if only one email is used for all sites, we recommend the email [global option](https://caddyserver.com/docs/caddyfile/options) instead) |
|
||||
| tls | To enable [tls](https://caddyserver.com/docs/caddyfile/directives/tls) support uncomment the lines for tls |
|
||||
| Dimnension | To enable Dimension support uncomment the lines for Dimension and set your data |
|
||||
| Jitsi | To enable Jitsi support uncomment the lines for Jitsi and set your data |
|
|
@ -10,6 +10,9 @@
|
|||
#
|
||||
# If you're running this Ansible playbook on the same server as the one you're installing to,
|
||||
# consider adding an additional `ansible_connection=local` argument below.
|
||||
#
|
||||
# Ansible may fail to discover which Python interpreter to use on the host for some distros (like Ubuntu 20.04).
|
||||
# You may sometimes need to explicitly add `ansible_python_interpreter=/usr/bin/python3` to lines below.
|
||||
|
||||
[matrix_servers]
|
||||
matrix.<your-domain> ansible_host=<your-server's external IP address> ansible_ssh_user=root
|
||||
|
|
|
@ -24,20 +24,6 @@ matrix_identity_server_url: "{{ ('https://' + matrix_server_fqn_matrix) if matri
|
|||
#
|
||||
######################################################################
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-architecture
|
||||
#
|
||||
######################################################################
|
||||
|
||||
matrix_architecture: "amd64"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-architecture
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
|
@ -61,12 +47,19 @@ matrix_appservice_discord_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_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 }}"
|
||||
|
||||
# We only make this use Postgres if our own Postgres server is enabled.
|
||||
# It's only then (for now) that we can automatically create the necessary database and user for this service.
|
||||
matrix_appservice_discord_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_appservice_discord_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'as.discord.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-appservice-discord
|
||||
|
@ -135,6 +128,10 @@ matrix_appservice_slack_systemd_required_services_list: |
|
|||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
}}
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_appservice_slack_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_appservice_slack_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'as.slack.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-appservice-slack
|
||||
|
@ -170,6 +167,10 @@ matrix_appservice_irc_appservice_token: "{{ matrix_synapse_macaroon_secret_key |
|
|||
|
||||
matrix_appservice_irc_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'irc.hs.token') | to_uuid }}"
|
||||
|
||||
matrix_appservice_irc_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'nedb' }}"
|
||||
matrix_appservice_irc_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'as.irc.db') | to_uuid }}"
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-appservice-irc
|
||||
|
@ -193,6 +194,8 @@ matrix_mautrix_facebook_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mautrix_facebook_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'fb.as.token') | to_uuid }}"
|
||||
|
@ -203,6 +206,10 @@ matrix_mautrix_facebook_login_shared_secret: "{{ matrix_synapse_ext_password_pro
|
|||
|
||||
matrix_mautrix_facebook_bridge_presence: "{{ matrix_synapse_use_presence if matrix_synapse_enabled else true }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mautrix_facebook_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mautrix_facebook_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mau.fb.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mautrix-facebook
|
||||
|
@ -226,6 +233,8 @@ matrix_mautrix_hangouts_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mautrix_hangouts_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'ho.as.token') | to_uuid }}"
|
||||
|
@ -236,6 +245,10 @@ matrix_mautrix_hangouts_container_http_host_bind_port: "{{ '' if matrix_nginx_pr
|
|||
|
||||
matrix_mautrix_hangouts_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mautrix_hangouts_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mautrix_hangouts_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mau.hangouts.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mautrix-hangouts
|
||||
|
@ -243,7 +256,44 @@ matrix_mautrix_hangouts_login_shared_secret: "{{ matrix_synapse_ext_password_pro
|
|||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-bridge-mautrix-signal
|
||||
#
|
||||
######################################################################
|
||||
|
||||
# We don't enable bridges by default.
|
||||
matrix_mautrix_signal_enabled: false
|
||||
|
||||
matrix_mautrix_signal_systemd_required_services_list: |
|
||||
{{
|
||||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
+
|
||||
['matrix-mautrix-signal-daemon.service']
|
||||
}}
|
||||
|
||||
matrix_mautrix_signal_homeserver_domain: '{{ matrix_domain }}'
|
||||
|
||||
matrix_mautrix_signal_homeserver_address: "{{ 'http://matrix-synapse:8008' if matrix_synapse_enabled else '' }}"
|
||||
|
||||
matrix_mautrix_signal_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'si.hs.token') | to_uuid }}"
|
||||
|
||||
matrix_mautrix_signal_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'si.as.token') | to_uuid }}"
|
||||
|
||||
matrix_mautrix_signal_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
matrix_mautrix_signal_database_engine: 'postgres'
|
||||
matrix_mautrix_signal_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mau.signal.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mautrix-signal
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
|
@ -260,6 +310,8 @@ matrix_mautrix_telegram_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mautrix_telegram_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'telegr.as.token') | to_uuid }}"
|
||||
|
@ -272,6 +324,10 @@ matrix_mautrix_telegram_container_http_host_bind_port: "{{ '' if matrix_nginx_pr
|
|||
|
||||
matrix_mautrix_telegram_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mautrix_telegram_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mautrix_telegram_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mau.telegram.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mautrix-telegram
|
||||
|
@ -292,6 +348,8 @@ matrix_mautrix_whatsapp_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mautrix_whatsapp_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'whats.as.token') | to_uuid }}"
|
||||
|
@ -300,6 +358,10 @@ matrix_mautrix_whatsapp_homeserver_token: "{{ matrix_synapse_macaroon_secret_key
|
|||
|
||||
matrix_mautrix_whatsapp_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mautrix_whatsapp_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mautrix_whatsapp_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mauwhatsapp.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mautrix-whatsapp
|
||||
|
@ -348,6 +410,8 @@ matrix_mx_puppet_skype_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mx_puppet_skype_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'skype.as.tok') | to_uuid }}"
|
||||
|
@ -356,6 +420,10 @@ matrix_mx_puppet_skype_homeserver_token: "{{ matrix_synapse_macaroon_secret_key
|
|||
|
||||
matrix_mx_puppet_skype_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mx_puppet_skype_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mx_puppet_skype_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxpup.skype.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mx-puppet-skype
|
||||
|
@ -379,6 +447,8 @@ matrix_mx_puppet_slack_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mx_puppet_slack_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxslk.as.tok') | to_uuid }}"
|
||||
|
@ -387,6 +457,10 @@ matrix_mx_puppet_slack_homeserver_token: "{{ matrix_synapse_macaroon_secret_key
|
|||
|
||||
matrix_mx_puppet_slack_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mx_puppet_slack_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mx_puppet_slack_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxpup.slack.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mx-puppet-slack
|
||||
|
@ -409,6 +483,8 @@ matrix_mx_puppet_twitter_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mx_puppet_twitter_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxtwt.as.tok') | to_uuid }}"
|
||||
|
@ -419,6 +495,10 @@ matrix_mx_puppet_twitter_login_shared_secret: "{{ matrix_synapse_ext_password_pr
|
|||
|
||||
matrix_mx_puppet_twitter_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else ('127.0.0.1:' ~ matrix_mx_puppet_twitter_appservice_port) }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mx_puppet_twitter_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mx_puppet_twitter_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxpup.twitter.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mx-puppet-twitter
|
||||
|
@ -442,6 +522,8 @@ matrix_mx_puppet_instagram_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mx_puppet_instagram_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxig.as.tok') | to_uuid }}"
|
||||
|
@ -450,6 +532,10 @@ matrix_mx_puppet_instagram_homeserver_token: "{{ matrix_synapse_macaroon_secret_
|
|||
|
||||
matrix_mx_puppet_instagram_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mx_puppet_instagram_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mx_puppet_instagram_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxpup.ig.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mx-puppet-instagram
|
||||
|
@ -472,6 +558,8 @@ matrix_mx_puppet_discord_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mx_puppet_discord_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxdsc.as.tok') | to_uuid }}"
|
||||
|
@ -480,6 +568,10 @@ matrix_mx_puppet_discord_homeserver_token: "{{ matrix_synapse_macaroon_secret_ke
|
|||
|
||||
matrix_mx_puppet_discord_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mx_puppet_discord_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mx_puppet_discord_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxpup.dsc.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mx-puppet-discord
|
||||
|
@ -502,6 +594,8 @@ matrix_mx_puppet_steam_systemd_required_services_list: |
|
|||
['docker.service']
|
||||
+
|
||||
(['matrix-synapse.service'] if matrix_synapse_enabled else [])
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mx_puppet_steam_appservice_token: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxste.as.tok') | to_uuid }}"
|
||||
|
@ -510,6 +604,10 @@ matrix_mx_puppet_steam_homeserver_token: "{{ matrix_synapse_macaroon_secret_key
|
|||
|
||||
matrix_mx_puppet_steam_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_mx_puppet_steam_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mx_puppet_steam_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mxpup.steam.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mx-puppet-steam
|
||||
|
@ -526,6 +624,17 @@ matrix_mx_puppet_steam_login_shared_secret: "{{ matrix_synapse_ext_password_prov
|
|||
# We don't enable bots by default.
|
||||
matrix_bot_matrix_reminder_bot_enabled: false
|
||||
|
||||
matrix_bot_matrix_reminder_bot_systemd_required_services_list: |
|
||||
{{
|
||||
['docker.service']
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_bot_matrix_reminder_bot_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_bot_matrix_reminder_bot_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'reminder.bot.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bot-matrix-reminder-bot
|
||||
|
@ -620,6 +729,17 @@ matrix_dimension_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_ena
|
|||
matrix_integration_manager_rest_url: "{{ matrix_dimension_integrations_rest_url if matrix_dimension_enabled else None }}"
|
||||
matrix_integration_manager_ui_url: "{{ matrix_dimension_integrations_ui_url if matrix_dimension_enabled else None }}"
|
||||
|
||||
matrix_dimension_systemd_required_services_list: |
|
||||
{{
|
||||
['docker.service']
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_dimension_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_dimension_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'dimension.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-dimension
|
||||
|
@ -764,6 +884,11 @@ matrix_ma1sd_threepid_medium_email_connectors_smtp_tls: 0
|
|||
|
||||
matrix_ma1sd_self_check_validate_certificates: "{{ false if matrix_ssl_retrieval_method == 'self-signed' else true }}"
|
||||
|
||||
matrix_ma1sd_systemd_required_services_list: |
|
||||
{{
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_ma1sd_systemd_wanted_services_list: |
|
||||
{{
|
||||
(['matrix-corporal.service'] if matrix_corporal_enabled else ['matrix-synapse.service'])
|
||||
|
@ -773,6 +898,10 @@ matrix_ma1sd_systemd_wanted_services_list: |
|
|||
(['matrix-mailer.service'] if matrix_mailer_enabled else [])
|
||||
}}
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_ma1sd_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_ma1sd_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'ma1sd.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-ma1sd
|
||||
|
@ -889,6 +1018,133 @@ matrix_postgres_connection_username: "synapse"
|
|||
matrix_postgres_connection_password: "synapse-password"
|
||||
matrix_postgres_db_name: "homeserver"
|
||||
|
||||
matrix_postgres_pgloader_container_image_self_build: "{{ matrix_architecture != 'amd64' }}"
|
||||
|
||||
matrix_postgres_additional_databases: |
|
||||
{{
|
||||
([{
|
||||
'name': matrix_ma1sd_database_name,
|
||||
'username': matrix_ma1sd_database_username,
|
||||
'password': matrix_ma1sd_database_password,
|
||||
}] if (matrix_ma1sd_enabled and matrix_ma1sd_database_engine == 'postgres' and matrix_ma1sd_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_bot_matrix_reminder_bot_database_name,
|
||||
'username': matrix_bot_matrix_reminder_bot_database_username,
|
||||
'password': matrix_bot_matrix_reminder_bot_database_password,
|
||||
}] if (matrix_bot_matrix_reminder_bot_enabled and matrix_bot_matrix_reminder_bot_database_engine == 'postgres' and matrix_bot_matrix_reminder_bot_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_registration_database_name,
|
||||
'username': matrix_registration_database_username,
|
||||
'password': matrix_registration_database_password,
|
||||
}] if (matrix_registration_enabled and matrix_registration_database_engine == 'postgres' and matrix_registration_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_appservice_discord_database_name,
|
||||
'username': matrix_appservice_discord_database_username,
|
||||
'password': matrix_appservice_discord_database_password,
|
||||
}] if (matrix_appservice_discord_enabled and matrix_appservice_discord_database_engine == 'postgres' and matrix_appservice_discord_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_appservice_slack_database_name,
|
||||
'username': matrix_appservice_slack_database_username,
|
||||
'password': matrix_appservice_slack_database_password,
|
||||
}] if (matrix_appservice_slack_enabled and matrix_appservice_slack_database_engine == 'postgres' and matrix_appservice_slack_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_appservice_irc_database_name,
|
||||
'username': matrix_appservice_irc_database_username,
|
||||
'password': matrix_appservice_irc_database_password,
|
||||
}] if (matrix_appservice_irc_enabled and matrix_appservice_irc_database_engine == 'postgres' and matrix_appservice_irc_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mautrix_facebook_database_name,
|
||||
'username': matrix_mautrix_facebook_database_username,
|
||||
'password': matrix_mautrix_facebook_database_password,
|
||||
}] if (matrix_mautrix_facebook_enabled and matrix_mautrix_facebook_database_engine == 'postgres' and matrix_mautrix_facebook_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mautrix_hangouts_database_name,
|
||||
'username': matrix_mautrix_hangouts_database_username,
|
||||
'password': matrix_mautrix_hangouts_database_password,
|
||||
}] if (matrix_mautrix_hangouts_enabled and matrix_mautrix_hangouts_database_engine == 'postgres' and matrix_mautrix_hangouts_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mautrix_signal_database_name,
|
||||
'username': matrix_mautrix_signal_database_username,
|
||||
'password': matrix_mautrix_signal_database_password,
|
||||
}] if (matrix_mautrix_signal_enabled and matrix_mautrix_signal_database_engine == 'postgres' and matrix_mautrix_signal_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mautrix_telegram_database_name,
|
||||
'username': matrix_mautrix_telegram_database_username,
|
||||
'password': matrix_mautrix_telegram_database_password,
|
||||
}] if (matrix_mautrix_telegram_enabled and matrix_mautrix_telegram_database_engine == 'postgres' and matrix_mautrix_telegram_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mautrix_whatsapp_database_name,
|
||||
'username': matrix_mautrix_whatsapp_database_username,
|
||||
'password': matrix_mautrix_whatsapp_database_password,
|
||||
}] if (matrix_mautrix_whatsapp_enabled and matrix_mautrix_whatsapp_database_engine == 'postgres' and matrix_mautrix_whatsapp_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_skype_database_name,
|
||||
'username': matrix_mx_puppet_skype_database_username,
|
||||
'password': matrix_mx_puppet_skype_database_password,
|
||||
}] if (matrix_mx_puppet_skype_enabled and matrix_mx_puppet_skype_database_engine == 'postgres' and matrix_mx_puppet_skype_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_slack_database_name,
|
||||
'username': matrix_mx_puppet_slack_database_username,
|
||||
'password': matrix_mx_puppet_slack_database_password,
|
||||
}] if (matrix_mx_puppet_slack_enabled and matrix_mx_puppet_slack_database_engine == 'postgres' and matrix_mx_puppet_slack_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_twitter_database_name,
|
||||
'username': matrix_mx_puppet_twitter_database_username,
|
||||
'password': matrix_mx_puppet_twitter_database_password,
|
||||
}] if (matrix_mx_puppet_twitter_enabled and matrix_mx_puppet_twitter_database_engine == 'postgres' and matrix_mx_puppet_twitter_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_instagram_database_name,
|
||||
'username': matrix_mx_puppet_instagram_database_username,
|
||||
'password': matrix_mx_puppet_instagram_database_password,
|
||||
}] if (matrix_mx_puppet_instagram_enabled and matrix_mx_puppet_instagram_database_engine == 'postgres' and matrix_mx_puppet_instagram_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_discord_database_name,
|
||||
'username': matrix_mx_puppet_discord_database_username,
|
||||
'password': matrix_mx_puppet_discord_database_password,
|
||||
}] if (matrix_mx_puppet_discord_enabled and matrix_mx_puppet_discord_database_engine == 'postgres' and matrix_mx_puppet_discord_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_steam_database_name,
|
||||
'username': matrix_mx_puppet_steam_database_username,
|
||||
'password': matrix_mx_puppet_steam_database_password,
|
||||
}] if (matrix_mx_puppet_steam_enabled and matrix_mx_puppet_steam_database_engine == 'postgres' and matrix_mx_puppet_steam_database_hostname == 'matrix-postgres') else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_dimension_database_name,
|
||||
'username': matrix_dimension_database_username,
|
||||
'password': matrix_dimension_database_password,
|
||||
}] if (matrix_dimension_enabled and matrix_dimension_database_engine == 'postgres' and matrix_dimension_database_hostname == 'matrix-postgres') else [])
|
||||
}}
|
||||
|
||||
matrix_postgres_import_roles_to_ignore: |
|
||||
{{
|
||||
[matrix_postgres_connection_username]
|
||||
+
|
||||
matrix_postgres_additional_databases|map(attribute='username')|list
|
||||
}}
|
||||
|
||||
matrix_postgres_import_databases_to_ignore: |
|
||||
{{
|
||||
[matrix_postgres_db_name]
|
||||
+
|
||||
matrix_postgres_additional_databases|map(attribute='name')|list
|
||||
}}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-postgres
|
||||
|
@ -1085,6 +1341,17 @@ matrix_registration_api_validate_certs: "{{ false if matrix_ssl_retrieval_method
|
|||
|
||||
matrix_registration_container_image_self_build: "{{ matrix_architecture != 'amd64' }}"
|
||||
|
||||
matrix_registration_systemd_required_services_list: |
|
||||
{{
|
||||
['docker.service']
|
||||
+
|
||||
(['matrix-postgres.service'] if matrix_postgres_enabled else [])
|
||||
}}
|
||||
|
||||
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
|
||||
matrix_registration_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
|
||||
matrix_registration_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx.registr.db') | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-registration
|
||||
|
|
|
@ -23,6 +23,17 @@ matrix_server_fqn_jitsi: "jitsi.{{ matrix_domain }}"
|
|||
|
||||
matrix_federation_public_port: 8448
|
||||
|
||||
# The architecture that your server runs.
|
||||
# Recognized values by us are 'amd64', 'arm32' and 'arm64'.
|
||||
# Not all architectures support all services, so your experience (on non-amd64) may vary.
|
||||
# See docs/alternative-architectures.md
|
||||
matrix_architecture: amd64
|
||||
|
||||
# The architecture for Debian packages.
|
||||
# See: https://wiki.debian.org/SupportedArchitectures
|
||||
# We just remap from our `matrix_architecture` values to what Debian and possibly other distros call things.
|
||||
matrix_debian_arch: "{{ 'armhf' if matrix_architecture == 'arm32' else matrix_architecture }}"
|
||||
|
||||
matrix_user_username: "matrix"
|
||||
matrix_user_groupname: "matrix"
|
||||
|
||||
|
@ -106,7 +117,6 @@ matrix_docker_package_name: docker-ce
|
|||
run_postgres_import: true
|
||||
run_postgres_upgrade: true
|
||||
run_postgres_import_sqlite_db: true
|
||||
run_postgres_synapse_janitor: true
|
||||
run_postgres_vacuum: true
|
||||
run_synapse_register_user: true
|
||||
run_synapse_update_user_password: true
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
---
|
||||
|
||||
# We generally support Ansible 2.7.0 and above.
|
||||
- name: Fail if running on Ansible < 2.7
|
||||
# We generally support Ansible 2.7.1 and above.
|
||||
- name: Fail if running on Ansible < 2.7.1
|
||||
fail:
|
||||
msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
|
||||
when: "(ansible_version.major < 2) or (ansible_version.major <= 2 and ansible_version.minor < 7)"
|
||||
when:
|
||||
- "(ansible_version.major < 2) or (ansible_version.major == 2 and ansible_version.minor < 7) or (ansible_version.major == 2 and ansible_version.minor == 7 and ansible_version.revision < 1)"
|
||||
|
||||
# Though we do not support Ansible 2.9.6 which is buggy
|
||||
- name: Fail if running on Ansible 2.9.6 on Ubuntu
|
||||
fail:
|
||||
msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed settings
|
||||
fail:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
- name: Ensure Docker's APT key is trusted
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
url: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"
|
||||
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||
state: present
|
||||
register: add_repository_key
|
||||
|
@ -20,7 +20,7 @@
|
|||
|
||||
- name: Ensure Docker repository is enabled
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
|
||||
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
name:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- gnupg
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
|
@ -19,7 +20,7 @@
|
|||
|
||||
- name: Ensure Docker repository is enabled
|
||||
apt_repository:
|
||||
repo: "deb [arch=armhf] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
||||
repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce'
|
||||
|
@ -27,7 +28,6 @@
|
|||
- name: Ensure APT packages are installed
|
||||
apt:
|
||||
name:
|
||||
- python-docker
|
||||
- "{{ matrix_ntpd_package }}"
|
||||
- fuse
|
||||
state: latest
|
||||
|
@ -37,5 +37,6 @@
|
|||
apt:
|
||||
name:
|
||||
- "{{ matrix_docker_package_name }}"
|
||||
- "python{{'3' if ansible_python.version.major == 3 else ''}}-docker"
|
||||
state: latest
|
||||
when: matrix_docker_installation_enabled|bool
|
||||
|
|
|
@ -19,31 +19,10 @@
|
|||
mode: '0660'
|
||||
when: "matrix_vars_yml_snapshotting_enabled|bool"
|
||||
|
||||
# `docker_network` doesn't work as expected when the given network
|
||||
# is a substring of a network that already exists.
|
||||
#
|
||||
# See:
|
||||
# - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/12
|
||||
# - https://github.com/ansible/ansible/issues/32926
|
||||
#
|
||||
# Due to that, we employ a workaround below.
|
||||
#
|
||||
# - name: Ensure Matrix network is created in Docker
|
||||
# docker_network:
|
||||
# name: "{{ matrix_docker_network }}"
|
||||
# driver: bridge
|
||||
|
||||
- name: Check existence of Matrix network in Docker
|
||||
shell:
|
||||
cmd: "docker network ls -q --filter='name=^{{ matrix_docker_network }}$'"
|
||||
register: result_check_docker_network
|
||||
changed_when: false
|
||||
check_mode: no
|
||||
|
||||
- name: Create Matrix network in Docker
|
||||
shell:
|
||||
cmd: "docker network create --driver=bridge {{ matrix_docker_network }}"
|
||||
when: "result_check_docker_network.stdout == '' and not ansible_check_mode"
|
||||
- name: Ensure Matrix network is created in Docker
|
||||
docker_network:
|
||||
name: "{{ matrix_docker_network }}"
|
||||
driver: bridge
|
||||
|
||||
- name: Ensure matrix-remove-all script created
|
||||
template:
|
||||
|
|
|
@ -21,6 +21,34 @@ matrix_bot_matrix_reminder_bot_systemd_required_services_list: ['docker.service'
|
|||
matrix_bot_matrix_reminder_bot_systemd_wanted_services_list: []
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_bot_matrix_reminder_bot_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_bot_matrix_reminder_bot_database_*` variables
|
||||
matrix_bot_matrix_reminder_bot_database_engine: 'sqlite'
|
||||
|
||||
matrix_bot_matrix_reminder_bot_sqlite_database_path_local: "{{ matrix_bot_matrix_reminder_bot_data_path }}/bot.db"
|
||||
matrix_bot_matrix_reminder_bot_sqlite_database_path_in_container: "/data/bot.db"
|
||||
|
||||
matrix_bot_matrix_reminder_bot_database_username: 'matrix_reminder_bot'
|
||||
matrix_bot_matrix_reminder_bot_database_password: 'some-password'
|
||||
matrix_bot_matrix_reminder_bot_database_hostname: 'matrix-postgres'
|
||||
matrix_bot_matrix_reminder_bot_database_port: 5432
|
||||
matrix_bot_matrix_reminder_bot_database_name: 'matrix_reminder_bot'
|
||||
|
||||
matrix_bot_matrix_reminder_bot_database_connection_string: 'postgres://{{ matrix_bot_matrix_reminder_bot_database_username }}:{{ matrix_bot_matrix_reminder_bot_database_password }}@{{ matrix_bot_matrix_reminder_bot_database_hostname }}:{{ matrix_bot_matrix_reminder_bot_database_port }}/{{ matrix_bot_matrix_reminder_bot_database_name }}'
|
||||
|
||||
matrix_bot_matrix_reminder_bot_storage_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite://' + matrix_bot_matrix_reminder_bot_sqlite_database_path_in_container),
|
||||
'postgres': matrix_bot_matrix_reminder_bot_database_connection_string,
|
||||
}[matrix_bot_matrix_reminder_bot_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# The bot's username. This user needs to be created manually beforehand.
|
||||
# Also see `matrix_bot_matrix_reminder_bot_user_password`.
|
||||
matrix_bot_matrix_reminder_bot_matrix_user_id_localpart: "bot.matrix-reminder-bot"
|
||||
|
|
|
@ -8,7 +8,14 @@
|
|||
- setup-all
|
||||
- setup-bot-matrix-reminder-bot
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup.yml"
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup|bool and matrix_bot_matrix_reminder_bot_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-matrix-reminder-bot
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup|bool and not matrix_bot_matrix_reminder_bot_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-matrix-reminder-bot
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up matrix-reminder-bot
|
||||
#
|
||||
|
||||
- name: Ensure matrix-reminder-bot paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_config_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_store_path }}", when: true }
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool and item.when
|
||||
|
||||
- name: Ensure matrix-reminder-bot image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_matrix_reminder_bot_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_bot_matrix_reminder_bot_docker_image_force_pull }}"
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool
|
||||
|
||||
- name: Ensure matrix-reminder-bot config installed
|
||||
copy:
|
||||
content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-reminder-bot.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
|
||||
mode: 0644
|
||||
register: matrix_bot_matrix_reminder_bot_systemd_service_result
|
||||
when: matrix_bot_matrix_reminder_bot_enabled|bool
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-matrix-reminder-bot.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_systemd_service_result.changed"
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of matrix-reminder-bot (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-matrix-reminder-bot service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-matrix-reminder-bot.service"
|
||||
register: matrix_bot_matrix_reminder_bot_service_stat
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot is stopped
|
||||
service:
|
||||
name: matrix-matrix-reminder-bot
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-matrix-reminder-bot.service"
|
||||
state: absent
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-matrix-reminder-bot.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool and matrix_bot_matrix_reminder_bot_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Matrix matrix-reminder-bot paths don't exist
|
||||
file:
|
||||
path: "{{ matrix_bot_matrix_reminder_bot_base_path }}"
|
||||
state: absent
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool"
|
||||
|
||||
- name: Ensure matrix-reminder-bot Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
state: absent
|
||||
when: "not matrix_bot_matrix_reminder_bot_enabled|bool"
|
73
roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml
Normal file
73
roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml
Normal file
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
|
||||
- set_fact:
|
||||
matrix_bot_matrix_reminder_bot_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}"
|
||||
register: matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_bot_matrix_reminder_bot_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-bot-matrix-reminder-bot.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_bot_matrix_reminder_bot_requires_restart: true
|
||||
when: "matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_bot_matrix_reminder_bot_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure matrix-reminder-bot paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_config_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_path }}", when: true }
|
||||
- { path: "{{ matrix_bot_matrix_reminder_bot_data_store_path }}", when: true }
|
||||
when: "item.when|bool"
|
||||
|
||||
- name: Ensure matrix-reminder-bot image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_matrix_reminder_bot_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_bot_matrix_reminder_bot_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure matrix-reminder-bot config installed
|
||||
copy:
|
||||
content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-reminder-bot.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-reminder-bot.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
|
||||
mode: 0644
|
||||
register: matrix_bot_matrix_reminder_bot_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed|bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-bot-matrix-reminder-bot.service"
|
||||
state: restarted
|
||||
when: "matrix_bot_matrix_reminder_bot_requires_restart|bool"
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
|
||||
- name: Check existence of matrix-matrix-reminder-bot service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
|
||||
register: matrix_bot_matrix_reminder_bot_service_stat
|
||||
|
||||
- name: Ensure matrix-matrix-reminder-bot is stopped
|
||||
service:
|
||||
name: matrix-matrix-reminder-bot
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
register: stopping_result
|
||||
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-reminder-bot.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service"
|
||||
state: absent
|
||||
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool"
|
||||
|
||||
- name: Ensure Matrix matrix-reminder-bot paths don't exist
|
||||
file:
|
||||
path: "{{ matrix_bot_matrix_reminder_bot_base_path }}"
|
||||
state: absent
|
||||
|
||||
- name: Ensure matrix-reminder-bot Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_reminder_bot_docker_image }}"
|
||||
state: absent
|
|
@ -23,7 +23,7 @@ storage:
|
|||
# For Postgres, this would look like:
|
||||
# database: "postgres://username:password@localhost/dbname?sslmode=disable"
|
||||
#database: "postgres://matrix-reminder-bot:remindme@localhost/matrix-reminder-bot?sslmode=disable"
|
||||
database: "sqlite:///data/bot.db"
|
||||
database: {{ matrix_bot_matrix_reminder_bot_storage_database|to_json }}
|
||||
# The path to a directory for internal bot storage
|
||||
# containing encryption keys, sync tokens, etc.
|
||||
store_path: "/data/store"
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_bot_matrix_reminder_bot_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -41,6 +41,30 @@ matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}"
|
|||
matrix_appservice_discord_bridge_disablePresence: false
|
||||
matrix_appservice_discord_bridge_enableSelfServiceBridging: false
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_appservice_discord_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_appservice_discord_postgres_*` variables
|
||||
matrix_appservice_discord_database_engine: 'sqlite'
|
||||
|
||||
matrix_appservice_discord_sqlite_database_path_local: "{{ matrix_appservice_discord_data_path }}/discord.db"
|
||||
matrix_appservice_discord_sqlite_database_path_in_container: "/data/discord.db"
|
||||
|
||||
matrix_appservice_discord_database_username: 'matrix_appservice_discord'
|
||||
matrix_appservice_discord_database_password: 'some-password'
|
||||
matrix_appservice_discord_database_hostname: 'matrix-postgres'
|
||||
matrix_appservice_discord_database_port: 5432
|
||||
matrix_appservice_discord_database_name: 'matrix_appservice_discord'
|
||||
|
||||
# These 2 variables are what actually ends up in the bridge configuration.
|
||||
# It's best if you don't change them directly, but rather redefine the sub-variables that constitute them.
|
||||
matrix_appservice_discord_database_filename: "{{ matrix_appservice_discord_sqlite_database_path_in_container }}"
|
||||
matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservice_discord_database_username }}:{{ matrix_appservice_discord_database_password }}@{{ matrix_appservice_discord_database_hostname }}:{{ matrix_appservice_discord_database_port }}/{{ matrix_appservice_discord_database_name }}'
|
||||
|
||||
|
||||
# Tells whether the bot should make use of "Privileged Gateway Intents".
|
||||
#
|
||||
# Enabling this means that you need to enable it for the bot (Discord application) as well,
|
||||
|
|
|
@ -1,5 +1,31 @@
|
|||
---
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_discord_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
|
||||
register: matrix_appservice_discord_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_appservice_discord_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_appservice_discord_database_connString }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_appservice_discord_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-appservice-discord.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_discord_requires_restart: true
|
||||
when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_appservice_discord_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Appservice Discord image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_discord_docker_image }}"
|
||||
|
@ -80,3 +106,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_appservice_discord_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-discord.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-appservice-discord.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_discord_requires_restart|bool"
|
||||
|
|
|
@ -20,3 +20,7 @@
|
|||
when: "item.old in vars"
|
||||
with_items:
|
||||
- {'old': 'matrix_appservice_discord_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_discord_container_http_host_bind_port>'}
|
||||
|
||||
- name: Require a valid database engine
|
||||
fail: msg="`matrix_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'"
|
||||
when: "matrix_appservice_discord_database_engine not in ['sqlite', 'postgres']"
|
||||
|
|
|
@ -58,8 +58,11 @@ database:
|
|||
# If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite
|
||||
# WARNING: You will almost certainly be fine with sqlite unless your bridge
|
||||
# is in heavy demand and you suffer from IO slowness.
|
||||
filename: "/data/discord.db"
|
||||
# connString: "postgresql://user:password@localhost/database_name"
|
||||
{% if matrix_appservice_discord_database_engine == 'sqlite' %}
|
||||
filename: {{ matrix_appservice_discord_database_filename|to_json }}
|
||||
{% else %}
|
||||
connString: {{ matrix_appservice_discord_database_connString|to_json }}
|
||||
{% endif %}
|
||||
room:
|
||||
# Set the default visibility of alias rooms, defaults to "public".
|
||||
# One of: "public", "private"
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_appservice_discord_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -16,6 +16,25 @@ matrix_appservice_irc_homeserver_domain: '{{ matrix_domain }}'
|
|||
matrix_appservice_irc_homeserver_enablePresence: true
|
||||
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: "{{
|
||||
{
|
||||
'nedb': 'nedb:///data',
|
||||
'postgres': matrix_appservice_irc_database_connection_string,
|
||||
}[matrix_appservice_irc_database_engine]
|
||||
}}"
|
||||
|
||||
matrix_appservice_irc_ircService_servers: []
|
||||
|
||||
# Example of `matrix_appservice_irc_ircService_servers` with one server (and all its options):
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
- name: Fail if Postgres not enabled
|
||||
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
|
||||
set_fact:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time|default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
timeout: "{{ postgres_start_wait_time }}"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "matrix_postgres_service_start_result.changed|bool"
|
||||
|
||||
- name: Ensure matrix-appservice-irc is stopped
|
||||
service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
|
||||
- name: Import appservice-irc NeDB database into Postgres
|
||||
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 }}'
|
||||
|
||||
- name: Archive NeDB database files
|
||||
command:
|
||||
cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
|
||||
- name: Inject result
|
||||
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."
|
||||
]
|
||||
}}
|
|
@ -1,12 +1,5 @@
|
|||
---
|
||||
|
||||
- name: Ensure Appservice IRC image is pulled
|
||||
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 }}"
|
||||
|
||||
- name: Ensure Appservice IRC paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
|
@ -24,25 +17,48 @@
|
|||
path: "{{ matrix_appservice_irc_base_path }}/passkey.pem"
|
||||
register: matrix_appservice_irc_stat_passkey
|
||||
|
||||
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
|
||||
service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
- block:
|
||||
- name: (Data relocation) Ensure matrix-appservice-irc.service is stopped
|
||||
service:
|
||||
name: matrix-appservice-irc
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
|
||||
- name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory
|
||||
command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem"
|
||||
|
||||
- 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 }}"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
failed_when: false
|
||||
when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory
|
||||
command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem"
|
||||
when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
- set_fact:
|
||||
matrix_appservice_irc_requires_restart: false
|
||||
|
||||
- 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 }}"
|
||||
with_items:
|
||||
- rooms.db
|
||||
- users.db
|
||||
failed_when: false
|
||||
when: "matrix_appservice_irc_stat_passkey.stat.exists"
|
||||
- block:
|
||||
- name: Check if a nedb database already exists
|
||||
stat:
|
||||
path: "{{ matrix_appservice_irc_data_path }}/users.db"
|
||||
register: matrix_appservice_irc_nedb_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_irc_requires_restart: true
|
||||
when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_appservice_irc_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Appservice IRC image is pulled
|
||||
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 }}"
|
||||
|
||||
- name: Ensure Matrix Appservice IRC config installed
|
||||
copy:
|
||||
|
@ -147,3 +163,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_appservice_irc_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-irc.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-appservice-irc.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_irc_requires_restart|bool"
|
||||
|
|
|
@ -127,8 +127,8 @@ advanced:
|
|||
# Use an external database to store bridge state.
|
||||
database:
|
||||
# database engine (must be 'postgres' or 'nedb'). Default: nedb
|
||||
engine: "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: "nedb:///data"
|
||||
connectionString: {{ matrix_appservice_irc_database_connectionString|to_json }}
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_appservice_irc_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -45,6 +45,26 @@ matrix_appservice_slack_appservice_token: ''
|
|||
matrix_appservice_slack_homeserver_token: ''
|
||||
matrix_appservice_slack_id_token: ''
|
||||
|
||||
matrix_appservice_slack_database_engine: nedb
|
||||
matrix_appservice_slack_database_username: matrix_appservice_slack
|
||||
matrix_appservice_slack_database_password: ~
|
||||
matrix_appservice_slack_database_hostname: 'matrix-postgres'
|
||||
matrix_appservice_slack_database_port: 5432
|
||||
matrix_appservice_slack_database_name: matrix_appservice_slack
|
||||
|
||||
# This is just the Postgres connection string, if Postgres is used.
|
||||
# Naming clashes with `matrix_appservice_slack_database_connectionString` somewhat.
|
||||
matrix_appservice_slack_database_connection_string: 'postgresql://{{ matrix_appservice_slack_database_username }}:{{ matrix_appservice_slack_database_password }}@{{ matrix_appservice_slack_database_hostname }}:{{ matrix_appservice_slack_database_port }}/{{ matrix_appservice_slack_database_name }}?sslmode=disable'
|
||||
|
||||
# This is what actually goes into `database.connectionString` for the bridge.
|
||||
matrix_appservice_slack_database_connectionString: "{{
|
||||
{
|
||||
'nedb': 'nedb:///data',
|
||||
'postgres': matrix_appservice_slack_database_connection_string,
|
||||
}[matrix_appservice_slack_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
matrix_appservice_slack_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
|
||||
|
||||
matrix_appservice_slack_configuration_extension_yaml: |
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
- name: Fail if Postgres not enabled
|
||||
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
|
||||
set_fact:
|
||||
postgres_start_wait_time: 15
|
||||
when: "postgres_start_wait_time|default('') == ''"
|
||||
|
||||
# Actual import work
|
||||
|
||||
- name: Ensure matrix-postgres is started
|
||||
service:
|
||||
name: matrix-postgres
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
register: matrix_postgres_service_start_result
|
||||
|
||||
- name: Wait a bit, so that Postgres can start
|
||||
wait_for:
|
||||
timeout: "{{ postgres_start_wait_time }}"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "matrix_postgres_service_start_result.changed|bool"
|
||||
|
||||
- name: Ensure matrix-appservice-slack is stopped
|
||||
service:
|
||||
name: matrix-appservice-slack
|
||||
state: stopped
|
||||
|
||||
- name: Import appservice-slack NeDB database into Postgres
|
||||
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_slack_data_path }},dst=/data
|
||||
--entrypoint=/bin/sh
|
||||
{{ matrix_appservice_slack_docker_image }}
|
||||
-c
|
||||
'/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}'
|
||||
|
||||
- name: Archive NeDB database files
|
||||
command:
|
||||
cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup"
|
||||
with_items:
|
||||
- teams.db
|
||||
- room-store.db
|
||||
- user-store.db
|
||||
- event-store.db
|
||||
|
||||
- name: Inject result
|
||||
set_fact:
|
||||
matrix_playbook_runtime_results: |
|
||||
{{
|
||||
matrix_playbook_runtime_results|default([])
|
||||
+
|
||||
[
|
||||
"NOTE: Your appservice-slack database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_slack_data_path }}/*.db` to `{{ matrix_appservice_slack_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."
|
||||
]
|
||||
}}
|
|
@ -1,12 +1,5 @@
|
|||
---
|
||||
|
||||
- name: Ensure Appservice Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_slack_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_slack_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure AppService Slack paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
|
@ -19,6 +12,30 @@
|
|||
- "{{ matrix_appservice_slack_config_path }}"
|
||||
- "{{ matrix_appservice_slack_data_path }}"
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_slack_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if a nedb database already exists
|
||||
stat:
|
||||
path: "{{ matrix_appservice_slack_data_path }}/teams.db"
|
||||
register: matrix_appservice_slack_nedb_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_appservice_slack_requires_restart: true
|
||||
when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_appservice_slack_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Appservice Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_appservice_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_slack_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_slack_docker_image_force_pull }}"
|
||||
|
||||
- name: Ensure Matrix Appservice Slack config installed
|
||||
copy:
|
||||
content: "{{ matrix_appservice_slack_configuration|to_nice_yaml }}"
|
||||
|
@ -46,3 +63,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_appservice_slack_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-appservice-slack.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-appservice-slack.service"
|
||||
state: restarted
|
||||
when: "matrix_appservice_slack_requires_restart|bool"
|
||||
|
|
|
@ -9,6 +9,12 @@ homeserver:
|
|||
url: "{{ matrix_appservice_slack_homeserver_url }}"
|
||||
server_name: "{{ matrix_domain }}"
|
||||
|
||||
{% if matrix_appservice_slack_database_engine == 'nedb' %}
|
||||
dbdir: "/data"
|
||||
{% else %}
|
||||
db:
|
||||
engine: {{ matrix_appservice_slack_database_engine|to_json }}
|
||||
connectionString: {{ matrix_appservice_slack_database_connectionString|to_json }}
|
||||
{% endif %}
|
||||
|
||||
matrix_admin_room: "{{ matrix_appservice_slack_control_room_id }}"
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_appservice_slack_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_appservice_webhooks_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -32,6 +32,35 @@ matrix_mautrix_facebook_systemd_wanted_services_list: []
|
|||
matrix_mautrix_facebook_appservice_token: ''
|
||||
matrix_mautrix_facebook_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_facebook_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_facebook_postgres_*` variables
|
||||
matrix_mautrix_facebook_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_facebook_sqlite_database_path_local: "{{ matrix_mautrix_facebook_data_path }}/mautrix-facebook.db"
|
||||
matrix_mautrix_facebook_sqlite_database_path_in_container: "/data/mautrix-facebook.db"
|
||||
|
||||
matrix_mautrix_facebook_database_username: 'matrix_mautrix_facebook'
|
||||
matrix_mautrix_facebook_database_password: 'some-password'
|
||||
matrix_mautrix_facebook_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_facebook_database_port: 5432
|
||||
matrix_mautrix_facebook_database_name: 'matrix_mautrix_facebook'
|
||||
|
||||
matrix_mautrix_facebook_database_connection_string: 'postgres://{{ matrix_mautrix_facebook_database_username }}:{{ matrix_mautrix_facebook_database_password }}@{{ matrix_mautrix_facebook_database_hostname }}:{{ matrix_mautrix_facebook_database_port }}/{{ matrix_mautrix_facebook_database_name }}'
|
||||
|
||||
matrix_mautrix_facebook_appservice_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite:///' + matrix_mautrix_facebook_sqlite_database_path_in_container),
|
||||
'postgres': matrix_mautrix_facebook_database_connection_string,
|
||||
}[matrix_mautrix_facebook_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_facebook_login_shared_secret: ''
|
||||
|
||||
|
|
|
@ -8,6 +8,32 @@
|
|||
The matrix-bridge-mautrix-facebook role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_facebook_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_facebook_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_facebook_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_facebook_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-facebook.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_facebook_requires_restart: true
|
||||
when: "matrix_mautrix_facebook_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_facebook_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Facebook image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_facebook_docker_image }}"
|
||||
|
@ -94,3 +120,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_facebook_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-facebook.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-facebook.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_facebook_requires_restart|bool"
|
||||
|
|
|
@ -27,7 +27,7 @@ appservice:
|
|||
# Format examples:
|
||||
# SQLite: sqlite:///filename.db
|
||||
# Postgres: postgres://username:password@hostname/dbname
|
||||
database: sqlite:////data/mautrix-facebook.db
|
||||
database: {{ matrix_mautrix_facebook_appservice_database|to_json }}
|
||||
|
||||
# Public part of web server for out-of-Matrix interaction with the bridge.
|
||||
public:
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mautrix_facebook_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -17,6 +18,7 @@ ExecStartPre={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-fac
|
|||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_mautrix_facebook_config_path }}:/config:z \
|
||||
-v {{ matrix_mautrix_facebook_data_path }}:/data:z \
|
||||
{{ matrix_mautrix_facebook_docker_image }} \
|
||||
|
|
|
@ -39,6 +39,35 @@ matrix_mautrix_hangouts_systemd_wanted_services_list: []
|
|||
matrix_mautrix_hangouts_appservice_token: ''
|
||||
matrix_mautrix_hangouts_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_hangouts_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_hangouts_postgres_*` variables
|
||||
matrix_mautrix_hangouts_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_hangouts_sqlite_database_path_local: "{{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db"
|
||||
matrix_mautrix_hangouts_sqlite_database_path_in_container: "/data/mautrix-hangouts.db"
|
||||
|
||||
matrix_mautrix_hangouts_database_username: 'matrix_mautrix_hangouts'
|
||||
matrix_mautrix_hangouts_database_password: 'some-password'
|
||||
matrix_mautrix_hangouts_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_hangouts_database_port: 5432
|
||||
matrix_mautrix_hangouts_database_name: 'matrix_mautrix_hangouts'
|
||||
|
||||
matrix_mautrix_hangouts_database_connection_string: 'postgres://{{ matrix_mautrix_hangouts_database_username }}:{{ matrix_mautrix_hangouts_database_password }}@{{ matrix_mautrix_hangouts_database_hostname }}:{{ matrix_mautrix_hangouts_database_port }}/{{ matrix_mautrix_hangouts_database_name }}'
|
||||
|
||||
matrix_mautrix_hangouts_appservice_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite:///' + matrix_mautrix_hangouts_sqlite_database_path_in_container),
|
||||
'postgres': matrix_mautrix_hangouts_database_connection_string,
|
||||
}[matrix_mautrix_hangouts_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_hangouts_login_shared_secret: ''
|
||||
|
||||
|
|
|
@ -8,6 +8,32 @@
|
|||
The matrix-bridge-mautrix-hangouts role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_hangouts_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_hangouts_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_hangouts_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-hangouts.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_hangouts_requires_restart: true
|
||||
when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_hangouts_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Hangouts image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_hangouts_docker_image }}"
|
||||
|
@ -93,3 +119,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_hangouts_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-hangouts.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-hangouts.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_hangouts_requires_restart|bool"
|
||||
|
|
|
@ -27,7 +27,7 @@ appservice:
|
|||
# Format examples:
|
||||
# SQLite: sqlite:///filename.db
|
||||
# Postgres: postgres://username:password@hostname/dbname
|
||||
database: sqlite:////data/mautrix-hangouts.db
|
||||
database: {{ matrix_mautrix_hangouts_appservice_database|to_json }}
|
||||
|
||||
# The unique ID of this appservice.
|
||||
id: hangouts
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mautrix_hangouts_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -17,6 +18,7 @@ ExecStartPre={{ matrix_host_command_docker }} run --rm --name matrix-mautrix-han
|
|||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_mautrix_hangouts_config_path }}:/config:z \
|
||||
-v {{ matrix_mautrix_hangouts_data_path }}:/data:z \
|
||||
{{ matrix_mautrix_hangouts_docker_image }} \
|
||||
|
|
95
roles/matrix-bridge-mautrix-signal/defaults/main.yml
Normal file
95
roles/matrix-bridge-mautrix-signal/defaults/main.yml
Normal file
|
@ -0,0 +1,95 @@
|
|||
# mautrix-signal is a Matrix <-> Signal bridge
|
||||
# See: https://github.com/tulir/mautrix-signal
|
||||
|
||||
matrix_mautrix_signal_enabled: true
|
||||
|
||||
# See: https://mau.dev/tulir/mautrix-signal/container_registry
|
||||
matrix_mautrix_signal_docker_image: "dock.mau.dev/tulir/mautrix-signal:latest"
|
||||
matrix_mautrix_signal_docker_image_force_pull: "{{ matrix_mautrix_signal_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_signal_daemon_docker_image: "dock.mau.dev/maunium/signald:latest"
|
||||
matrix_mautrix_signal_daemon_docker_image_force_pull: "{{ matrix_mautrix_signal_daemon_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_mautrix_signal_base_path: "{{ matrix_base_data_path }}/mautrix-signal"
|
||||
matrix_mautrix_signal_config_path: "{{ matrix_mautrix_signal_base_path }}/bridge"
|
||||
matrix_mautrix_signal_daemon_path: "{{ matrix_mautrix_signal_base_path }}/signald"
|
||||
|
||||
matrix_mautrix_signal_homeserver_address: ''
|
||||
matrix_mautrix_signal_homeserver_domain: ''
|
||||
matrix_mautrix_signal_appservice_address: 'http://matrix-mautrix-signal:29328'
|
||||
|
||||
# Controls whether the matrix-mautrix-signal container exposes its port (tcp/29328 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9006"), or empty string to not expose.
|
||||
matrix_mautrix_signal_container_http_host_bind_port: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_mautrix_signal_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-mautrix-signal.service depends on.
|
||||
matrix_mautrix_signal_systemd_required_services_list:
|
||||
- 'docker.service'
|
||||
- 'matrix-mautrix-signal-daemon.service'
|
||||
|
||||
# List of systemd services that matrix-mautrix-signal.service wants
|
||||
matrix_mautrix_signal_systemd_wanted_services_list: []
|
||||
|
||||
# List of systemd services that matrix-mautrix-signal-daemon.service depends on.
|
||||
matrix_mautrix_signal_daemon_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-mautrix-signal-daemon.service wants
|
||||
matrix_mautrix_signal_daemon_systemd_wanted_services_list: []
|
||||
|
||||
matrix_mautrix_signal_appservice_token: ''
|
||||
matrix_mautrix_signal_homeserver_token: ''
|
||||
|
||||
# Database-related configuration fields
|
||||
#
|
||||
# This bridge only supports postgres.
|
||||
#
|
||||
matrix_mautrix_signal_database_engine: 'postgres'
|
||||
|
||||
matrix_mautrix_signal_database_username: 'matrix_mautrix_signal'
|
||||
matrix_mautrix_signal_database_password: 'some-password'
|
||||
matrix_mautrix_signal_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_signal_database_port: 5432
|
||||
matrix_mautrix_signal_database_name: 'matrix_mautrix_signal'
|
||||
|
||||
matrix_mautrix_signal_database_connection_string: 'postgres://{{ matrix_mautrix_signal_database_username }}:{{ matrix_mautrix_signal_database_password }}@{{ matrix_mautrix_signal_database_hostname }}:{{ matrix_mautrix_signal_database_port }}/{{ matrix_mautrix_signal_database_name }}'
|
||||
|
||||
matrix_mautrix_signal_appservice_database: "{{
|
||||
{
|
||||
'postgres': matrix_mautrix_facebook_database_connection_string,
|
||||
}[matrix_mautrix_signal_database_engine]
|
||||
}}"
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_signal_login_shared_secret: ''
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
# For a more advanced customization, you can extend the default (see `matrix_mautrix_signal_configuration_extension_yaml`)
|
||||
# or completely replace this variable with your own template.
|
||||
matrix_mautrix_signal_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
|
||||
|
||||
matrix_mautrix_signal_configuration_extension_yaml: |
|
||||
# Your custom YAML configuration goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_mautrix_signal_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_mautrix_signal_configuration_yaml`.
|
||||
|
||||
matrix_mautrix_signal_configuration_extension: "{{ matrix_mautrix_signal_configuration_extension_yaml|from_yaml if matrix_mautrix_signal_configuration_extension_yaml|from_yaml is mapping else {} }}"
|
||||
|
||||
# Holds the final configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_mautrix_signal_configuration_yaml`.
|
||||
matrix_mautrix_signal_configuration: "{{ matrix_mautrix_signal_configuration_yaml|from_yaml|combine(matrix_mautrix_signal_configuration_extension, recursive=True) }}"
|
||||
|
||||
matrix_mautrix_signal_registration_yaml: "{{ lookup('template', 'templates/registration.yaml.j2') }}"
|
||||
|
||||
matrix_mautrix_signal_registration: "{{ matrix_mautrix_signal_registration_yaml|from_yaml }}"
|
||||
|
||||
matrix_mautrix_signal_log_level: 'DEBUG'
|
16
roles/matrix-bridge-mautrix-signal/tasks/init.yml
Normal file
16
roles/matrix-bridge-mautrix-signal/tasks/init.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-signal', 'matrix-mautrix-signal-daemon'] }}"
|
||||
when: matrix_mautrix_signal_enabled|bool
|
||||
|
||||
# If the matrix-synapse role is not used, these variables may not exist.
|
||||
- set_fact:
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{ matrix_synapse_container_extra_arguments|default([]) }}
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_mautrix_signal_config_path }}/registration.yaml,dst=/matrix-mautrix-signal-registration.yaml,ro"]
|
||||
|
||||
matrix_synapse_app_service_config_files: >
|
||||
{{ matrix_synapse_app_service_config_files|default([]) }}
|
||||
+
|
||||
{{ ["/matrix-mautrix-signal-registration.yaml"] }}
|
||||
when: matrix_mautrix_signal_enabled|bool
|
21
roles/matrix-bridge-mautrix-signal/tasks/main.yml
Normal file
21
roles/matrix-bridge-mautrix-signal/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup|bool and matrix_mautrix_signal_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-mautrix-signal
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup|bool and matrix_mautrix_signal_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-mautrix-signal
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup|bool and not matrix_mautrix_signal_enabled|bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-mautrix-signal
|
72
roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml
Normal file
72
roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml
Normal file
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
|
||||
# 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-mautrix-signal role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure Mautrix Signal image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_signal_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mautrix_signal_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_mautrix_signal_docker_image_force_pull }}"
|
||||
when: matrix_mautrix_signal_enabled|bool
|
||||
|
||||
- name: Ensure Mautrix Signal Daemon image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_signal_daemon_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mautrix_signal_daemon_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_mautrix_signal_docker_image_force_pull }}"
|
||||
when: matrix_mautrix_signal_enabled|bool
|
||||
|
||||
- name: Ensure Mautrix Signal paths exist
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- "{{ matrix_mautrix_signal_base_path }}"
|
||||
- "{{ matrix_mautrix_signal_config_path }}"
|
||||
- "{{ matrix_mautrix_signal_daemon_path }}"
|
||||
|
||||
- name: Ensure mautrix-signal config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mautrix_signal_configuration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_mautrix_signal_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure mautrix-signal registration.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mautrix_signal_registration|to_nice_yaml }}"
|
||||
dest: "{{ matrix_mautrix_signal_config_path }}/registration.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-mautrix-signal-daemon.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal-daemon.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service"
|
||||
mode: 0644
|
||||
register: matrix_mautrix_signal_daemon_systemd_service_result
|
||||
|
||||
- name: Ensure matrix-mautrix-signal.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service"
|
||||
mode: 0644
|
||||
register: matrix_mautrix_signal_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-mautrix-signal.service installation
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_signal_systemd_service_result.changed or matrix_mautrix_signal_daemon_systemd_service_result.changed"
|
45
roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml
Normal file
45
roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
|
||||
# Signal daemon service
|
||||
- name: Check existence of matrix-mautrix-signal-daemon service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service"
|
||||
register: matrix_mautrix_signal_daemon_service_stat
|
||||
|
||||
- name: Ensure matrix-mautrix-signal-daemon is stopped
|
||||
service:
|
||||
name: matrix-mautrix-signal-daemon
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_signal_daemon_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-mautrix-signal-daemon.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service"
|
||||
state: absent
|
||||
when: "matrix_mautrix_signal_daemon_service_stat.stat.exists"
|
||||
|
||||
# Bridge service
|
||||
- name: Check existence of matrix-mautrix-signal service
|
||||
stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service"
|
||||
register: matrix_mautrix_signal_service_stat
|
||||
|
||||
- name: Ensure matrix-mautrix-signal is stopped
|
||||
service:
|
||||
name: matrix-mautrix-signal
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_signal_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-mautrix-signal.service doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service"
|
||||
state: absent
|
||||
when: "matrix_mautrix_signal_service_stat.stat.exists"
|
||||
|
||||
# All services
|
||||
- name: Ensure systemd reloaded after matrix-mautrix-signal_X.service removal
|
||||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_signal_service_stat.stat.exists or matrix_mautrix_signal_daemon_service_stat.stat.exists"
|
28
roles/matrix-bridge-mautrix-signal/tasks/validate_config.yml
Normal file
28
roles/matrix-bridge-mautrix-signal/tasks/validate_config.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
|
||||
- name: Fail if required settings not defined
|
||||
fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_mautrix_signal_homeserver_domain"
|
||||
- "matrix_mautrix_signal_homeserver_address"
|
||||
- "matrix_mautrix_signal_homeserver_token"
|
||||
- "matrix_mautrix_signal_appservice_token"
|
||||
|
||||
- name: (Deprecation) Catch and report renamed Signal variables
|
||||
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_mautrix_signal_container_exposed_port_number', 'new': '<superseded by matrix_mautrix_signal_container_http_host_bind_port>'}
|
||||
- {'old': 'matrix_mautrix_signal_db_user', 'new': 'matrix_mautrix_signal_database_username'}
|
||||
- {'old': 'matrix_mautrix_signal_db_password', 'new': 'matrix_mautrix_signal_database_password'}
|
||||
- {'old': 'matrix_mautrix_signal_db_database', 'new': 'matrix_mautrix_signal_database_name'}
|
||||
- {'old': 'matrix_mautrix_signal_db_host', 'new': 'matrix_mautrix_signal_database_hostname'}
|
||||
- {'old': 'matrix_mautrix_signal_db_port', 'new': 'matrix_mautrix_signal_database_port'}
|
||||
- {'old': 'matrix_mautrix_signal_db_url', 'new': 'matrix_mautrix_signal_database_connection_string'}
|
||||
- {'old': 'matrix_mautrix_signal_configuration_permissions', 'new': '<superseded by matrix_mautrix_signal_configuration_extension_yaml>'}
|
202
roles/matrix-bridge-mautrix-signal/templates/config.yaml.j2
Normal file
202
roles/matrix-bridge-mautrix-signal/templates/config.yaml.j2
Normal file
|
@ -0,0 +1,202 @@
|
|||
#jinja2: lstrip_blocks: "True"
|
||||
# Homeserver details
|
||||
homeserver:
|
||||
# The address that this appservice can use to connect to the homeserver.
|
||||
address: {{ matrix_mautrix_signal_homeserver_address }}
|
||||
# The domain of the homeserver (for MXIDs, etc).
|
||||
domain: {{ matrix_mautrix_signal_homeserver_domain }}
|
||||
# Whether or not to verify the SSL certificate of the homeserver.
|
||||
# Only applies if address starts with https://
|
||||
verify_ssl: true
|
||||
asmux: false
|
||||
|
||||
# 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_signal_appservice_address }}
|
||||
# When using https:// the TLS certificate and key files for the address.
|
||||
tls_cert: false
|
||||
tls_key: false
|
||||
|
||||
# The hostname and port where this appservice should listen.
|
||||
hostname: 0.0.0.0
|
||||
port: 29328
|
||||
# The maximum body size of appservice API requests (from the homeserver) in mebibytes
|
||||
# Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
|
||||
max_body_size: 1
|
||||
|
||||
# The full URI to the database. Only Postgres is currently supported.
|
||||
database: {{ matrix_mautrix_signal_database_connection_string }}
|
||||
|
||||
# Provisioning API part of the web server for automated portal creation and fetching information.
|
||||
# Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
|
||||
provisioning:
|
||||
# Whether or not the provisioning API should be enabled.
|
||||
enabled: true
|
||||
# The prefix to use in the provisioning API endpoints.
|
||||
prefix: /_matrix/provision/v1
|
||||
# The shared secret to authorize users of the API.
|
||||
# Set to "generate" to generate and save a new token.
|
||||
shared_secret: generate
|
||||
|
||||
# The unique ID of this appservice.
|
||||
id: signal
|
||||
# Username of the appservice bot.
|
||||
bot_username: signalbot
|
||||
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
|
||||
# to leave display name/avatar as-is.
|
||||
bot_displayname: Signal bridge bot
|
||||
bot_avatar: mxc://maunium.net/wPJgTQbZOtpBFmDNkiNEMDUp
|
||||
|
||||
# Community ID for bridged users (changes registration file) and rooms.
|
||||
# Must be created manually.
|
||||
#
|
||||
# Example: "+signal:example.com". Set to false to disable.
|
||||
community_id: false
|
||||
|
||||
# Authentication tokens for AS <-> HS communication.
|
||||
as_token: "{{ matrix_mautrix_signal_appservice_token }}"
|
||||
hs_token: "{{ matrix_mautrix_signal_homeserver_token }}"
|
||||
|
||||
# Prometheus telemetry config. Requires prometheus-client to be installed.
|
||||
metrics:
|
||||
enabled: false
|
||||
listen_port: 8000
|
||||
|
||||
signal:
|
||||
# Path to signald unix socket
|
||||
socket_path: /signald/signald.sock
|
||||
# Directory for temp files when sending files to Signal. This should be an
|
||||
# absolute path that signald can read. For attachments in the other direction,
|
||||
# make sure signald is configured to use an absolute path as the data directory.
|
||||
outgoing_attachment_dir: /signald/attachments
|
||||
# Directory where signald stores avatars for groups.
|
||||
avatar_dir: /signald/avatars
|
||||
# Directory where signald stores auth data. Used to delete data when logging out.
|
||||
data_dir: /signald/data
|
||||
# Whether or not message attachments should be removed from disk after they're bridged.
|
||||
remove_file_after_handling: true
|
||||
|
||||
# Bridge config
|
||||
bridge:
|
||||
# Localpart template of MXIDs for Signal users.
|
||||
# {userid} is replaced with an identifier for the Signal user.
|
||||
username_template: "signal_{userid}"
|
||||
# Displayname template for Signal users.
|
||||
# {displayname} is replaced with the displayname of the Signal user, which is the first
|
||||
# available variable in displayname_preference. The variables in displayname_preference
|
||||
# can also be used here directly.
|
||||
displayname_template: "{displayname} (Signal)"
|
||||
# Whether or not contact list displaynames should be used.
|
||||
# Using this isn't recommended on multi-user instances.
|
||||
allow_contact_list_name_updates: false
|
||||
# Available variables: full_name, first_name, last_name, phone, uuid
|
||||
displayname_preference:
|
||||
- full_name
|
||||
- phone
|
||||
|
||||
# Whether or not to create portals for all groups on login/connect.
|
||||
autocreate_group_portal: true
|
||||
# Whether or not to create portals for all contacts on login/connect.
|
||||
autocreate_contact_portal: false
|
||||
# Whether or not to use /sync to get read receipts and typing notifications
|
||||
# when double puppeting is enabled
|
||||
sync_with_custom_puppets: true
|
||||
# Whether or not to update the m.direct account data event when double puppeting is enabled.
|
||||
# Note that updating the m.direct event is not atomic (except with mautrix-asmux)
|
||||
# and is therefore prone to race conditions.
|
||||
sync_direct_chat_list: false
|
||||
# Allow using double puppeting from any server with a valid client .well-known file.
|
||||
double_puppet_allow_discovery: false
|
||||
# Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
|
||||
double_puppet_server_map: {}
|
||||
# Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
|
||||
#
|
||||
# If set, custom puppets will be enabled automatically for local users
|
||||
# instead of users having to find an access token and run `login-matrix`
|
||||
# manually.
|
||||
# If using this for other servers than the bridge's server,
|
||||
# you must also set the URL in the double_puppet_server_map.
|
||||
login_shared_secret_map:
|
||||
{{ matrix_mautrix_signal_homeserver_domain }}: {{ matrix_mautrix_signal_login_shared_secret|to_json }}
|
||||
# Whether or not created rooms should have federation enabled.
|
||||
# If false, created portal rooms will never be federated.
|
||||
federate_rooms: true
|
||||
# End-to-bridge encryption support options. These require matrix-nio to be installed with pip
|
||||
# and login_shared_secret to be configured in order to get a device for the bridge bot.
|
||||
#
|
||||
# Additionally, https://github.com/matrix-org/synapse/pull/5758 is required if using a normal
|
||||
# application service.
|
||||
encryption:
|
||||
# Allow encryption, work in group chat rooms with e2ee enabled
|
||||
allow: false
|
||||
# Default to encryption, force-enable encryption in all portals the bridge creates
|
||||
# This will cause the bridge bot to be in private chats for the encryption to work properly.
|
||||
default: false
|
||||
# Options for automatic key sharing.
|
||||
key_sharing:
|
||||
# Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
|
||||
# You must use a client that supports requesting keys from other users to use this feature.
|
||||
allow: false
|
||||
# Require the requesting device to have a valid cross-signing signature?
|
||||
# This doesn't require that the bridge has verified the device, only that the user has verified it.
|
||||
# Not yet implemented.
|
||||
require_cross_signing: false
|
||||
# Require devices to be verified by the bridge?
|
||||
# Verification by the bridge is not yet implemented.
|
||||
require_verification: true
|
||||
# Whether or not to explicitly set the avatar and room name for private
|
||||
# chat portal rooms. This will be implicitly enabled if encryption.default is true.
|
||||
private_chat_portal_meta: false
|
||||
# Whether or not the bridge should send a read receipt from the bridge bot when a message has
|
||||
# been sent to Signal. This let's you check manually whether the bridge is receiving your
|
||||
# messages.
|
||||
# Note that this is not related to Signal delivery receipts.
|
||||
delivery_receipts: false
|
||||
# Whether or not delivery errors should be reported as messages in the Matrix room. (not yet implemented)
|
||||
delivery_error_reports: false
|
||||
# Set this to true to tell the bridge to re-send m.bridge events to all rooms on the next run.
|
||||
# This field will automatically be changed back to false after it,
|
||||
# except if the config file is not writable.
|
||||
resend_bridge_info: false
|
||||
|
||||
# The prefix for commands. Only required in non-management rooms.
|
||||
command_prefix: "!signal"
|
||||
|
||||
# Permissions for using the bridge.
|
||||
# Permitted values:
|
||||
# user - Use the bridge with puppeting.
|
||||
# admin - Use and administrate the bridge.
|
||||
# Permitted keys:
|
||||
# * - All Matrix users
|
||||
# domain - All users on that homeserver
|
||||
# mxid - Specific user
|
||||
permissions:
|
||||
'{{ matrix_mautrix_signal_homeserver_domain }}': user
|
||||
|
||||
|
||||
# Python logging configuration.
|
||||
#
|
||||
# See section 16.7.2 of the Python documentation for more info:
|
||||
# https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
|
||||
logging:
|
||||
version: 1
|
||||
formatters:
|
||||
colored:
|
||||
(): mautrix_signal.util.ColorFormatter
|
||||
format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
|
||||
normal:
|
||||
format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
|
||||
handlers:
|
||||
console:
|
||||
class: logging.StreamHandler
|
||||
formatter: colored
|
||||
loggers:
|
||||
mau:
|
||||
level: {{ matrix_mautrix_signal_log_level }}
|
||||
aiohttp:
|
||||
level: INFO
|
||||
root:
|
||||
level: {{ matrix_mautrix_signal_log_level }}
|
||||
handlers: [console]
|
|
@ -0,0 +1,14 @@
|
|||
#jinja2: lstrip_blocks: "True"
|
||||
id: signal
|
||||
as_token: "{{ matrix_mautrix_signal_appservice_token }}"
|
||||
hs_token: "{{ matrix_mautrix_signal_homeserver_token }}"
|
||||
namespaces:
|
||||
users:
|
||||
- exclusive: true
|
||||
regex: '^@signal_.+:{{ matrix_mautrix_signal_homeserver_domain|regex_escape }}$'
|
||||
aliases:
|
||||
- exclusive: true
|
||||
regex: '^#signal_.+:{{ matrix_mautrix_signal_homeserver_domain|regex_escape }}$'
|
||||
url: {{ matrix_mautrix_signal_appservice_address }}
|
||||
sender_localpart: signalbot
|
||||
rate_limited: false
|
|
@ -0,0 +1,38 @@
|
|||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Mautrix Signal daemon
|
||||
|
||||
{% for service in matrix_mautrix_signal_daemon_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
{% for service in matrix_mautrix_signal_daemon_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-mautrix-signal-daemon
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-mautrix-signal-daemon
|
||||
|
||||
# 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-mautrix-signal-daemon \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--network={{ matrix_docker_network }} \
|
||||
-v {{ matrix_mautrix_signal_daemon_path }}:/signald:z \
|
||||
{{ matrix_mautrix_signal_daemon_docker_image }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_docker }} kill matrix-mautrix-signal-daemon
|
||||
ExecStop=-{{ matrix_host_command_docker }} rm matrix-mautrix-signal-daemon
|
||||
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-mautrix-signal-daemon
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,44 @@
|
|||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Mautrix Signal server
|
||||
|
||||
{% for service in matrix_mautrix_signal_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
{% for service in matrix_mautrix_signal_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-mautrix-signal
|
||||
ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-mautrix-signal
|
||||
|
||||
# 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-mautrix-signal \
|
||||
--log-driver=none \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{% if matrix_mautrix_signal_container_http_host_bind_port %}
|
||||
-p {{ matrix_mautrix_signal_container_http_host_bind_port }}:29328 \
|
||||
{% endif %}
|
||||
-v {{ matrix_mautrix_signal_daemon_path }}:/signald:z \
|
||||
-v {{ matrix_mautrix_signal_config_path }}:/data:z \
|
||||
{% for arg in matrix_mautrix_signal_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_mautrix_signal_docker_image }} \
|
||||
python3 -m mautrix_signal -c /data/config.yaml
|
||||
|
||||
ExecStop=-{{ matrix_host_command_docker }} kill matrix-mautrix-signal
|
||||
ExecStop=-{{ matrix_host_command_docker }} rm matrix-mautrix-signal
|
||||
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-mautrix-signal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -43,6 +43,35 @@ matrix_mautrix_telegram_systemd_wanted_services_list: []
|
|||
matrix_mautrix_telegram_appservice_token: ''
|
||||
matrix_mautrix_telegram_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_telegram_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_telegram_postgres_*` variables
|
||||
matrix_mautrix_telegram_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_telegram_sqlite_database_path_local: "{{ matrix_mautrix_telegram_data_path }}/mautrix-telegram.db"
|
||||
matrix_mautrix_telegram_sqlite_database_path_in_container: "/data/mautrix-telegram.db"
|
||||
|
||||
matrix_mautrix_telegram_database_username: 'matrix_mautrix_telegram'
|
||||
matrix_mautrix_telegram_database_password: 'some-password'
|
||||
matrix_mautrix_telegram_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_telegram_database_port: 5432
|
||||
matrix_mautrix_telegram_database_name: 'matrix_mautrix_telegram'
|
||||
|
||||
matrix_mautrix_telegram_database_connection_string: 'postgres://{{ matrix_mautrix_telegram_database_username }}:{{ matrix_mautrix_telegram_database_password }}@{{ matrix_mautrix_telegram_database_hostname }}:{{ matrix_mautrix_telegram_database_port }}/{{ matrix_mautrix_telegram_database_name }}'
|
||||
|
||||
matrix_mautrix_telegram_appservice_database: "{{
|
||||
{
|
||||
'sqlite': ('sqlite:///' + matrix_mautrix_telegram_sqlite_database_path_in_container),
|
||||
'postgres': matrix_mautrix_telegram_database_connection_string,
|
||||
}[matrix_mautrix_telegram_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_telegram_login_shared_secret: ''
|
||||
|
||||
|
|
|
@ -8,6 +8,32 @@
|
|||
The matrix-bridge-mautrix-telegram role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_telegram_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_telegram_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_telegram_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_telegram_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-telegram.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_telegram_requires_restart: true
|
||||
when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_telegram_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Telegram image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_telegram_docker_image }}"
|
||||
|
@ -71,3 +97,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_telegram_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-telegram.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-telegram.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_telegram_requires_restart|bool"
|
||||
|
|
|
@ -27,7 +27,7 @@ appservice:
|
|||
# Format examples:
|
||||
# SQLite: sqlite:///filename.db
|
||||
# Postgres: postgres://username:password@hostname/dbname
|
||||
database: sqlite:////data/mautrix-telegram.db
|
||||
database: {{ matrix_mautrix_telegram_appservice_database|to_json }}
|
||||
|
||||
# Public part of web server for out-of-Matrix interaction with the bridge.
|
||||
# Used for things like login if the user wants to make sure the 2FA password isn't stored in
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mautrix_telegram_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -27,6 +27,42 @@ matrix_mautrix_whatsapp_systemd_wanted_services_list: []
|
|||
matrix_mautrix_whatsapp_appservice_token: ''
|
||||
matrix_mautrix_whatsapp_homeserver_token: ''
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_mautrix_whatsapp_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_mautrix_whatsapp_postgres_*` variables
|
||||
matrix_mautrix_whatsapp_database_engine: 'sqlite'
|
||||
|
||||
matrix_mautrix_whatsapp_sqlite_database_path_local: "{{ matrix_mautrix_whatsapp_data_path }}/mautrix-whatsapp.db"
|
||||
matrix_mautrix_whatsapp_sqlite_database_path_in_container: "/data/mautrix-whatsapp.db"
|
||||
|
||||
matrix_mautrix_whatsapp_database_username: 'matrix_mautrix_whatsapp'
|
||||
matrix_mautrix_whatsapp_database_password: 'some-password'
|
||||
matrix_mautrix_whatsapp_database_hostname: 'matrix-postgres'
|
||||
matrix_mautrix_whatsapp_database_port: 5432
|
||||
matrix_mautrix_whatsapp_database_name: 'matrix_mautrix_whatsapp'
|
||||
|
||||
matrix_mautrix_whatsapp_database_connection_string: 'postgresql://{{ matrix_mautrix_whatsapp_database_username }}:{{ matrix_mautrix_whatsapp_database_password }}@{{ matrix_mautrix_whatsapp_database_hostname }}:{{ matrix_mautrix_whatsapp_database_port }}/{{ matrix_mautrix_whatsapp_database_name }}?sslmode=disable'
|
||||
|
||||
matrix_mautrix_whatsapp_appservice_database_type: "{{
|
||||
{
|
||||
'sqlite': 'sqlite3',
|
||||
'postgres':'postgres',
|
||||
}[matrix_mautrix_whatsapp_database_engine]
|
||||
}}"
|
||||
|
||||
matrix_mautrix_whatsapp_appservice_database_uri: "{{
|
||||
{
|
||||
'sqlite': matrix_mautrix_whatsapp_sqlite_database_path_in_container,
|
||||
'postgres': matrix_mautrix_whatsapp_database_connection_string,
|
||||
}[matrix_mautrix_whatsapp_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mautrix_whatsapp_login_shared_secret: ''
|
||||
|
||||
|
|
|
@ -8,6 +8,32 @@
|
|||
The matrix-bridge-mautrix-whatsapp role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_whatsapp_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}"
|
||||
register: matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_whatsapp_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mautrix_whatsapp_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mautrix-whatsapp.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mautrix_whatsapp_requires_restart: true
|
||||
when: "matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mautrix_whatsapp_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure Mautrix Whatsapp image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mautrix_whatsapp_docker_image }}"
|
||||
|
@ -80,3 +106,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mautrix_whatsapp_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-whatsapp.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mautrix-whatsapp.service"
|
||||
state: restarted
|
||||
when: "matrix_mautrix_whatsapp_requires_restart|bool"
|
||||
|
|
|
@ -19,11 +19,11 @@ appservice:
|
|||
# Database config.
|
||||
database:
|
||||
# The database type. "sqlite3" and "postgres" are supported.
|
||||
type: sqlite3
|
||||
type: {{ matrix_mautrix_whatsapp_appservice_database_type|to_json }}
|
||||
# The database URI.
|
||||
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
|
||||
# Postgres: Connection string. For example, postgres://user:password@host/database
|
||||
uri: mautrix-whatsapp.db
|
||||
uri: {{ matrix_mautrix_whatsapp_appservice_database_uri|to_json }}
|
||||
# Maximum number of connections. Mostly relevant for Postgres.
|
||||
max_open_conns: 20
|
||||
max_idle_conns: 2
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mautrix_whatsapp_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -55,6 +55,20 @@ matrix_mx_puppet_discord_homeserver_token: ''
|
|||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_discord_login_shared_secret: ''
|
||||
|
||||
# Database configuration
|
||||
matrix_mx_puppet_discord_database_engine: 'sqlite'
|
||||
|
||||
matrix_mx_puppet_discord_sqlite_database_path_local: "{{ matrix_mx_puppet_discord_data_path }}/database.db"
|
||||
matrix_mx_puppet_discord_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_discord_database_username: matrix_mx_puppet_discord
|
||||
matrix_mx_puppet_discord_database_password: ~
|
||||
matrix_mx_puppet_discord_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_discord_database_port: 5432
|
||||
matrix_mx_puppet_discord_database_name: matrix_mx_puppet_discord
|
||||
|
||||
matrix_mx_puppet_discord_database_connection_string: 'postgresql://{{ matrix_mx_puppet_discord_database_username }}:{{ matrix_mx_puppet_discord_database_password }}@{{ matrix_mx_puppet_discord_database_hostname }}:{{ matrix_mx_puppet_discord_database_port }}/{{ matrix_mx_puppet_discord_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
The matrix-bridge-mx-puppet-discord role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Discord image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_discord_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_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_mx_puppet_discord_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_discord_enabled|bool and not matrix_mx_puppet_discord_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Discord paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
@ -30,6 +22,57 @@
|
|||
- { path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}", when: "{{ matrix_mx_puppet_discord_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_discord_enabled|bool and item.when|bool
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_discord_stat_database
|
||||
|
||||
- block:
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-discord
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: False
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-discord database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_discord_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_discord_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_discord_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_discord_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-discord.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_discord_requires_restart: true
|
||||
when: "matrix_mx_puppet_discord_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_discord_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Discord image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_discord_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_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_mx_puppet_discord_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_discord_enabled|bool and not matrix_mx_puppet_discord_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Discord repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_discord_container_image_self_build_repo }}"
|
||||
|
@ -49,23 +92,6 @@
|
|||
pull: yes
|
||||
when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build|bool"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_discord_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_discord_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-discord
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-discord database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_discord_stat_database.stat.exists"
|
||||
|
||||
- name: Ensure mx-puppet-discord config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_discord_configuration|to_nice_yaml }}"
|
||||
|
@ -93,3 +119,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_discord_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-discord.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-discord.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_discord_requires_restart|bool"
|
||||
|
|
|
@ -100,15 +100,18 @@ namePatterns:
|
|||
group: :name
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_discord_database_engine == 'sqlite' %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: {{ matrix_mx_puppet_discord_sqlite_database_path_in_container|to_json }}
|
||||
{% else %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
connString: {{ matrix_mx_puppet_discord_database_connection_string|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mx_puppet_discord_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -46,6 +46,19 @@ matrix_mx_puppet_instagram_homeserver_token: ''
|
|||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_instagram_login_shared_secret: ''
|
||||
|
||||
matrix_mx_puppet_instagram_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_instagram_sqlite_database_path_local: "{{ matrix_mx_puppet_instagram_data_path }}/database.db"
|
||||
matrix_mx_puppet_instagram_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_instagram_database_username: matrix_mx_puppet_instagram
|
||||
matrix_mx_puppet_instagram_database_password: ~
|
||||
matrix_mx_puppet_instagram_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_instagram_database_port: 5432
|
||||
matrix_mx_puppet_instagram_database_name: matrix_mx_puppet_instagram
|
||||
|
||||
matrix_mx_puppet_instagram_database_connection_string: 'postgresql://{{ matrix_mx_puppet_instagram_database_username }}:{{ matrix_mx_puppet_instagram_database_password }}@{{ matrix_mx_puppet_instagram_database_hostname }}:{{ matrix_mx_puppet_instagram_database_port }}/{{ matrix_mx_puppet_instagram_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
|
|
@ -8,6 +8,33 @@
|
|||
The matrix-bridge-mx-puppet-instagram role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_instagram_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_instagram_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_instagram_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-instagram.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_instagram_requires_restart: true
|
||||
when: "matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_instagram_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure mx-puppet-instagram image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_instagram_docker_image }}"
|
||||
|
@ -77,4 +104,8 @@
|
|||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_instagram_systemd_service_result.changed"
|
||||
|
||||
|
||||
- name: Ensure matrix-mx-puppet-instagram.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-instagram.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_instagram_requires_restart|bool"
|
||||
|
|
|
@ -44,15 +44,18 @@ provisioning:
|
|||
apiPrefix: /_matrix/provision
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_instagram_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_instagram_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_instagram_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mx_puppet_instagram_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -53,6 +53,20 @@ matrix_mx_puppet_skype_homeserver_token: ''
|
|||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_skype_login_shared_secret: ''
|
||||
|
||||
# Database configuration, role default is `sqlite` but playbook default is `postgres`
|
||||
matrix_mx_puppet_skype_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_skype_sqlite_database_path_local: "{{ matrix_mx_puppet_skype_data_path }}/database.db"
|
||||
matrix_mx_puppet_skype_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_skype_database_username: matrix_mx_puppet_skype
|
||||
matrix_mx_puppet_skype_database_password: ~
|
||||
matrix_mx_puppet_skype_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_skype_database_port: 5432
|
||||
matrix_mx_puppet_skype_database_name: matrix_mx_puppet_skype
|
||||
|
||||
matrix_mx_puppet_skype_database_connection_string: 'postgresql://{{ matrix_mx_puppet_skype_database_username }}:{{ matrix_mx_puppet_skype_database_password }}@{{ matrix_mx_puppet_skype_database_hostname }}:{{ matrix_mx_puppet_skype_database_port }}/{{ matrix_mx_puppet_skype_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
The matrix-bridge-mx-puppet-skype role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Skype image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_skype_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_skype_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_mx_puppet_skype_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_skype_enabled|bool and not matrix_mx_puppet_skype_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Skype paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
@ -30,6 +22,57 @@
|
|||
- { path: "{{ matrix_mx_puppet_skype_docker_src_files_path }}", when: "{{ matrix_mx_puppet_skype_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_skype_enabled|bool and item.when|bool
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_skype_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_skype_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-skype.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-skype
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_skype_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-skype database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_skype_base_path }}/database.db {{ matrix_mx_puppet_skype_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_skype_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_skype_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_skype_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_skype_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_skype_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_skype_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_skype_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-skype.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_skype_requires_restart: true
|
||||
when: "matrix_mx_puppet_skype_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_skype_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Skype image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_skype_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_skype_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_mx_puppet_skype_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_skype_enabled|bool and not matrix_mx_puppet_skype_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Skype repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_skype_container_image_self_build_repo }}"
|
||||
|
@ -49,23 +92,6 @@
|
|||
pull: yes
|
||||
when: "matrix_mx_puppet_skype_enabled|bool and matrix_mx_puppet_skype_container_image_self_build|bool"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_skype_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_skype_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-skype.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-skype
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_skype_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-skype database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_skype_base_path }}/database.db {{ matrix_mx_puppet_skype_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_skype_stat_database.stat.exists"
|
||||
|
||||
- name: Ensure mx-puppet-skype config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_skype_configuration|to_nice_yaml }}"
|
||||
|
@ -93,3 +119,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_skype_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-skype.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-skype.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_skype_requires_restart|bool"
|
||||
|
|
|
@ -68,15 +68,18 @@ logging:
|
|||
# - Store
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_skype_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_skype_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_skype_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
provisioning:
|
||||
# Regex of Matrix IDs allowed to use the puppet bridge
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mx_puppet_skype_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -57,6 +57,20 @@ matrix_mx_puppet_slack_homeserver_token: ''
|
|||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_slack_login_shared_secret: ''
|
||||
|
||||
# Database configuration, role uses 'sqlite' per default but playbook sets up postgres by default
|
||||
matrix_mx_puppet_slack_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_slack_sqlite_database_path_local: "{{ matrix_mx_puppet_slack_data_path }}/database.db"
|
||||
matrix_mx_puppet_slack_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_slack_database_username: matrix_mx_puppet_slack
|
||||
matrix_mx_puppet_slack_database_password: ~
|
||||
matrix_mx_puppet_slack_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_slack_database_port: 5432
|
||||
matrix_mx_puppet_slack_database_name: matrix_mx_puppet_slack
|
||||
|
||||
matrix_mx_puppet_slack_database_connection_string: 'postgresql://{{ matrix_mx_puppet_slack_database_username }}:{{ matrix_mx_puppet_slack_database_password }}@{{ matrix_mx_puppet_slack_database_hostname }}:{{ matrix_mx_puppet_slack_database_port }}/{{ matrix_mx_puppet_slack_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
The matrix-bridge-mx-puppet-slack role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_slack_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_mx_puppet_slack_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_slack_enabled|bool and not matrix_mx_puppet_slack_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Slack paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
@ -30,6 +22,53 @@
|
|||
- { path: "{{ matrix_mx_puppet_slack_docker_src_files_path }}", when: "{{ matrix_mx_puppet_slack_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_slack_enabled|bool and item.when|bool
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_slack_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_slack_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-slack.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-slack
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_slack_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_slack_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_slack_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_slack_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_slack_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-slack.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_slack_requires_restart: true
|
||||
when: "matrix_mx_puppet_slack_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_slack_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Slack image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_slack_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_slack_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_mx_puppet_slack_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_slack_enabled|bool and not matrix_mx_puppet_slack_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Slack repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_slack_container_image_self_build_repo }}"
|
||||
|
@ -49,19 +88,6 @@
|
|||
pull: yes
|
||||
when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_slack_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_slack_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-slack.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-slack
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_slack_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-slack database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_slack_base_path }}/database.db {{ matrix_mx_puppet_slack_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_slack_stat_database.stat.exists"
|
||||
|
@ -93,3 +119,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_slack_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-slack.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-slack.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_slack_requires_restart|bool"
|
||||
|
|
|
@ -58,15 +58,18 @@ provisioning:
|
|||
apiPrefix: /_matrix/provision
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_slack_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_slack_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_slack_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mx_puppet_slack_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -55,6 +55,19 @@ matrix_mx_puppet_steam_homeserver_token: ''
|
|||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_steam_login_shared_secret: ''
|
||||
|
||||
matrix_mx_puppet_steam_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_steam_sqlite_database_path_local: "{{ matrix_mx_puppet_steam_data_path }}/database.db"
|
||||
matrix_mx_puppet_steam_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_steam_database_username: matrix_mx_puppet_steam
|
||||
matrix_mx_puppet_steam_database_password: ~
|
||||
matrix_mx_puppet_steam_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_steam_database_port: 5432
|
||||
matrix_mx_puppet_steam_database_name: matrix_mx_puppet_steam
|
||||
|
||||
matrix_mx_puppet_steam_database_connection_string: 'postgresql://{{ matrix_mx_puppet_steam_database_username }}:{{ matrix_mx_puppet_steam_database_password }}@{{ matrix_mx_puppet_steam_database_hostname }}:{{ matrix_mx_puppet_steam_database_port }}/{{ matrix_mx_puppet_steam_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
The matrix-bridge-mx-puppet-steam role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Steam image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_steam_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_steam_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_mx_puppet_steam_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_steam_enabled|bool and not matrix_mx_puppet_steam_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Steam paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
@ -30,6 +22,57 @@
|
|||
- { path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}", when: "{{ matrix_mx_puppet_steam_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_steam_enabled|bool and item.when|bool
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_steam_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_steam_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-steam.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-steam
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_steam_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-steam database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_steam_base_path }}/database.db {{ matrix_mx_puppet_steam_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_steam_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_steam_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_steam_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_steam_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_steam_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-steam.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_steam_requires_restart: true
|
||||
when: "matrix_mx_puppet_steam_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_steam_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Steam image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_steam_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_steam_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_mx_puppet_steam_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_steam_enabled|bool and not matrix_mx_puppet_steam_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Steam repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_steam_container_image_self_build_repo }}"
|
||||
|
@ -49,23 +92,6 @@
|
|||
pull: yes
|
||||
when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_steam_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_steam_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-steam.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-steam
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_steam_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-steam database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_steam_base_path }}/database.db {{ matrix_mx_puppet_steam_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_steam_stat_database.stat.exists"
|
||||
|
||||
- name: Ensure mx-puppet-steam config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_steam_configuration|to_nice_yaml }}"
|
||||
|
@ -93,3 +119,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_steam_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-steam.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-steam.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_steam_requires_restart|bool"
|
||||
|
|
|
@ -61,15 +61,18 @@ selfService:
|
|||
blacklist: {{ matrix_mx_puppet_steam_provisioning_blacklist|to_json }}
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_steam_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_steam_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_steam_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
|
|
@ -8,6 +8,7 @@ After={{ service }}
|
|||
{% for service in matrix_mx_puppet_steam_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -60,6 +60,20 @@ matrix_mx_puppet_twitter_homeserver_token: ''
|
|||
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
|
||||
matrix_mx_puppet_twitter_login_shared_secret: ''
|
||||
|
||||
# Database configuration
|
||||
matrix_mx_puppet_twitter_database_engine: sqlite
|
||||
|
||||
matrix_mx_puppet_twitter_sqlite_database_path_local: "{{ matrix_mx_puppet_twitter_data_path }}/database.db"
|
||||
matrix_mx_puppet_twitter_sqlite_database_path_in_container: "/data/database.db"
|
||||
|
||||
matrix_mx_puppet_twitter_database_username: mx_puppet_twitter
|
||||
matrix_mx_puppet_twitter_database_password: ~
|
||||
matrix_mx_puppet_twitter_database_hostname: 'matrix-postgres'
|
||||
matrix_mx_puppet_twitter_database_port: 5432
|
||||
matrix_mx_puppet_twitter_database_name: matrix_mx_puppet_twitter
|
||||
|
||||
matrix_mx_puppet_twitter_database_connection_string: 'postgresql://{{ matrix_mx_puppet_twitter_database_username }}:{{ matrix_mx_puppet_twitter_database_password }}@{{ matrix_mx_puppet_twitter_database_hostname }}:{{ matrix_mx_puppet_twitter_database_port }}/{{ matrix_mx_puppet_twitter_database_name }}?sslmode=disable'
|
||||
|
||||
# Default configuration template which covers the generic use case.
|
||||
# You can customize it by controlling the various variables inside it.
|
||||
#
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
The matrix-bridge-mx-puppet-twitter role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed|default(False)"
|
||||
|
||||
- name: Ensure MX Puppet Twitter image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_twitter_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_twitter_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_mx_puppet_twitter_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_twitter_enabled|bool and not matrix_mx_puppet_twitter_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Twitter paths exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
@ -30,6 +22,57 @@
|
|||
- { path: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}", when: "{{ matrix_mx_puppet_twitter_container_image_self_build }}" }
|
||||
when: matrix_mx_puppet_twitter_enabled|bool and item.when|bool
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_twitter_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_twitter_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-twitter.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-twitter
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_twitter_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-twitter database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_twitter_base_path }}/database.db {{ matrix_mx_puppet_twitter_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_twitter_stat_database.stat.exists"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_twitter_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}"
|
||||
register: matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mx_puppet_twitter_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
engine_variable_name: 'matrix_mx_puppet_twitter_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-mx-puppet-twitter.service']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- set_fact:
|
||||
matrix_mx_puppet_twitter_requires_restart: true
|
||||
when: "matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_mx_puppet_twitter_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure MX Puppet Twitter image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_mx_puppet_twitter_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_mx_puppet_twitter_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_mx_puppet_twitter_docker_image_force_pull }}"
|
||||
when: matrix_mx_puppet_twitter_enabled|bool and not matrix_mx_puppet_twitter_container_image_self_build
|
||||
|
||||
- name: Ensure MX Puppet Twitter repository is present on self build
|
||||
git:
|
||||
repo: "{{ matrix_mx_puppet_twitter_container_image_self_build_repo }}"
|
||||
|
@ -49,23 +92,6 @@
|
|||
pull: yes
|
||||
when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build"
|
||||
|
||||
- name: Check if an old database file already exists
|
||||
stat:
|
||||
path: "{{ matrix_mx_puppet_twitter_base_path }}/database.db"
|
||||
register: matrix_mx_puppet_twitter_stat_database
|
||||
|
||||
- name: (Data relocation) Ensure matrix-mx-puppet-twitter.service is stopped
|
||||
service:
|
||||
name: matrix-mx-puppet-twitter
|
||||
state: stopped
|
||||
daemon_reload: yes
|
||||
failed_when: false
|
||||
when: "matrix_mx_puppet_twitter_stat_database.stat.exists"
|
||||
|
||||
- name: (Data relocation) Move mx-puppet-twitter database file to ./data directory
|
||||
command: "mv {{ matrix_mx_puppet_twitter_base_path }}/database.db {{ matrix_mx_puppet_twitter_data_path }}/database.db"
|
||||
when: "matrix_mx_puppet_twitter_stat_database.stat.exists"
|
||||
|
||||
- name: Ensure mx-puppet-twitter config.yaml installed
|
||||
copy:
|
||||
content: "{{ matrix_mx_puppet_twitter_configuration|to_nice_yaml }}"
|
||||
|
@ -93,3 +119,9 @@
|
|||
service:
|
||||
daemon_reload: yes
|
||||
when: "matrix_mx_puppet_twitter_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mx-puppet-twitter.service restarted, if necessary
|
||||
service:
|
||||
name: "matrix-mx-puppet-twitter.service"
|
||||
state: restarted
|
||||
when: "matrix_mx_puppet_twitter_requires_restart|bool"
|
||||
|
|
|
@ -54,15 +54,18 @@ provisioning:
|
|||
apiPrefix: /_matrix/provision
|
||||
|
||||
database:
|
||||
{% if matrix_mx_puppet_twitter_database_engine == 'postgres' %}
|
||||
# Use Postgres as a database backend
|
||||
# If set, will be used instead of SQLite3
|
||||
# Connection string to connect to the Postgres instance
|
||||
# with username "user", password "pass", host "localhost" and database name "dbname".
|
||||
# Modify each value as necessary
|
||||
#connString: "postgres://user:pass@localhost/dbname?sslmode=disable"
|
||||
connString: {{ matrix_mx_puppet_twitter_database_connection_string|to_json }}
|
||||
{% else %}
|
||||
# Use SQLite3 as a database backend
|
||||
# The name of the database file
|
||||
filename: /data/database.db
|
||||
filename: {{ matrix_mx_puppet_twitter_sqlite_database_path_in_container|to_json }}
|
||||
{% endif %}
|
||||
|
||||
logging:
|
||||
# Log level of console output
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue