[__ungleich_matrix] Make element optional, set notification-from
This commit is contained in:
parent
e91afafeba
commit
3b8d59bbf4
4 changed files with 57 additions and 35 deletions
|
@ -8,8 +8,8 @@ cdist-type__ungleich_matrix - ungleich matrix enviroment
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
This type deploys a Matrix homeserver (synapse) and web client (element) on
|
This type deploys a Matrix homeserver (synapse) and optionally a web client
|
||||||
ungleich's infrastructure. This is a singleton type.
|
(element) on ungleich's infrastructure. This is a singleton type.
|
||||||
|
|
||||||
|
|
||||||
REQUIRED PARAMETERS
|
REQUIRED PARAMETERS
|
||||||
|
@ -21,13 +21,6 @@ synapse-domain
|
||||||
Public address of the Matrix homeserver. This must be a domain name, as it is
|
Public address of the Matrix homeserver. This must be a domain name, as it is
|
||||||
used to generate TLS certificates and configuration for the web server.
|
used to generate TLS certificates and configuration for the web server.
|
||||||
|
|
||||||
element-address
|
|
||||||
Public address of the Element web client. This must be a domain name, as it is
|
|
||||||
used to generate TLS certificates and configuration for the web server.
|
|
||||||
|
|
||||||
element-version
|
|
||||||
Version of the Element client to be deployed.
|
|
||||||
|
|
||||||
synapse-smtp-user
|
synapse-smtp-user
|
||||||
SMTP user to ungleich's mail infrastructure. Used by Synapse to send
|
SMTP user to ungleich's mail infrastructure. Used by Synapse to send
|
||||||
notifications over email.
|
notifications over email.
|
||||||
|
@ -45,6 +38,14 @@ synapse-extra-parameters
|
||||||
element-extra-parameters
|
element-extra-parameters
|
||||||
Extra parameters passed to the `__matrix_element` type.
|
Extra parameters passed to the `__matrix_element` type.
|
||||||
|
|
||||||
|
element-address
|
||||||
|
Public address of the Element web client. This must be a domain name, as it
|
||||||
|
is used to generate TLS certificates and configuration for the web server.
|
||||||
|
Element is only deployed if this parameter is set.
|
||||||
|
|
||||||
|
element-version
|
||||||
|
Version of the Element client to be deployed.
|
||||||
|
|
||||||
BOOLEAN PARAMETERS
|
BOOLEAN PARAMETERS
|
||||||
------------------
|
------------------
|
||||||
None.
|
None.
|
||||||
|
|
|
@ -35,9 +35,15 @@ SMTP_SERVER_PORT="587"
|
||||||
|
|
||||||
# Type parameters.
|
# Type parameters.
|
||||||
matrix_domain=$(cat "$__object/parameter/matrix-domain")
|
matrix_domain=$(cat "$__object/parameter/matrix-domain")
|
||||||
element_domain=$(cat "$__object/parameter/element-domain")
|
|
||||||
synapse_domain=$(cat "$__object/parameter/synapse-domain")
|
synapse_domain=$(cat "$__object/parameter/synapse-domain")
|
||||||
element_version=$(cat "$__object/parameter/element-version")
|
|
||||||
|
if [ -f "$__object/parameter/element-domain" ]; then
|
||||||
|
element_domain=$(cat "$__object/parameter/element-domain")
|
||||||
|
deploy_element=1
|
||||||
|
fi
|
||||||
|
if [ -f "$__object/parameter/element-version" ]; then
|
||||||
|
element_version=$(cat "$__object/parameter/element-version")
|
||||||
|
fi
|
||||||
|
|
||||||
synapse_smtp_user=$(cat "$__object/parameter/synapse-smtp-user")
|
synapse_smtp_user=$(cat "$__object/parameter/synapse-smtp-user")
|
||||||
synapse_smtp_password=$(cat "$__object/parameter/synapse-smtp-password")
|
synapse_smtp_password=$(cat "$__object/parameter/synapse-smtp-password")
|
||||||
|
@ -59,7 +65,19 @@ postgres_database='matrix-synapse'
|
||||||
www_directory_owner=root
|
www_directory_owner=root
|
||||||
nginx_basedir='/var/www/static'
|
nginx_basedir='/var/www/static'
|
||||||
|
|
||||||
###
|
##
|
||||||
|
# Check for invalid parameter combinations.
|
||||||
|
|
||||||
|
if [ -n "$element_domain" ] && [ -z "$element_version" ]; then
|
||||||
|
echo "--element-version is required if --element-domain is set." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$element_domain" ] && [ -n "$element_version" ]; then
|
||||||
|
echo "--element-domain is required if --element-version is set." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
##
|
||||||
# Deployment logic.
|
# Deployment logic.
|
||||||
|
|
||||||
# Install & configure PGSQL database.
|
# Install & configure PGSQL database.
|
||||||
|
@ -84,6 +102,7 @@ __matrix_synapse \
|
||||||
--database-user "$postgres_user" \
|
--database-user "$postgres_user" \
|
||||||
--database-host '/var/run/postgresql' \
|
--database-host '/var/run/postgresql' \
|
||||||
--enable-notifications \
|
--enable-notifications \
|
||||||
|
--notification-from "Matrix <$synapse_smtp_user>" \
|
||||||
--smtp-host "$SMTP_SERVER" \
|
--smtp-host "$SMTP_SERVER" \
|
||||||
--smtp-port "$SMTP_SERVER_PORT" \
|
--smtp-port "$SMTP_SERVER_PORT" \
|
||||||
--smtp-use-starttls \
|
--smtp-use-starttls \
|
||||||
|
@ -91,20 +110,6 @@ __matrix_synapse \
|
||||||
--smtp-pass "$synapse_smtp_password" \
|
--smtp-pass "$synapse_smtp_password" \
|
||||||
$synapse_extra_parameters
|
$synapse_extra_parameters
|
||||||
|
|
||||||
# Install & configure Element (matrix web client).
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
__matrix_element ungleich \
|
|
||||||
--install_dir "$nginx_basedir/$www_directory_owner/$element_domain/www" \
|
|
||||||
--default_server_url "$synapse_base_url" \
|
|
||||||
--default_server_name "$matrix_domain" \
|
|
||||||
--owner "$www_directory_owner" \
|
|
||||||
--version "$element_version" \
|
|
||||||
--jitsi_domain "$JITSI_DOMAIN" \
|
|
||||||
--privacy_policy_url "$PRIVACY_POLICY_URL" \
|
|
||||||
--disable_custom_urls \
|
|
||||||
--branding_auth_footer_links [] \
|
|
||||||
$element_extra_parameters
|
|
||||||
|
|
||||||
# Install and configure NGINX web server/proxy.
|
# Install and configure NGINX web server/proxy.
|
||||||
__package nginx
|
__package nginx
|
||||||
|
|
||||||
|
@ -152,7 +157,7 @@ require="__matrix_synapse __package/nginx" \
|
||||||
# clients if matrix_domain is element_domain (= both are handled by this
|
# clients if matrix_domain is element_domain (= both are handled by this
|
||||||
# type).
|
# type).
|
||||||
element_nginx_config=
|
element_nginx_config=
|
||||||
if [ "${element_domain:?}" = "${matrix_domain:?}" ]; then
|
if [ "$element_domain" = "${matrix_domain:?}" ]; then
|
||||||
element_nginx_config="$(cat <<- EOF
|
element_nginx_config="$(cat <<- EOF
|
||||||
location = /.well-known/matrix/server {
|
location = /.well-known/matrix/server {
|
||||||
default_type application/json;
|
default_type application/json;
|
||||||
|
@ -175,9 +180,25 @@ if [ "${element_domain:?}" = "${matrix_domain:?}" ]; then
|
||||||
)"
|
)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
require="__package/nginx" \
|
if [ -n "$deploy_element" ]; then
|
||||||
|
# Install & configure Element (matrix web client).
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
__matrix_element ungleich \
|
||||||
|
--install_dir "$nginx_basedir/$www_directory_owner/$element_domain/www" \
|
||||||
|
--default_server_url "$synapse_base_url" \
|
||||||
|
--default_server_name "$matrix_domain" \
|
||||||
|
--owner "$www_directory_owner" \
|
||||||
|
--version "$element_version" \
|
||||||
|
--jitsi_domain "$JITSI_DOMAIN" \
|
||||||
|
--privacy_policy_url "$PRIVACY_POLICY_URL" \
|
||||||
|
--disable_custom_urls \
|
||||||
|
--branding_auth_footer_links [] \
|
||||||
|
$element_extra_parameters
|
||||||
|
|
||||||
|
require="__package/nginx" \
|
||||||
__ungleich_nginx_static_site "$element_domain" \
|
__ungleich_nginx_static_site "$element_domain" \
|
||||||
--owner "$www_directory_owner" \
|
--owner "$www_directory_owner" \
|
||||||
--listen '443 [::]:443' \
|
--listen '443 [::]:443' \
|
||||||
--base_directory "$nginx_basedir" \
|
--base_directory "$nginx_basedir" \
|
||||||
--locationopt "$element_nginx_config"
|
--locationopt "$element_nginx_config"
|
||||||
|
fi
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
element-domain
|
||||||
|
element-version
|
||||||
synapse-extra-parameters
|
synapse-extra-parameters
|
||||||
element-extra-parameters
|
element-extra-parameters
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
matrix-domain
|
matrix-domain
|
||||||
element-domain
|
|
||||||
synapse-domain
|
synapse-domain
|
||||||
element-version
|
|
||||||
synapse-smtp-user
|
synapse-smtp-user
|
||||||
synapse-smtp-password
|
synapse-smtp-password
|
||||||
|
|
Loading…
Reference in a new issue