Просмотр исходного кода

add new variables to control message retention in Synapse

pull/3791/head
Aine 1 год назад
Родитель
Сommit
5bf09f5fdc
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 34969C908CCA2804
2 измененных файлов: 47 добавлений и 12 удалений
  1. +21
    -0
      roles/custom/matrix-synapse/defaults/main.yml
  2. +26
    -12
      roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2

+ 21
- 0
roles/custom/matrix-synapse/defaults/main.yml Просмотреть файл

@@ -370,6 +370,27 @@ matrix_synapse_media_retention_remote_media_lifetime:
# Controls the list of additional oembed providers to be added to the homeserver. # Controls the list of additional oembed providers to be added to the homeserver.
matrix_synapse_oembed_additional_providers: [] matrix_synapse_oembed_additional_providers: []


# Controls message retention policies
matrix_synapse_retention_enabled: false
# "A single var to control them all" - applied to all retention period vars, applied only if a value is set, e.g. : "1d", "1w", "1m", "1y"
matrix_synapse_retention_period: ""
# The default min lifetime, applied only if a value is set, e.g. : "1d", "1w", "1m", "1y"
matrix_synapse_retention_default_policy_min_lifetime: "{{ matrix_synapse_retention_period }}"
# The default max lifetime, applied only if a value is set, e.g. : "1d", "1w", "1m", "1y"
matrix_synapse_retention_default_policy_max_lifetime: "{{ matrix_synapse_retention_period }}"
# The allowed min lifetime, applied only if a value is set, e.g. : "1d", "1w", "1m", "1y"
matrix_synapse_retention_allowed_lifetime_min: "{{ matrix_synapse_retention_period }}"
# The allowed max lifetime, applied only if a value is set, e.g. : "1d", "1w", "1m", "1y"
matrix_synapse_retention_allowed_lifetime_max: "{{ matrix_synapse_retention_period }}"
# The list of the purge jobs, structure (all fields are optional, example below contains all available variants):
# - longest_max_lifetime: "1d"
# shortest_max_lifetime: "1d"
# interval: "12h"
# - longest_max_lifetime: "1d"
# - shortest_max_lifetime: "1d"
# - interval: "12h"
matrix_synapse_retention_purge_jobs: []

# The tmpfs at /tmp needs to be large enough to handle multiple concurrent file uploads. # The tmpfs at /tmp needs to be large enough to handle multiple concurrent file uploads.
matrix_synapse_tmp_directory_size_mb: "{{ matrix_synapse_max_upload_size_mb * 50 }}" matrix_synapse_tmp_directory_size_mb: "{{ matrix_synapse_max_upload_size_mb * 50 }}"




+ 26
- 12
roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 Просмотреть файл

@@ -590,26 +590,37 @@ templates:
# purged are ignored and not stored again. # purged are ignored and not stored again.
# #
retention: retention:
{% if matrix_synapse_retention_enabled %}
# The message retention policies feature is disabled by default. Uncomment the # The message retention policies feature is disabled by default. Uncomment the
# following line to enable it. # following line to enable it.
# #
#enabled: true
enabled: {{ matrix_synapse_retention_enabled|to_json }}


# Default retention policy. If set, Synapse will apply it to rooms that lack the # Default retention policy. If set, Synapse will apply it to rooms that lack the
# 'm.room.retention' state event. Currently, the value of 'min_lifetime' doesn't # 'm.room.retention' state event. Currently, the value of 'min_lifetime' doesn't
# matter much because Synapse doesn't take it into account yet. # matter much because Synapse doesn't take it into account yet.
# #
#default_policy:
# min_lifetime: 1d
# max_lifetime: 1y
{% if matrix_synapse_retention_default_policy_min_lifetime | length > 0 or matrix_synapse_retention_default_policy_max_lifetime | length > 0 %}
default_policy:
{% if matrix_synapse_retention_default_policy_min_lifetime | length > 0 %}
min_lifetime: {{ matrix_synapse_retention_default_policy_min_lifetime|to_json }}
{% endif %}
{% if matrix_synapse_retention_default_policy_max_lifetime | length > 0 %}
max_lifetime: {{ matrix_synapse_retention_default_policy_max_lifetime|to_json }}
{% endif %}
{% endif %}


# Retention policy limits. If set, and the state of a room contains a # Retention policy limits. If set, and the state of a room contains a
# 'm.room.retention' event in its state which contains a 'min_lifetime' or a # 'm.room.retention' event in its state which contains a 'min_lifetime' or a
# 'max_lifetime' that's out of these bounds, Synapse will cap the room's policy # 'max_lifetime' that's out of these bounds, Synapse will cap the room's policy
# to these limits when running purge jobs. # to these limits when running purge jobs.
# #
#allowed_lifetime_min: 1d
#allowed_lifetime_max: 1y
{% if matrix_synapse_retention_allowed_lifetime_min | length > 0 %}
allowed_lifetime_min: {{ matrix_synapse_retention_allowed_lifetime_min|to_json }}
{% endif %}
{% if matrix_synapse_retention_allowed_lifetime_max | length > 0 %}
allowed_lifetime_max: {{ matrix_synapse_retention_allowed_lifetime_max|to_json }}
{% endif %}


# Server admins can define the settings of the background jobs purging the # Server admins can define the settings of the background jobs purging the
# events which lifetime has expired under the 'purge_jobs' section. # events which lifetime has expired under the 'purge_jobs' section.
@@ -640,12 +651,15 @@ retention:
# room's policy to these values is done after the policies are retrieved from # room's policy to these values is done after the policies are retrieved from
# Synapse's database (which is done using the range specified in a purge job's # Synapse's database (which is done using the range specified in a purge job's
# configuration). # configuration).
#
#purge_jobs:
# - longest_max_lifetime: 3d
# interval: 12h
# - shortest_max_lifetime: 3d
# interval: 1d
{% if matrix_synapse_retention_purge_jobs is not none %}
purge_jobs:
{% for job in matrix_synapse_retention_purge_jobs %}
- {% if job.longest_max_lifetime is defined %}longest_max_lifetime: {{ job.longest_max_lifetime|to_json }}{% endif %}
{% if job.shortest_max_lifetime is defined %}shortest_max_lifetime: {{ job.shortest_max_lifetime|to_json }}{% endif %}
{% if job.interval is defined %}interval: {{ job.interval|to_json }}{% endif %}
{% endfor %}
{% endif %}
{% endif %}




## TLS ## ## TLS ##


Загрузка…
Отмена
Сохранить