From c7cbfddc083241a14430b9c8f16d5fcfc901f6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 8 Jul 2020 22:54:18 +0000 Subject: [PATCH 01/13] Upgrade synapse to 1.16.0 --- README.md | 2 +- conf/armv7_buster.src | 4 ++-- conf/armv7_stretch.src | 4 ++-- manifest.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index da8a580..ea17062 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Instant messaging server matrix network. Yunohost chatroom with matrix : [https://riot.im/app/#/room/#yunohost:matrix.org](https://riot.im/app/#/room/#yunohost:matrix.org) -**Shipped version:** 1.15.2 +**Shipped version:** 1.16.0 ## Configuration diff --git a/conf/armv7_buster.src b/conf/armv7_buster.src index 784fd05..3ccaa25 100644 --- a/conf/armv7_buster.src +++ b/conf/armv7_buster.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.15.2/matrix-synapse_1.15.2-buster-bin1_armv7l.tar.gz -SOURCE_SUM=7589b3fbd63a838c300ee74027df0108e26b9a0cb0d42a7f839f2d9e363a9570 +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.0/matrix-synapse_1.16.0-buster-bin1_armv7l.tar.gz +SOURCE_SUM=222525ec4735dfad0d46f90eb57b830d3350f6ca480996dab4465baef0cb7cbe # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/armv7_stretch.src b/conf/armv7_stretch.src index e9a1e48..0b0ac9a 100644 --- a/conf/armv7_stretch.src +++ b/conf/armv7_stretch.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.15.2/matrix-synapse_1.15.2-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=7ef30123e6f61bed08c600a68e1c97dbb14247c3ebb4ca069523218177901a26 +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.0/matrix-synapse_1.16.0-stretch-bin1_armv7l.tar.gz +SOURCE_SUM=01d13bf4966710e4f6eef834ab5ee3e40ed424fbd6336bb8d3c6859c672e08b4 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index f41df87..3d71ab1 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Instant messaging server which uses Matrix", "fr": "Un serveur de messagerie instantané basé sur Matrix" }, - "version": "1.15.2~ynh1", + "version": "1.16.0~ynh1", "url": "http://matrix.org", "license": "Apache-2.0", "maintainer": { From 9106143f2f57fb72dd4acd1cd39b01106f3f88c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 10 Jul 2020 22:53:23 +0000 Subject: [PATCH 02/13] Upgrade synapse to 1.16.1 --- README.md | 2 +- conf/armv7_buster.src | 4 ++-- conf/armv7_stretch.src | 4 ++-- manifest.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ea17062..be9faaa 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Instant messaging server matrix network. Yunohost chatroom with matrix : [https://riot.im/app/#/room/#yunohost:matrix.org](https://riot.im/app/#/room/#yunohost:matrix.org) -**Shipped version:** 1.16.0 +**Shipped version:** 1.16.1 ## Configuration diff --git a/conf/armv7_buster.src b/conf/armv7_buster.src index 3ccaa25..eed047b 100644 --- a/conf/armv7_buster.src +++ b/conf/armv7_buster.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.0/matrix-synapse_1.16.0-buster-bin1_armv7l.tar.gz -SOURCE_SUM=222525ec4735dfad0d46f90eb57b830d3350f6ca480996dab4465baef0cb7cbe +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.1/matrix-synapse_1.16.1-buster-bin1_armv7l.tar.gz +SOURCE_SUM=7c02ca189483cc0f6c6441b343c7348985a93bf9cd145331a3769f781d1d1bb9 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/armv7_stretch.src b/conf/armv7_stretch.src index 0b0ac9a..d5dd617 100644 --- a/conf/armv7_stretch.src +++ b/conf/armv7_stretch.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.0/matrix-synapse_1.16.0-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=01d13bf4966710e4f6eef834ab5ee3e40ed424fbd6336bb8d3c6859c672e08b4 +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.1/matrix-synapse_1.16.1-stretch-bin1_armv7l.tar.gz +SOURCE_SUM=ecc1636daebbae394bb7a0fa73c0ae6799a47ad914125bf156306069d61d7876 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index 3d71ab1..cca4228 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Instant messaging server which uses Matrix", "fr": "Un serveur de messagerie instantané basé sur Matrix" }, - "version": "1.16.0~ynh1", + "version": "1.16.1~ynh1", "url": "http://matrix.org", "license": "Apache-2.0", "maintainer": { From 10a728f38868f676ee518bc8985cc2d7ba20acc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Mon, 13 Jul 2020 22:59:56 +0000 Subject: [PATCH 03/13] Upgrade synapse to 1.17.0 --- README.md | 2 +- conf/armv7_buster.src | 4 ++-- conf/armv7_stretch.src | 4 ++-- manifest.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index be9faaa..ab8e7b9 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Instant messaging server matrix network. Yunohost chatroom with matrix : [https://riot.im/app/#/room/#yunohost:matrix.org](https://riot.im/app/#/room/#yunohost:matrix.org) -**Shipped version:** 1.16.1 +**Shipped version:** 1.17.0 ## Configuration diff --git a/conf/armv7_buster.src b/conf/armv7_buster.src index eed047b..2859027 100644 --- a/conf/armv7_buster.src +++ b/conf/armv7_buster.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.1/matrix-synapse_1.16.1-buster-bin1_armv7l.tar.gz -SOURCE_SUM=7c02ca189483cc0f6c6441b343c7348985a93bf9cd145331a3769f781d1d1bb9 +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.17.0/matrix-synapse_1.17.0-buster-bin1_armv7l.tar.gz +SOURCE_SUM=e0b8e41450fa45d6bd62cb97b4057188fee187dbf290b2d6c2f4877a38ee164a # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/armv7_stretch.src b/conf/armv7_stretch.src index d5dd617..4406a4a 100644 --- a/conf/armv7_stretch.src +++ b/conf/armv7_stretch.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.16.1/matrix-synapse_1.16.1-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=ecc1636daebbae394bb7a0fa73c0ae6799a47ad914125bf156306069d61d7876 +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.17.0/matrix-synapse_1.17.0-stretch-bin1_armv7l.tar.gz +SOURCE_SUM=f447fd3ef1ffaa200982e6ce6771ae9a47e4e389275be0eb1bb016a62feb343b # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index cca4228..e1ebbce 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Instant messaging server which uses Matrix", "fr": "Un serveur de messagerie instantané basé sur Matrix" }, - "version": "1.16.1~ynh1", + "version": "1.17.0~ynh1", "url": "http://matrix.org", "license": "Apache-2.0", "maintainer": { From 2a7f520d90c3cd16606ccebe0f69323cac490719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Jul 2020 23:41:53 +0200 Subject: [PATCH 04/13] Fix checkprocess --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 03fa32f..f751c6b 100644 --- a/check_process +++ b/check_process @@ -13,7 +13,7 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=db374d2bff981d2660ebdac52ee77c684383c00d - upgrade=1 from_commit=0571cc85334408a98f6766881b580a040fa6398a + upgrade=1 from_commit=d14be7e1a4bc37b7a9342abed98f6f0bafa70cf0 backup_restore=1 multi_instance=1 incorrect_path=0 @@ -24,5 +24,5 @@ ;;; Upgrade options ; commit=db374d2bff981d2660ebdac52ee77c684383c00d name=Fix postgresql helper from old_version_for_CI_2 branch - ; commit=0571cc85334408a98f6766881b580a040fa6398a + ; commit=d14be7e1a4bc37b7a9342abed98f6f0bafa70cf0 name=Migrate from self signed certificate to cert managed by Yunohost from old_version_for_CI_3 branch From 7a96b72c8a3e4e803c3dce6841c6b752ded4ebeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 23 Jul 2020 23:42:40 +0200 Subject: [PATCH 05/13] Fix Integration level infos --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ab8e7b9..fa23fa6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![](https://matrix.org/blog/wp-content/uploads/2015/01/logo1.png) -[![Integration level](https://dash.yunohost.org/integration/synapse.svg)](https://dash.yunohost.org/appci/app/synapse) +[![Integration level](https://dash.yunohost.org/integration/synapse.svg)](https://dash.yunohost.org/appci/app/synapse) ![](https://ci-apps.yunohost.org/ci/badges/synapse.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/synapse.maintain.svg) [![Install Synapse with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=synapse) > *This package allows you to install Synapse quickly and simply on a YunoHost server. @@ -104,9 +104,8 @@ Supported with LDAP. ### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/synapse%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/synapse/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/synapse%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/synapse/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/synapse%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/synapse/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/synapse%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/synapse/) ## Limitations From 4102871ef54c82beff668b0e49084c5a1cd52280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Jul 2020 00:34:52 +0200 Subject: [PATCH 06/13] Add port exposition in diagosis --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 09edb6d..8a6949b 100644 --- a/scripts/install +++ b/scripts/install @@ -431,8 +431,8 @@ setfacl -R -m user:turnserver:rwX /var/log/matrix-$app # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add matrix-$app --log "/var/log/matrix-$app/homeserver.log" -yunohost service add coturn-$app +yunohost service add matrix-$app --log "/var/log/matrix-$app/homeserver.log" --needs_exposed_ports $synapse_tls_port +yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port $turnserver_alt_tls_port #================================================= # RELOAD SERVICES diff --git a/scripts/restore b/scripts/restore index cf0cb62..3d01fba 100644 --- a/scripts/restore +++ b/scripts/restore @@ -128,8 +128,8 @@ systemctl enable coturn-$app.service # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add matrix-$app -l "/var/log/matrix-$app/homeserver.log" -yunohost service add coturn-$app +yunohost service add matrix-$app --log "/var/log/matrix-$app/homeserver.log" --needs_exposed_ports $synapse_tls_port +yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port $turnserver_alt_tls_port #================================================= # CREATE A DH FILE diff --git a/scripts/upgrade b/scripts/upgrade index 05860e2..dc96e06 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -424,6 +424,13 @@ ynh_store_file_checksum --file="$coturn_config_path" cp ../sources/Coturn_config_rotate.sh $final_path/ ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh" +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add matrix-$app --log "/var/log/matrix-$app/homeserver.log" --needs_exposed_ports $synapse_tls_port +yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port $turnserver_alt_tls_port + #================================================= # UPDATE SYSTEMD #================================================= From 2d14c10c53869443776def0f53483381ef2285f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Jul 2020 23:33:53 +0200 Subject: [PATCH 07/13] Add appservice support --- conf/homeserver.yaml | 4 ++-- scripts/install | 5 ++++- scripts/restore | 1 + scripts/upgrade | 5 ++++- sources/update_synapse_for_appservice.sh | 26 ++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 sources/update_synapse_for_appservice.sh diff --git a/conf/homeserver.yaml b/conf/homeserver.yaml index 83afbad..0084bf7 100644 --- a/conf/homeserver.yaml +++ b/conf/homeserver.yaml @@ -1017,8 +1017,8 @@ report_stats: __REPORT_STATS__ # A list of application service config files to use # #app_service_config_files: -# - app_service_1.yaml -# - app_service_2.yaml +# +## Managed by a specific config file in /etc/matrix-synapse/conf.d/app_service.yaml # Uncomment to enable tracking of application service IP addresses. Implicitly # enables MAU tracking for application service users. diff --git a/scripts/install b/scripts/install index 8a6949b..db835d9 100644 --- a/scripts/install +++ b/scripts/install @@ -381,14 +381,16 @@ ynh_script_progression --message="Configuring log rotation..." --weight=2 ynh_use_logrotate --logfile "/var/log/matrix-$app" #================================================= -# ADD SCRIPT FOR COTURN CRON +# ADD SCRIPT FOR COTURN CRON AND APP SERVICE #================================================= # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files cp ../sources/Coturn_config_rotate.sh $final_path/ +cp ../sources/update_synapse_for_appservice.sh $final_path/ ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh" +ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/update_synapse_for_appservice.sh" #================================================= # GENERIC FINALIZATION @@ -419,6 +421,7 @@ ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update # For any update do it in all files chown $synapse_user:root -R $final_path chmod 770 $final_path/Coturn_config_rotate.sh +chmod 700 $final_path/update_synapse_for_appservice.sh chown $synapse_user:root -R /var/lib/matrix-$app chown $synapse_user:root -R /var/log/matrix-$app chown $synapse_user:root -R /etc/matrix-$app diff --git a/scripts/restore b/scripts/restore index 3d01fba..c0d4616 100644 --- a/scripts/restore +++ b/scripts/restore @@ -230,6 +230,7 @@ ynh_use_logrotate --logfile /var/log/matrix-$app # For any update do it in all files chown $synapse_user:root -R $final_path chmod 770 $final_path/Coturn_config_rotate.sh +chmod 700 $final_path/update_synapse_for_appservice.sh chown $synapse_user:root -R /var/lib/matrix-$app chown $synapse_user:root -R /var/log/matrix-$app chown $synapse_user:root -R /etc/matrix-$app diff --git a/scripts/upgrade b/scripts/upgrade index dc96e06..27c86b8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -415,14 +415,16 @@ fi ynh_store_file_checksum --file="$coturn_config_path" #================================================= -# ADD SCRIPT FOR COTURN CRON +# ADD SCRIPT FOR COTURN CRON AND APP SERVICE #================================================= # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files cp ../sources/Coturn_config_rotate.sh $final_path/ +cp ../sources/update_synapse_for_appservice.sh $final_path/ ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh" +ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/update_synapse_for_appservice.sh" #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -473,6 +475,7 @@ ynh_permission_url --permission main --url $domain/_matrix/cas_server.php/login # For any update do it in all files chown $synapse_user:root -R $final_path chmod 770 $final_path/Coturn_config_rotate.sh +chmod 700 $final_path/update_synapse_for_appservice.sh chown $synapse_user:root -R /var/lib/matrix-$app chown $synapse_user:root -R /var/log/matrix-$app chown $synapse_user:root -R /etc/matrix-$app diff --git a/sources/update_synapse_for_appservice.sh b/sources/update_synapse_for_appservice.sh new file mode 100644 index 0000000..17bbca3 --- /dev/null +++ b/sources/update_synapse_for_appservice.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +app=__APP__ +service_config_file=/etc/matrix-$app/conf.d/app_service.yaml + +# Backup the previous config file +cp $service_config_file /tmp/app_service_backup.yaml + +echo "app_service_config_files:" > $service_config_file +for f in $(ls /etc/matrix-$app/app-service/); do + echo " - /etc/matrix-synapse/$app" >> $service_config_file +done + +# Set permissions +chown matrix-$app $service_config_file +chmod 600 $service_config_file + +systemctl restart matrix-$app + +if [ $? -eq 0 ]; then + rm /tmp/app_service_backup.yaml + exit 0 +else + echo "Failed to restart synapse with the new config file. Restore the old config file !!" + cp /tmp/app_service_backup.yaml $service_config_file +fi From f7a860dbbdf307c365cac25b5e2a62a3574a0fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 29 Jul 2020 22:52:58 +0200 Subject: [PATCH 08/13] Fix issues on upgrade of major debian version --- scripts/_common.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/install | 38 +++++------------------------------ scripts/restore | 4 ++++ scripts/upgrade | 43 +--------------------------------------- 4 files changed, 59 insertions(+), 75 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6cac827..933f113 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1 +1,50 @@ dependances="coturn build-essential python3-dev libffi-dev python3-pip python3-setuptools sqlite3 libssl-dev python3-venv libxml2-dev libxslt1-dev python3-lxml libjpeg-dev libpq-dev postgresql acl" +python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" + +install_sources() { + # Install/upgrade synapse in virtualenv + + # Clean venv is it was on python2.7 or python3 with old version in case major upgrade of debian + if [ ! -e $final_path/bin/python3 ] || [ ! -e $final_path/lib/python$python_version ]; then + ynh_secure_remove --file=$final_path + fi + + mkdir -p $final_path + + if [ -n "$(uname -m | grep arm)" ] + then + # Clean old file, sometimes it could make some big issues if we don't do this!! + ynh_secure_remove --file=$final_path/bin + ynh_secure_remove --file=$final_path/lib + ynh_secure_remove --file=$final_path/include + ynh_secure_remove --file=$final_path/share + + ynh_setup_source --dest_dir=$final_path/ --source_id="armv7_$(lsb_release --codename --short)" + + # Fix multi-instance support + for f in $(ls $final_path/bin); do + if ! [[ $f =~ "__" ]]; then + ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'$final_path --target_file=$final_path/bin/$f + fi + done + else + # Install virtualenv if it don't exist + test -e $final_path/bin/python3 || python3 -m venv $final_path + + # Install synapse in virtualenv + ynh_replace_string --match_string=__FINAL_PATH__ --replace_string=$final_path --target_file=$final_path/bin/activate + + # We set all necessary environement variable to create a python virtualenvironnement. + set +u; + source $final_path/bin/activate + set -u; + pip3 install --upgrade setuptools wheel + pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2 + pip3 install --upgrade 'Twisted>=20.3.0' matrix-synapse==$upstream_version matrix-synapse-ldap3 + + # This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does + set +u; + deactivate + set -u; + fi +} diff --git a/scripts/install b/scripts/install index db835d9..cf5141b 100644 --- a/scripts/install +++ b/scripts/install @@ -175,40 +175,9 @@ ynh_script_progression --message="Setting up source files..." --weight=50 mkdir -p /var/lib/matrix-$app mkdir -p /var/log/matrix-$app mkdir -p /etc/matrix-$app/conf.d -mkdir -p $final_path # Install synapse in virtualenv - -# WARNING : theses command are used in INSTALL, UPGRADE (2 times) -# For any update do it in all files -if [ -n "$(uname -m | grep arm)" ] -then - ynh_setup_source --dest_dir=$final_path/ --source_id="armv7_$(lsb_release --codename --short)" - - # Fix multi-instance support - for f in $(ls $final_path/bin); do - if ! [[ $f =~ "__" ]]; then - ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'$final_path --target_file=$final_path/bin/$f - fi - done -else - # Install virtualenv if it don't exist - test -e $final_path/bin/python3 || python3 -m venv $final_path - - # Install synapse in virtualenv - cp ../conf/virtualenv_activate $final_path/bin/activate - ynh_replace_string --match_string=__FINAL_PATH__ --replace_string=$final_path --target_file=$final_path/bin/activate - - # We set all necessary environement variable to create a python virtualenvironnement. - source $final_path/bin/activate - pip3 install --upgrade pip - pip3 install --upgrade setuptools wheel - pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2 - pip3 install --upgrade matrix-synapse==$upstream_version matrix-synapse-ldap3 - - # This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does - deactivate -fi +install_sources #================================================= # CREATE SMALL CAS SERVER @@ -228,14 +197,17 @@ chown $synapse_user:root -R $final_www_path ynh_script_progression --message="Creating synapse config..." --weight=3 # Go in virtualenvironnement -PS1=${PS1:-} +set +u; source $final_path/bin/activate +set -u; # Generate config python -m synapse.app.homeserver --keys-directory /etc/matrix-$app/ --generate-config --generate-keys --server-name $server_name --report-stats=no -c homeserver.yml # This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does +set +u; deactivate +set -u; # Get random values from config ynh_print_OFF diff --git a/scripts/restore b/scripts/restore index c0d4616..5a11cd1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -69,6 +69,10 @@ test ! -d $final_path \ ynh_script_progression --message="Restoring directory and configuration..." --weight=10 ynh_restore +# Check that the good python version is installed +# If not upgrade the source +install_sources + #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 27c86b8..e3b7d3e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,48 +143,7 @@ ynh_install_app_dependencies $dependances if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=6 - - # Install/upgrade synapse in virtualenv - - # Clean venv is it was on python2.7 - test -e $final_path/bin/python3 || ynh_secure_remove --file=$final_path - - # WARNING : these commands are used in INSTALL, UPGRADE - # For any update do it in all files - - if [ -n "$(uname -m | grep arm)" ] - then - # Clean old file, sometimes it could make some big issues if we don't do this!! - ynh_secure_remove --file=$final_path/bin - ynh_secure_remove --file=$final_path/lib - ynh_secure_remove --file=$final_path/include - ynh_secure_remove --file=$final_path/share - - ynh_setup_source --dest_dir=$final_path/ --source_id="armv7_$(lsb_release --codename --short)" - - # Fix multi-instance support - for f in $(ls $final_path/bin); do - if ! [[ $f =~ "__" ]]; then - ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'$final_path --target_file=$final_path/bin/$f - fi - done - else - # Install virtualenv if it don't exist - test -e $final_path/bin/python3 || python3 -m venv $final_path - - # Install synapse in virtualenv - cp ../conf/virtualenv_activate $final_path/bin/activate - ynh_replace_string --match_string=__FINAL_PATH__ --replace_string=$final_path --target_file=$final_path/bin/activate - - # We set all necessary environement variable to create a python virtualenvironnement. - source $final_path/bin/activate - pip3 install --upgrade setuptools wheel - pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2 - pip3 install --upgrade 'Twisted>=20.3.0' matrix-synapse==$upstream_version matrix-synapse-ldap3 - - # This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does - deactivate - fi + install_sources fi #================================================= From 884291e05ac09c959bee86c19a914ff1e90e2d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 30 Jul 2020 22:56:26 +0000 Subject: [PATCH 09/13] Upgrade synapse to 1.18.0 --- README.md | 2 +- conf/armv7_buster.src | 4 ++-- conf/armv7_stretch.src | 4 ++-- manifest.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fa23fa6..c0d1b36 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Instant messaging server matrix network. Yunohost chatroom with matrix : [https://riot.im/app/#/room/#yunohost:matrix.org](https://riot.im/app/#/room/#yunohost:matrix.org) -**Shipped version:** 1.17.0 +**Shipped version:** 1.18.0 ## Configuration diff --git a/conf/armv7_buster.src b/conf/armv7_buster.src index 2859027..6e52de5 100644 --- a/conf/armv7_buster.src +++ b/conf/armv7_buster.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.17.0/matrix-synapse_1.17.0-buster-bin1_armv7l.tar.gz -SOURCE_SUM=e0b8e41450fa45d6bd62cb97b4057188fee187dbf290b2d6c2f4877a38ee164a +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.18.0/matrix-synapse_1.18.0-buster-bin1_armv7l.tar.gz +SOURCE_SUM=bb86f8d87de8e76630eda501f1d7cf3294466d930a19c498268feab88d102dc8 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/armv7_stretch.src b/conf/armv7_stretch.src index 4406a4a..24eac53 100644 --- a/conf/armv7_stretch.src +++ b/conf/armv7_stretch.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.17.0/matrix-synapse_1.17.0-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=f447fd3ef1ffaa200982e6ce6771ae9a47e4e389275be0eb1bb016a62feb343b +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.18.0/matrix-synapse_1.18.0-stretch-bin1_armv7l.tar.gz +SOURCE_SUM=56a0e20bb0ca7f834ca1b5e570d8d75a4102f455251e8c8d2010e5b39f2a4d59 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index e1ebbce..3c0e95e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Instant messaging server which uses Matrix", "fr": "Un serveur de messagerie instantané basé sur Matrix" }, - "version": "1.17.0~ynh1", + "version": "1.18.0~ynh1", "url": "http://matrix.org", "license": "Apache-2.0", "maintainer": { From abe32f512a588ff6c703cf8e1f74956539604666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 31 Jul 2020 18:00:58 +0200 Subject: [PATCH 10/13] Update check_process --- check_process | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check_process b/check_process index f751c6b..e7fbe71 100644 --- a/check_process +++ b/check_process @@ -12,8 +12,8 @@ setup_private=0 setup_public=1 upgrade=1 - upgrade=1 from_commit=db374d2bff981d2660ebdac52ee77c684383c00d - upgrade=1 from_commit=d14be7e1a4bc37b7a9342abed98f6f0bafa70cf0 + upgrade=1 from_commit=fcbe10716aa2f9edbfc681093ca0d1f70903774b + upgrade=1 from_commit=5006cf1536f33d065aade2caa9b88120e0d1a381 backup_restore=1 multi_instance=1 incorrect_path=0 @@ -22,7 +22,7 @@ ;;; Levels Level 5=auto ;;; Upgrade options - ; commit=db374d2bff981d2660ebdac52ee77c684383c00d + ; commit=fcbe10716aa2f9edbfc681093ca0d1f70903774b name=Fix postgresql helper from old_version_for_CI_2 branch - ; commit=d14be7e1a4bc37b7a9342abed98f6f0bafa70cf0 + ; commit=5006cf1536f33d065aade2caa9b88120e0d1a381 name=Migrate from self signed certificate to cert managed by Yunohost from old_version_for_CI_3 branch From b4ab782fbabc0bf6747cf72bc637a913781faa3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 1 Aug 2020 14:17:33 +0200 Subject: [PATCH 11/13] Fix restore script --- scripts/restore | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/restore b/scripts/restore index 5a11cd1..d68aae3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -62,6 +62,15 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=70 + +# WARNING : theses command are used in INSTALL, UPGRADE, RESTORE +# For any update do it in all files +ynh_install_app_dependencies $dependances + #================================================= # RESTORE ALL CONFIG AND DATA #================================================= @@ -71,6 +80,7 @@ ynh_restore # Check that the good python version is installed # If not upgrade the source +ynh_script_progression --message="Check for source up to date..." --weight=5 install_sources #================================================= @@ -82,15 +92,6 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= # SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=70 - -# WARNING : theses command are used in INSTALL, UPGRADE, RESTORE -# For any update do it in all files -ynh_install_app_dependencies $dependances - #================================================= # RECREATE THE DEDICATED USER #================================================= From 108dd2b6232d7c52b35730860b55206ea526a31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 2 Aug 2020 23:47:45 +0200 Subject: [PATCH 12/13] Force upgrade of source if python version is not good --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index e3b7d3e..01f1723 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -140,7 +140,7 @@ ynh_install_app_dependencies $dependances # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] +if [ "$upgrade_type" == "UPGRADE_APP" ] || [ ! -e $final_path/bin/python3 ] || [ ! -e $final_path/lib/python$python_version ] then ynh_script_progression --message="Upgrading source files..." --weight=6 install_sources From e91d30a76b9dfda82fe691da533e52692be9a904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 6 Aug 2020 23:11:52 +0200 Subject: [PATCH 13/13] Fix app-service script --- sources/update_synapse_for_appservice.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/update_synapse_for_appservice.sh b/sources/update_synapse_for_appservice.sh index 17bbca3..fef9ed8 100644 --- a/sources/update_synapse_for_appservice.sh +++ b/sources/update_synapse_for_appservice.sh @@ -8,7 +8,7 @@ cp $service_config_file /tmp/app_service_backup.yaml echo "app_service_config_files:" > $service_config_file for f in $(ls /etc/matrix-$app/app-service/); do - echo " - /etc/matrix-synapse/$app" >> $service_config_file + echo " - /etc/matrix-$app/app-service/$f" >> $service_config_file done # Set permissions