From 0ecabeac626be3fd449488f2c80591886838c9b8 Mon Sep 17 00:00:00 2001 From: thorstenspille Date: Sat, 11 Feb 2023 16:22:29 +0100 Subject: [PATCH] matrix: rework, install latest element-web --- src/matrix/install-service.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/matrix/install-service.sh b/src/matrix/install-service.sh index 712ba83..fa15c4c 100644 --- a/src/matrix/install-service.sh +++ b/src/matrix/install-service.sh @@ -14,6 +14,8 @@ MRX_PKE=$(random_password) ELE_DBNAME="synapse_db" ELE_DBUSER="synapse_user" ELE_DBPASS=$(random_password) +ELE_PATH=/var/www/element-web +WEBROOT=/var/www DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq nginx postgresql python3-psycopg2 @@ -67,7 +69,7 @@ server { ssl_certificate_key /etc/nginx/ssl/matrix.key; # If you don't wanna serve a site, comment this out - root /var/www/$MATRIX_FQDN; + root $ELE_PATH; index index.html index.htm; location / { @@ -102,7 +104,7 @@ server { ssl_certificate_key /etc/nginx/ssl/matrix.key; # If you don't wanna serve a site, comment this out - root /var/www/$MATRIX_ELEMENT_FQDN/element; + root $ELE_PATH; index index.html index.htm; } @@ -113,21 +115,23 @@ ln -s /etc/nginx/sites-available/$MATRIX_ELEMENT_FQDN /etc/nginx/sites-enabled/$ systemctl restart nginx -mkdir /var/www/$MATRIX_ELEMENT_FQDN -cd /var/www/$MATRIX_ELEMENT_FQDN -wget https://packages.riot.im/element-release-key.asc +cd /var/www + +wget -O element-release-key.asc https://packages.riot.im/element-release-key.asc gpg --import element-release-key.asc -wget https://github.com/vector-im/element-web/releases/download/$MATRIX_ELEMENT_VERSION/element-$MATRIX_ELEMENT_VERSION.tar.gz -wget https://github.com/vector-im/element-web/releases/download/$MATRIX_ELEMENT_VERSION/element-$MATRIX_ELEMENT_VERSION.tar.gz.asc +MATRIX_ELEMENT_VERSION=$(curl -s https://api.github.com/repos/vector-im/element-web/releases/latest | grep tag_name | cut -d'"' -f4) + +wget -O element-$MATRIX_ELEMENT_VERSION.tar.gz https://github.com/vector-im/element-web/releases/download/$MATRIX_ELEMENT_VERSION/element-$MATRIX_ELEMENT_VERSION.tar.gz +wget -O element-$MATRIX_ELEMENT_VERSION.tar.gz.asc https://github.com/vector-im/element-web/releases/download/$MATRIX_ELEMENT_VERSION/element-$MATRIX_ELEMENT_VERSION.tar.gz.asc gpg --verify element-$MATRIX_ELEMENT_VERSION.tar.gz.asc tar -xzvf element-$MATRIX_ELEMENT_VERSION.tar.gz -ln -s element-$MATRIX_ELEMENT_VERSION element -chown www-data:www-data -R element -cp ./element/config.sample.json ./element/config.json -sed -i "s|https://matrix-client.matrix.org|https://$MATRIX_FQDN|" ./element/config.json -sed -i "s|\"server_name\": \"matrix.org\"|\"server_name\": \"$MATRIX_FQDN\"|" ./element/config.json +mv element-$MATRIX_ELEMENT_VERSION $ELE_PATH +chown www-data:www-data -R $ELE_PATH +cp $ELE_PATH/config.sample.json $ELE_PATH/config.json +sed -i "s|https://matrix-client.matrix.org|https://$MATRIX_FQDN|" $ELE_PATH/config.json +sed -i "s|\"server_name\": \"matrix.org\"|\"server_name\": \"$MATRIX_FQDN\"|" $ELE_PATH/config.json su postgres <