diff --git a/tasks/install.yml b/tasks/install.yml index 2d54f51..98527bc 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -32,10 +32,20 @@ virtualenv: "{{ matrix_base_dir }}/env" virtualenv_command: /usr/bin/python3 -m venv - - name: Copy global config files + - name: Create signing key + shell: "{{ matrix_base_dir }}/env/bin/python -c \"from signedjson import key; file = open('{{ matrix_conf_dir }}/{{ matrix_base_url }}.signing.key','w'); key.write_signing_keys(file, [key.generate_signing_key('first')]); file.close()\"" + args: + creates: "{{ matrix_conf_dir }}/{{ matrix_base_url }}.signing.key" + notify: __matrix_restart + + - name: Deploy global config files template: - src: "opt/matrix/config/homeserver.yml.j2" - dest: "{{ matrix_conf_dir }}/homeserver.yml" + src: "opt/matrix/config/{{ item }}.j2" + dest: "{{ matrix_conf_dir }}/{{ item }}" + mode: 0650 + loop: + - "homeserver.yml" + - "logging.yml" notify: __matrix_restart become: True become_user: "{{ matrix_user }}" diff --git a/templates/opt/matrix/config/homeserver.yml.j2 b/templates/opt/matrix/config/homeserver.yml.j2 index 5dc90d2..6483ccd 100644 --- a/templates/opt/matrix/config/homeserver.yml.j2 +++ b/templates/opt/matrix/config/homeserver.yml.j2 @@ -232,7 +232,7 @@ event_cache_size: "10K" # A yaml python logging config file -log_config: "{{ matrix_conf_dir }}/matrix.example.com.log.config" +log_config: "{{ matrix_conf_dir }}/logging.config" ## Ratelimiting ## @@ -545,7 +545,7 @@ form_secret: "5l51Jk51RyULKH4RbeYdnI5P^ROOOktfj-nWgK0i8JT_sd-CC." ## Signing Keys ## # Path to the signing key to sign messages with -signing_key_path: "{{ matrix_conf_dir }}/matrix.example.com.signing.key" +signing_key_path: "{{ matrix_conf_dir }}/{{ matrix_base_url }}.signing.key" # The keys that the server used to sign messages with but won't use # to sign new messages. E.g. it has lost its private key diff --git a/templates/opt/matrix/config/logging.config.j2 b/templates/opt/matrix/config/logging.config.j2 new file mode 100644 index 0000000..afe6847 --- /dev/null +++ b/templates/opt/matrix/config/logging.config.j2 @@ -0,0 +1,38 @@ + +version: 1 + +formatters: + precise: + format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' + +filters: + context: + (): synapse.util.logcontext.LoggingContextFilter + request: "" + +handlers: + file: + class: logging.handlers.RotatingFileHandler + formatter: precise + filename: /home/rknet/rkau2905/homeserver.log + maxBytes: 104857600 + backupCount: 10 + filters: [context] + encoding: utf8 + console: + class: logging.StreamHandler + formatter: precise + filters: [context] + +loggers: + synapse: + level: INFO + + synapse.storage.SQL: + # beware: increasing this to DEBUG will make synapse log sensitive + # information such as access tokens. + level: INFO + +root: + level: INFO + handlers: [file, console]