diff --git a/inventories/production/host_vars/matrix.crypto-libertarian.com.yml b/inventories/production/host_vars/matrix.crypto-libertarian.com.yml index f709656..7519909 100644 --- a/inventories/production/host_vars/matrix.crypto-libertarian.com.yml +++ b/inventories/production/host_vars/matrix.crypto-libertarian.com.yml @@ -25,6 +25,20 @@ matrix__admin_contact: 'mailto:kotovalexarian@gmail.com' matrix__nginx__ssl_cert: '/etc/letsencrypt/live/matrix.crypto-libertarian.com/fullchain.pem' matrix__nginx__ssl_key: '/etc/letsencrypt/live/matrix.crypto-libertarian.com/privkey.pem' +matrix__synapse__pg_enable: true +matrix__synapse__pg_host: 'postgres.crypto-libertarian.com' +matrix__synapse__pg_username: 'matrix_synapse' +matrix__synapse__pg_database: 'matrix_synapse' + +matrix__synapse__pg_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 35643162356165376337313538396466333534613666323865636363656264373539646135303136 + 3263643435383866643161333931383430313133633331370a636639303366616132616164306537 + 31333162356131633635303931353931633763386238636461343437363861343565616430666137 + 3738616138303739350a646331323639306464656332383233333664653561313934666366623939 + 65373839653630353830326336376534313136313735343532373232653536653363366132333363 + 6639346134356664313434373664653734366361633935633230 + matrix__synapse__signing_key: !vault | $ANSIBLE_VAULT;1.1;AES256 39396138396261633738353039613533343139373763383332373462303136643963646663383435 diff --git a/roles/matrix/defaults/main.yml b/roles/matrix/defaults/main.yml index 1bdd3b3..d5e9533 100644 --- a/roles/matrix/defaults/main.yml +++ b/roles/matrix/defaults/main.yml @@ -8,6 +8,13 @@ matrix__admin_contact: 'mailto:user@example.com' matrix__nginx__ssl_cert: '/etc/letsencrypt/live/matrix.example.com/fullchain.pem' matrix__nginx__ssl_key: '/etc/letsencrypt/live/matrix.example.com/privkey.pem' +matrix__synapse__pg_enable: false +matrix__synapse__pg_host: 'postgres.example.com' +matrix__synapse__pg_port: 5432 +matrix__synapse__pg_username: '' +matrix__synapse__pg_password: '' +matrix__synapse__pg_database: '' + matrix__synapse__signing_key: '' matrix__synapse__reg_secret: '' matrix__synapse__macaroon_secret: '' diff --git a/roles/matrix/templates/synapse/config/database.yaml b/roles/matrix/templates/synapse/config/database.yaml index 274658d..3f371d7 100644 --- a/roles/matrix/templates/synapse/config/database.yaml +++ b/roles/matrix/templates/synapse/config/database.yaml @@ -36,7 +36,20 @@ # # For more information on using Synapse with Postgres, see `docs/postgres.md`. # +{% if not matrix__synapse__pg_enable %} database: name: sqlite3 args: database: '{{ matrix__synapse__db_file }}' +{% else %} +database: + name: psycopg2 + args: + host: '{{ matrix__synapse__pg_host }}' + port: {{ matrix__synapse__pg_port }} + user: '{{ matrix__synapse__pg_username }}' + password: '{{ matrix__synapse__pg_password }}' + database: '{{ matrix__synapse__pg_database }}' + cp_min: 5 + cp_max: 10 +{% endif %}