Upgrade Sygnal (v0.9.0 -> v0.10.1)

This commit is contained in:
Slavi Pantaleev 2021-08-20 17:48:18 +03:00
parent b3d9be4599
commit 9860fb4675
6 changed files with 15 additions and 123 deletions

View File

@ -1,3 +1,17 @@
# 2021-08-20
# Sygnal upgraded - ARM support and no longer requires a database
The [Sygnal](docs/configuring-playbook-sygnal.md) push gateway has been upgraded from `v0.9.0` to `v0.10.1`.
This is an optional component for the playbook, so most of our users wouldn't care about this announcement.
Since this feels like a relatively big (and untested, as of yet) Sygnal change, we're putting up this changelog entry.
The new version is also available for the ARM architecture. It also no longer requires a database anymore.
If you need to downgrade to the previous version, changing `matrix_sygnal_version` or `matrix_sygnal_docker_image` will not be enough, as we've removed the `database` configuration completely. You'd need to switch to an earlier playbook commit.
# 2021-05-21
## Hydrogen support

View File

@ -1462,12 +1462,6 @@ matrix_postgres_additional_databases: |
'password': matrix_etherpad_database_password,
}] if (matrix_etherpad_enabled and matrix_etherpad_database_engine == 'postgres' and matrix_etherpad_database_hostname == 'matrix-postgres') else [])
+
([{
'name': matrix_sygnal_database_name,
'username': matrix_sygnal_database_username,
'password': matrix_sygnal_database_password,
}] if (matrix_sygnal_enabled and matrix_sygnal_database_engine == 'postgres' and matrix_sygnal_database_hostname == 'matrix-postgres') else [])
+
([{
'name': matrix_prometheus_postgres_exporter_database_name,
'username': matrix_prometheus_postgres_exporter_database_username,
@ -1512,10 +1506,6 @@ matrix_sygnal_metrics_prometheus_enabled: "{{ matrix_prometheus_enabled }}"
matrix_sygnal_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:6000' }}"
# Postgres is the default, except if not using `matrix_postgres` (internal postgres)
matrix_sygnal_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}"
matrix_sygnal_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'sygnal') | to_uuid }}"
######################################################################
#
# /matrix-sygnal

View File

@ -7,7 +7,7 @@ matrix_sygnal_base_path: "{{ matrix_base_data_path }}/sygnal"
matrix_sygnal_config_path: "{{ matrix_sygnal_base_path }}/config"
matrix_sygnal_data_path: "{{ matrix_sygnal_base_path }}/data"
matrix_sygnal_version: v0.9.0
matrix_sygnal_version: v0.10.1
matrix_sygnal_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/sygnal:{{ matrix_sygnal_version }}"
matrix_sygnal_docker_image_force_pull: "{{ matrix_sygnal_docker_image.endswith(':latest') }}"
@ -25,26 +25,6 @@ matrix_sygnal_container_http_host_bind_port: ''
# A list of extra arguments to pass to the container
matrix_sygnal_container_extra_arguments: []
# Database-related configuration fields.
#
# To use SQLite, stick to these defaults.
#
# To use Postgres:
# - change the engine (`matrix_sygnal_database_engine: 'postgres'`)
# - adjust your database credentials via the `matrix_sygnal_postgres_*` variables
matrix_sygnal_database_engine: 'sqlite'
matrix_sygnal_sqlite_database_path_local: "{{ matrix_sygnal_data_path }}/sygnal.db"
matrix_sygnal_sqlite_database_path_in_container: "/data/sygnal.db"
matrix_sygnal_database_username: 'matrix_sygnal'
matrix_sygnal_database_password: 'some-password'
matrix_sygnal_database_hostname: 'matrix-postgres'
matrix_sygnal_database_port: 5432
matrix_sygnal_database_name: 'matrix_sygnal'
matrix_sygnal_database_connection_string: 'postgres://{{ matrix_sygnal_database_username }}:{{ matrix_sygnal_database_password }}@{{ matrix_sygnal_database_hostname }}:{{ matrix_sygnal_database_port }}/{{ matrix_sygnal_database_name }}'
# A map (dictionary) of apps instances that this server works with.
#
# Example configuration:

