From a6eb228585fccf217189e791f854d3f8d9d98581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 14 Dec 2019 15:11:33 +0100 Subject: [PATCH 1/7] Replace special_domain and special_path by domain and path --- actions.toml | 2 +- scripts/backup | 2 +- scripts/config | 2 +- scripts/install | 9 +++------ scripts/remove | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 19 +++++++++++++++++-- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/actions.toml b/actions.toml index 343ca1c..42932d4 100644 --- a/actions.toml +++ b/actions.toml @@ -21,7 +21,7 @@ description = "Close the ports range 49153:49193 with TCP and UDP. (Undo \"Open [set_admin_user] name = "Set a user as admin" -command = "[[ \"$(su --command=\"psql matrix_synapse\" postgres <<< \"UPDATE users SET admin = 1 WHERE name = '@$YNH_ACTION_USERNAME:$(yunohost app setting $YNH_APP_INSTANCE_NAME special_domain)'\")\" == 'UPDATE 1' ]]" +command = "[[ \"$(su --command=\"psql matrix_synapse\" postgres <<< \"UPDATE users SET admin = 1 WHERE name = '@$YNH_ACTION_USERNAME:$(yunohost app setting $YNH_APP_INSTANCE_NAME domain)'\")\" == 'UPDATE 1' ]]" user = "root" accepted_return_codes = [0] description = "Set a synapse user as admin in the synapse server. It probably usefull only to manage the community function." diff --git a/scripts/backup b/scripts/backup index 2f181ef..d63121e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -24,7 +24,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=special_domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) server_name=$(ynh_app_setting_get --app=$app --key=server_name) final_path=$(ynh_app_setting_get --app=$app --key=final_path) diff --git a/scripts/config b/scripts/config index e50f3a2..f7ceb4a 100644 --- a/scripts/config +++ b/scripts/config @@ -70,7 +70,7 @@ apply_config() { ynh_app_setting_set --app $app --key disable_backup_before_upgrade --value 1 fi - domain=$(ynh_app_setting_get --app $app --key special_domain) + domain=$(ynh_app_setting_get --app $app --key domain) server_name=$(ynh_app_setting_get --app $app --key server_name) synapse_db_pwd=$(ynh_app_setting_get --app $app --key synapse_db_pwd) is_public=$(ynh_app_setting_get --app $app --key is_public) diff --git a/scripts/install b/scripts/install index 7144079..6550690 100644 --- a/scripts/install +++ b/scripts/install @@ -72,12 +72,9 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde #================================================= ynh_script_progression --message="Storing installation settings..." --weight=1 -# For the domain and the path we can't use the standard keys "domain" and "path" with the standard function ynh_webpath_register because it create automatically a button on the user pannel. -# The idea is to create a custom key (specia_domain and special_path instead of domain and key). -# By this the ssowatconf fonction don't create a button on the pannel. -# This hack solve the issue : https://github.com/YunoHost-Apps/synapse_ynh/issues/14 -ynh_app_setting_set --app=$app --key=special_domain --value=$domain -ynh_app_setting_set --app=$app --key=special_path --value=$path_url +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=no_sso --value true ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=synapse_version --value=$upstream_version diff --git a/scripts/remove b/scripts/remove index a7d5f55..605838d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=3 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=special_domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) server_name=$(ynh_app_setting_get --app=$app --key=server_name) final_path=$(ynh_app_setting_get --app=$app --key=final_path) synapse_tls_port=$(ynh_app_setting_get --app=$app --key=synapse_tls_port) diff --git a/scripts/restore b/scripts/restore index 7073f1c..0cf641f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,9 +29,9 @@ ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=special_domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) server_name=$(ynh_app_setting_get --app=$app --key=server_name) -path_url=$(ynh_app_setting_get --app=$app --key=special_path) +path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) synapse_tls_port=$(ynh_app_setting_get --app=$app --key=synapse_tls_port) turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) diff --git a/scripts/upgrade b/scripts/upgrade index c134a1e..0174af2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,9 +17,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=3 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=special_domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) server_name=$(ynh_app_setting_get --app=$app --key=server_name) -path_url=$(ynh_app_setting_get --app=$app --key=special_path) +path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) synapse_old_version=$(ynh_app_setting_get --app=$app --key=synapse_version) is_public=$(ynh_app_setting_get --app=$app --key=is_public) @@ -92,6 +92,21 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS +#================================================= +# MIGRATION 5 : GENERATE SYNAPSE SECRET +#================================================= + +# Migrate from settings 'special_domain' to 'domain' and 'special_path' to 'path' +if [ -z $domain ]; then + domain=$(ynh_app_setting_get --app=$app --key=special_domain) + path_url=$(ynh_app_setting_get --app=$app --key=special_path) + ynh_app_setting_set --app=$app --key=domain --value=$domain + ynh_app_setting_set --app=$app --key=path --value=$path_url + ynh_app_setting_delete -app=$app --key=special_domain + ynh_app_setting_delete -app=$app --key=special_path + ynh_app_setting_set --app=$app --key=no_sso --value true +fi + #================================================= # INSTALL DEPENDENCIES #================================================= From 11aabdf5c9373346e16316ff3d528b99b95c9191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 14 Dec 2019 15:14:27 +0100 Subject: [PATCH 2/7] Move well-known config in nginx section --- scripts/install | 19 +++++++++---------- scripts/upgrade | 19 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index 6550690..5fd48a2 100644 --- a/scripts/install +++ b/scripts/install @@ -246,6 +246,15 @@ ynh_script_progression --message="Configuring nginx web server..." --weight=2 ynh_add_nginx_config +# Create .well-known redirection for access by federation +if yunohost --output-as plain domain list | grep -q "^$server_name$" +then + cp ../conf/server_name.conf /etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf + ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" + ynh_replace_string --match_string=__PORT__ --replace_string=$synapse_tls_port --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" +fi + #================================================= # SET SYNAPSE CONFIG #================================================= @@ -296,16 +305,6 @@ fi ynh_store_file_checksum --file="$homeserver_config_path" ynh_store_file_checksum --file="/etc/matrix-$app/log.yaml" - -# Create .well-known redirection for access by federation -if yunohost --output-as plain domain list | grep -q "^$server_name$" -then - cp ../conf/server_name.conf /etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf - ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" - ynh_replace_string --match_string=__PORT__ --replace_string=$synapse_tls_port --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" - ynh_store_file_checksum --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" -fi - #================================================= # SET COTURN CONFIG #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 0174af2..6a8c0f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -251,16 +251,6 @@ fi ynh_store_file_checksum --file="$homeserver_config_path" ynh_store_file_checksum --file="/etc/matrix-$app/log.yaml" -# Create .well-known redirection for access by federation if it doesn't exist -if yunohost --output-as plain domain list | grep -q "^$server_name$" -then - ynh_backup_if_checksum_is_different --file=/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf - cp ../conf/server_name.conf /etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf - ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" - ynh_replace_string --match_string=__PORT__ --replace_string=$synapse_tls_port --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" - ynh_store_file_checksum --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" -fi - #================================================= # MIGRATION 2 : MULTINSTANCE SUPPORT #================================================= @@ -336,6 +326,15 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config +# Create .well-known redirection for access by federation +if yunohost --output-as plain domain list | grep -q "^$server_name$" +then + cp ../conf/server_name.conf /etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf + ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" + ynh_replace_string --match_string=__PORT__ --replace_string=$synapse_tls_port --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" +fi + #================================================= # SPECIFIC UPGRADE #================================================= From ac7d2bb35b322f796ffda7a3dba221b86529c22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 14 Dec 2019 15:15:25 +0100 Subject: [PATCH 3/7] Create change-url script --- check_process | 2 +- scripts/change_url | 148 +++++++++++++++++++++++++++++++++++++++++++++ scripts/config | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 5 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 scripts/change_url diff --git a/check_process b/check_process index d232ff7..36712d8 100644 --- a/check_process +++ b/check_process @@ -18,7 +18,7 @@ multi_instance=1 incorrect_path=0 port_already_use=1 (8448) - change_url=0 + change_url=1 ;;; Levels Level 5=auto ;;; Upgrade options diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..59a44c5 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,148 @@ +#!/bin/bash + +#================================================= +# GENERIC START +#================================================= + +# IMPORT GENERIC HELPERS +source /usr/share/yunohost/helpers + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + +ynh_script_progression --message="Loading installation settings..." + +# RETRIEVE ARGUMENTS +old_domain=$YNH_APP_OLD_DOMAIN +domain=$YNH_APP_NEW_DOMAIN +path_url=$(ynh_normalize_url_path --path_url $YNH_APP_NEW_PATH) +app=$YNH_APP_INSTANCE_NAME + +server_name=$(ynh_app_setting_get --app=$app --key=server_name) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +synapse_old_version=$(ynh_app_setting_get --app=$app --key=synapse_version) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +port=$(ynh_app_setting_get --app=$app --key=synapse_port) +synapse_tls_port=$(ynh_app_setting_get --app=$app --key=synapse_tls_port) +turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) +turnserver_alt_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_alt_tls_port) +cli_port=$(ynh_app_setting_get --app=$app --key=cli_port) +report_stats=$(ynh_app_setting_get --app=$app --key=report_stats) +allow_public_rooms=$(ynh_app_setting_get --app=$app --key=allow_public_rooms) +ynh_print_OFF +synapse_db_pwd=$(ynh_app_setting_get --app=$app --key=synapse_db_pwd) +turnserver_pwd=$(ynh_app_setting_get --app=$app --key=turnserver_pwd) +registration_shared_secret=$(ynh_app_setting_get --app=$app --key=registration_shared_secret) +form_secret=$(ynh_app_setting_get --app=$app --key=form_secret) +macaroon_secret_key=$(ynh_app_setting_get --app=$app --key=macaroon_secret_key) +ynh_print_ON + +synapse_user="matrix-$app" +synapse_db_name="matrix_$app" +synapse_db_user="matrix_$app" +upstream_version=$(ynh_app_upstream_version) + +# Check if the new path stay /_matrix if not exit + +if [[ $path_url != "/_matrix" ]] +then + ynh_die --message "You can't use an other path than '/_matrix'. You can only change the domain." +fi + +# We stop the service before to set ynh_clean_setup +ynh_systemd_action --service_name=matrix-$app.service --action=stop + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# NGINX CONFIGURATION +#================================================= + +ynh_script_progression --message="Updating nginx configuration..." + +# MODIFY URL IN NGINX CONF +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the domain for nginx +# Delete file checksum for the old conf file location +ynh_delete_file_checksum --file "$nginx_conf_path" +mv $nginx_conf_path /etc/nginx/conf.d/$domain.d/$app.conf +# Store file checksum for the new config file location +ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf" + +# Create .well-known redirection for access by federation +if yunohost --output-as plain domain list | grep -q "^$server_name$" +then + cp ../conf/server_name.conf /etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf + ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" + ynh_replace_string --match_string=__PORT__ --replace_string=$synapse_tls_port --target_file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" +fi + +#================================================= +# UPDATE SYNAPSE CONFIG +#================================================= + +ynh_script_progression --message="Updating synapse config..." --weight=2 + +# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) +# For any update do it in all files + +homeserver_config_path="/etc/matrix-$app/homeserver.yaml" + +ynh_backup_if_checksum_is_different --file="$homeserver_config_path" +ynh_backup_if_checksum_is_different --file=/etc/matrix-$app/log.yaml + +cp ../conf/homeserver.yaml "$homeserver_config_path" +cp ../conf/log.yaml /etc/matrix-$app/log.yaml + +ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__SERVER_NAME__ --replace_string=$server_name --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__SYNAPSE_DB_USER__ --replace_string=$synapse_db_user --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__PORT__ --replace_string=$port --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__TLS_PORT__ --replace_string=$synapse_tls_port --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__TURNSERVER_TLS_PORT__ --replace_string=$turnserver_tls_port --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__REPORT_STATS__ --replace_string="$report_stats" --target_file="$homeserver_config_path" +ynh_replace_string --match_string=__ALLOW_PUBLIC_ROOMS__ --replace_string="$allow_public_rooms" --target_file="$homeserver_config_path" +ynh_print_OFF +ynh_replace_special_string --match_string=__SYNAPSE_DB_PWD__ --replace_string=$synapse_db_pwd --target_file="$homeserver_config_path" +ynh_replace_special_string --match_string=__TURNPWD__ --replace_string=$turnserver_pwd --target_file="$homeserver_config_path" +ynh_replace_special_string --match_string=__REGISTRATION_SECRET__ --replace_string="$registration_shared_secret" --target_file="$homeserver_config_path" +ynh_replace_special_string --match_string=__FORM_SECRET__ --replace_string="$form_secret" --target_file="$homeserver_config_path" +if [ -n $macaroon_secret_key ]; then + # Well, in this package this value was not managed because it was not needed, synapse is able to generate this with some other secret in the config file but after some vulnerability was found with this practice. + # For more detail about this issue you can see : https://matrix.org/blog/2019/01/15/further-details-on-critical-security-update-in-synapse-affecting-all-versions-prior-to-0-34-1-cve-2019-5885/ + # The problem is that we can't just say generate a new value if the package has not already defined a value. The reason is that changing this value logout all user. And in case of a user has enabled the encryption, the user might lost all conversation !! + # So for the old install we just leave this as it is. And for the new install we use a real macaroon. + ynh_replace_special_string --match_string='macaroon_secret_key: "__MACAROON_SECRET_KEY__"' --replace_string='# macaroon_secret_key: "__MACAROON_SECRET_KEY__"' --target_file="$homeserver_config_path" +else + ynh_replace_special_string --match_string=__MACAROON_SECRET_KEY__ --replace_string="$macaroon_secret_key" --target_file="$homeserver_config_path" +fi +ynh_print_ON + +ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="/etc/matrix-$app/log.yaml" + +if [ "$is_public" = "0" ] +then + ynh_replace_string --match_string=__ALLOWED_ACCESS__ --replace_string=False --target_file="$homeserver_config_path" +else + ynh_replace_string --match_string=__ALLOWED_ACCESS__ --replace_string=True --target_file="$homeserver_config_path" +fi + +ynh_store_file_checksum --file="$homeserver_config_path" +ynh_store_file_checksum --file="/etc/matrix-$app/log.yaml" + +#================================================= +# RELOAD SERVICES +#================================================= +ynh_script_progression --message="Restarting synapse services..." --weight=5 + +ynh_systemd_action --service_name=coturn-$app.service --action=restart +ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 + +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/config b/scripts/config index f7ceb4a..582723a 100644 --- a/scripts/config +++ b/scripts/config @@ -88,7 +88,7 @@ apply_config() { # Configure Synapse - # WARNING : theses command are used in INSTALL, UPGRADE, CONFIG (3 times) + # WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # For any update do it in all files homeserver_config_path="/etc/matrix-$app/homeserver.yaml" diff --git a/scripts/install b/scripts/install index 5fd48a2..8856fe1 100644 --- a/scripts/install +++ b/scripts/install @@ -268,7 +268,7 @@ ynh_print_ON # Configure Synapse -# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG (3 times) +# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # For any update do it in all files homeserver_config_path="/etc/matrix-$app/homeserver.yaml" diff --git a/scripts/upgrade b/scripts/upgrade index 6a8c0f0..1c5e7e6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -203,7 +203,7 @@ fi #================================================= ynh_script_progression --message="Updating synapse config..." --weight=2 -# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG +# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # For any update do it in all files homeserver_config_path="/etc/matrix-$app/homeserver.yaml" From 4d88fe3033f4f7937a3bde56c64ecf5770f3b87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 18 Dec 2019 20:36:05 +0100 Subject: [PATCH 4/7] Fix argument in upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 1c5e7e6..d27c95d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,8 +102,8 @@ if [ -z $domain ]; then path_url=$(ynh_app_setting_get --app=$app --key=special_path) ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url - ynh_app_setting_delete -app=$app --key=special_domain - ynh_app_setting_delete -app=$app --key=special_path + ynh_app_setting_delete --app=$app --key=special_domain + ynh_app_setting_delete --app=$app --key=special_path ynh_app_setting_set --app=$app --key=no_sso --value true fi From a393698f19bfd1cdc3a61a7909f9fdcd238ed349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 18 Dec 2019 20:50:48 +0100 Subject: [PATCH 5/7] Fix settings migration --- scripts/upgrade | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d27c95d..0552f01 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -64,10 +64,6 @@ then ynh_die --message="Update from this synapse version is not available. You need to remove this package and reinstall the new package version." fi -if [ -z $server_name ]; then - server_name=$domain - ynh_app_setting_set $app server_name $domain -fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -93,7 +89,7 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS #================================================= -# MIGRATION 5 : GENERATE SYNAPSE SECRET +# MIGRATION 5 : Manage old settings #================================================= # Migrate from settings 'special_domain' to 'domain' and 'special_path' to 'path' @@ -107,6 +103,12 @@ if [ -z $domain ]; then ynh_app_setting_set --app=$app --key=no_sso --value true fi +# Define $server_name if not already defined +if [ -z $server_name ]; then + server_name=$domain + ynh_app_setting_set $app server_name $domain +fi + #================================================= # INSTALL DEPENDENCIES #================================================= From cc47a56e0dee4da3e8d4a1671cc3b381dda863dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 19 Dec 2019 22:03:39 +0100 Subject: [PATCH 6/7] Fix upgrade commit --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 36712d8..dc9a7b6 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=0b830d9e4eadefb907f1f30a02ffbb84778f91fc + upgrade=1 from_commit=0b8f2d4423bc48a1509dc0be4e231f02a0046eca 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=0b830d9e4eadefb907f1f30a02ffbb84778f91fc + ; commit=0b8f2d4423bc48a1509dc0be4e231f02a0046eca name=Migrate from self signed certificate to cert managed by Yunohost From dd309b24bdb17326bd2e11c918a57bddcbe623b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 21 Dec 2019 14:54:54 +0100 Subject: [PATCH 7/7] Disable change-url test We can't do this test because the path is fixed '/_matrix'.$ So the change-url script is only used to change the domain. --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index dc9a7b6..2c18177 100644 --- a/check_process +++ b/check_process @@ -18,7 +18,7 @@ multi_instance=1 incorrect_path=0 port_already_use=1 (8448) - change_url=1 + change_url=0 ;;; Levels Level 5=auto ;;; Upgrade options