aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/matrix_server
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-12-12 23:33:44 -0500
committerCullum Smith <cullum@sacredheartsc.com>2024-12-12 23:33:44 -0500
commit8cefa25e58cdd1fe7ea9957345e8156090091949 (patch)
tree9fee150b85bee8a2c3a987633bde1233ea65d6f0 /scripts/hostclass/matrix_server
parent8de952dd109b0e629cc18258aac828991faa495c (diff)
downloadinfrastructure-8cefa25e58cdd1fe7ea9957345e8156090091949.tar.gz
some matrix-synapse stuff
Diffstat (limited to 'scripts/hostclass/matrix_server')
-rw-r--r--scripts/hostclass/matrix_server39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/hostclass/matrix_server b/scripts/hostclass/matrix_server
new file mode 100644
index 0000000..df22c3b
--- /dev/null
+++ b/scripts/hostclass/matrix_server
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+: ${synapse_signing_key:='changeme'}
+: ${synapse_macaroon_secret_key:='changeme'}
+: ${synapse_form_secret:='changeme'}
+: ${synapse_ldap_password:='changeme'}
+: ${synapse_domain:="$email_domain"}
+: ${synapse_public_fqdn:="$fqdn"}
+: ${synapse_local_client_port:='8008'}
+: ${synapse_local_federation_port:='8009'}
+: ${synapse_client_port:='8443'}
+: ${synapse_federation_port:='8448'}
+: ${synapse_mail_from:="Matrix <matrix-noreply@${email_domain}>"}
+: ${synapse_username:='s-synapse'}
+: ${synapse_local_media_retention:='365d'}
+: ${synapse_remote_media_retention:='90d'}
+: ${synapse_upload_sizelimit:='104857600'} # 100 MB
+: ${synapse_turn_host:="$turn_domain"}
+: ${synapse_turn_secret:="$turn_secret"}
+: ${synapse_access_role:='matrix-access'}
+
+synapse_db_dir=/var/db/matrix-synapse
+synapse_conf_dir=/usr/local/etc/matrix-synapse
+synapse_local_user=synapse
+
+# Install required packages.
+pkg install -y \
+ py${python_version}-matrix-synapse \
+ py${python_version}-matrix-synapse-ldap3 \
+ nginx
+
+# Generate synapse configuration.
+install_template -o "$synapse_local_user" -g "$synapse_local_user" -m 0600 \
+ "${synapse_conf_dir}/homeserver.yaml" \
+ "${synapse_conf_dir}/${synapse_domain}.signing.key"
+
+install_file -o "$synapse_local_user" -g "$synapse_local_user" -m 0644 \
+ "${synapse_conf_dir}/log.config"
+