View File

@ -1,32 +1,5 @@
---
- set_fact:
matrix_sygnal_requires_restart: false
- block:
- name: Check if an SQLite database already exists
stat:
path: "{{ matrix_sygnal_sqlite_database_path_local }}"
register: matrix_sygnal_sqlite_database_path_local_stat_result
- block:
- set_fact:
matrix_postgres_db_migration_request:
src: "{{ matrix_sygnal_sqlite_database_path_local }}"
dst: "{{ matrix_sygnal_database_connection_string }}"
caller: "{{ role_path|basename }}"
engine_variable_name: 'matrix_sygnal_database_engine'
engine_old: 'sqlite'
systemd_services_to_stop: ['matrix-sygnal.service']
pgloader_options: ['--with "quote identifiers"']
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
- set_fact:
matrix_sygnal_requires_restart: true
when: "matrix_sygnal_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_sygnal_database_engine == 'postgres'"
- name: Ensure Sygnal image is pulled
docker_image:
name: "{{ matrix_sygnal_docker_image }}"
@ -65,9 +38,3 @@
service:
daemon_reload: yes
when: "matrix_sygnal_systemd_service_result.changed|bool"
- name: Ensure matrix-sygnal.service restarted, if necessary
service:
name: "matrix-sygnal.service"
state: restarted
when: "matrix_sygnal_requires_restart|bool"

View File

@ -3,11 +3,3 @@
msg: >-
Enabling Sygnal requires that you specify at least one app in `matrix_sygnal_apps`
when: "matrix_sygnal_enabled and matrix_sygnal_apps|length == 0"
- name: Fail if running on a non-supported architecture
fail:
msg: >-
Sygnal can only be used on the amd64 architecture for now.
Only amd64 container images are pushed for the `docker.io/matrixdotorg/sygnal` container image.
Either use a different image (by redefining `matrix_sygnal_docker_image`) or consider contributing self-building support to this role.
when: "matrix_sygnal_enabled and matrix_architecture != 'amd64' and matrix_sygnal_docker_image.startswith('docker.io/matrixdotorg/sygnal')"

View File

@ -3,57 +3,6 @@
# See: matrix.org
##
# The 'database' setting defines the database that sygnal uses to store all of
# its data.
#
# 'name' gives the database engine to use: either 'sqlite3' (for SQLite) or
# 'psycopg2' (for PostgreSQL).
#
# 'args' gives options which are passed through to the database engine,
# except for options starting 'cp_', which are used to configure the Twisted
# connection pool. For a reference to valid arguments, see:
# * for sqlite: https://docs.python.org/3/library/sqlite3.html#sqlite3.connect
# * for postgres: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
# * for the connection pool: https://twistedmatrix.com/documents/current/api/twisted.enterprise.adbapi.ConnectionPool.html#__init__
#
#
# Example SQLite configuration:
#
#database:
# name: sqlite3
# args:
# dbfile: /path/to/database.db
#
#
# Example Postgres configuration:
#
#database:
# name: psycopg2
# args:
# host: localhost
# database: sygnal
# user: sygnal
# password: pass
# cp_min: 1
# cp_max: 5
#
{% if matrix_sygnal_database_engine == 'sqlite' %}
database:
name: sqlite3
args:
dbfile: {{ matrix_sygnal_sqlite_database_path_in_container|to_json }}
{% else %}
database:
name: psycopg2
args:
host: {{ matrix_sygnal_database_hostname|to_json }}
database: {{ matrix_sygnal_database_name|to_json }}
user: {{ matrix_sygnal_database_username|to_json }}
password: {{ matrix_sygnal_database_password|to_json }}
cp_min: 1
cp_max: 5
{% endif %}
## Logging #
#
log: