From 2e6720e341aad04c189216d1f79441eae44aae2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 26 Nov 2019 21:51:08 +0000 Subject: [PATCH 1/3] Upgrade synapse to 1.6.0 --- README.md | 2 +- conf/armv7_stretch.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26dc000..1c03eee 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.5.1 +**Shipped version:** 1.6.0 ## Configuration diff --git a/conf/armv7_stretch.src b/conf/armv7_stretch.src index ca147fe..a69cdbb 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.5.1/matrix-synapse_1.5.1-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=34e09433ef07b41a20125f5505bda98358233ff27e6e2248f3d70a72e423c9dd +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.6.0/matrix-synapse_1.6.0-stretch-bin1_armv7l.tar.gz +SOURCE_SUM=46b38c4f365212c46bd605959656c0bba73daa5cc663d61e6e2a59206b73fda2 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index ebc6149..38de380 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Instant messaging server who use matrix", "fr": "Un serveur de messagerie instantané basé sur matrix" }, - "version": "1.5.1~ynh1", + "version": "1.6.0~ynh1", "url": "http://matrix.org", "license": "Apache-2.0", "maintainer": { From b70db793d4cc8862003f756e6347bc39bbc8ddc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 28 Nov 2019 21:51:39 +0000 Subject: [PATCH 2/3] Upgrade synapse to 1.6.1 --- README.md | 2 +- conf/armv7_stretch.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c03eee..ed5cdc9 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.6.0 +**Shipped version:** 1.6.1 ## Configuration diff --git a/conf/armv7_stretch.src b/conf/armv7_stretch.src index a69cdbb..4652387 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.6.0/matrix-synapse_1.6.0-stretch-bin1_armv7l.tar.gz -SOURCE_SUM=46b38c4f365212c46bd605959656c0bba73daa5cc663d61e6e2a59206b73fda2 +SOURCE_URL=https://github.com/YunoHost-Apps/synapse_python_build/releases/download/v1.6.1/matrix-synapse_1.6.1-stretch-bin1_armv7l.tar.gz +SOURCE_SUM=4836bd5fefdd9855a329b470875a7bc9f795755c72718670421009bc47826c35 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index 38de380..eb81f72 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Instant messaging server who use matrix", "fr": "Un serveur de messagerie instantané basé sur matrix" }, - "version": "1.6.0~ynh1", + "version": "1.6.1~ynh1", "url": "http://matrix.org", "license": "Apache-2.0", "maintainer": { From 663ae2c35274c4b83c5140a60a7fd4aad5ce5b40 Mon Sep 17 00:00:00 2001 From: Thatoo Date: Sun, 1 Dec 2019 22:18:56 +0100 Subject: [PATCH 3/3] well-known support (#136) * Update README.md * Update manifest.json * a * Delete a * avoid boolean for public but ask a clear choice Yes/No * Update check_process Add server_name="domain2.tld" (DOMAIN) * .well-known DNS conf become optionnal with .well-known edition * .well-known redirection for access by federation Create .well-known redirection for access by federation * .well-known redirection for access by federation If not existing, create .well-known redirection for access by federation * Update README.md back to 0.99.5.2 * back to 0.99.5.2 * back to 0.99.5.2 * back to 0.99.5.2 * Update install * Update upgrade * Update install * Update upgrade * Update install * Update upgrade * Update .well-known redirection for access by federation and applications like Riot.im * Update .well-known redirection for access by federation and applications like Riot.im * update to 1.1.0 * update to 1.1.0 * update to 1.1.0 * update to 1.1.0 * update to 1.1.0 * update to 1.1.0 * Update install * Update upgrade * Update to 1.2.1 * Update to 1.2.1 * Update to 1.2.1 * Back to v1.1.0 * Back to v1.1.0 * Back to v1.1.0 * Update to v1.2.1 * Update to v1.2.1 * Update to v1.2.1 * Important update of upgrade script ynh_replace_string __SERVER_NAME__ $server_name "$homeserver_config_path" was missing * Back to v1.1.0 * Back to v1.1.0 * Back to v1.1.0 * Fix typo for ipv6 validation * Upgrade to v1.2.1 * Upgrade to v1.2.1 * Upgrade to v1.2.1 * remove server_name's nginx conf remove /etc/nginx/conf.d/${server_name}.d/server_name.conf * Create server_name.conf To allow the automatic well-known system for server-name detection instead of DNS record * Update install In # Create .well-known redirection for access by federation change cat > /etc/nginx/conf.d/${server_name}.d/server_name.conf < /etc/nginx/conf.d/${server_name}.d/server_name.conf < * Update install * Update README.md Co-Authored-By: Josue-T * Update scripts/upgrade Co-Authored-By: Josue-T * Update conf/server_name.conf Co-Authored-By: Josue-T * move .well-known redirection to config section move #Create .well-known redirection for access by federation to end of config section * move .well-known redirection to config section move #Create .well-known redirection to the end of config section and Indentation * add checksum management for server_name.conf add checksum management for server_name.conf with the helper ynh_store_file_checksum * add checksum management for server_name.conf add checksum management for server_name.conf with the helper ynh_store_file_checksum * replace __SERVER_NAME__ * replace __SERVER_NAME__ * delete a blank line * Update upgrade * Update install * Update check_process Co-Authored-By: Josue-T * Update conf/server_name.conf Co-Authored-By: Josue-T * remove blank line * ynh_store_file_checksum after cp inside if block * change order checksum and cp change order to ynh_backup_if_checksum_is_different then cp then ynh_store_file_checksum * Update install * Update upgrade * Update backup * Update backup * Update scripts/backup Co-Authored-By: Josue-T * Update scripts/install Co-Authored-By: Josue-T * Update scripts/install Co-Authored-By: Josue-T * Update scripts/install Co-Authored-By: Josue-T * Update install * Update remove * Update upgrade --- README.md | 2 +- check_process | 1 + conf/server_name.conf | 5 +++++ scripts/backup | 5 +++++ scripts/install | 10 ++++++++++ scripts/remove | 2 ++ scripts/upgrade | 10 ++++++++++ 7 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 conf/server_name.conf diff --git a/README.md b/README.md index 26dc000..23215b0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ If you want a web client you can also install riot with this package: https://gi If your server name is identical to the domain on which synapse is installed, and the default port 8448 is used, your server is normally already accessible by the federation. -If not, you may need to put the following line in the dns configuration: +If not, you can add the following line in the dns configuration but you normally don't need it as a .well-known file is edited during the install to declare your server name and port to the federation. ``` _matrix._tcp. IN SRV 10 0 diff --git a/check_process b/check_process index e10908b..d232ff7 100644 --- a/check_process +++ b/check_process @@ -3,6 +3,7 @@ domain="domain.tld" (DOMAIN) path="/_matrix/static/" (PATH) is_public=1 (PUBLIC|public=1|private=0) + server_name="domain2.tld" (DOMAIN) ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/conf/server_name.conf b/conf/server_name.conf new file mode 100644 index 0000000..3a1718f --- /dev/null +++ b/conf/server_name.conf @@ -0,0 +1,5 @@ + location /.well-known/matrix/ { + return 200 '{"m.server": "__DOMAIN__:__PORT__"}'; + add_header Content-Type application/json; + add_header Access-Control-Allow-Origin '*'; +} diff --git a/scripts/backup b/scripts/backup index 7c1727a..2f181ef 100644 --- a/scripts/backup +++ b/scripts/backup @@ -25,6 +25,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) +server_name=$(ynh_app_setting_get --app=$app --key=server_name) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -51,6 +52,10 @@ ynh_backup --src_path="$final_path" ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +if yunohost --output-as plain domain list | grep -q "^$server_name$" +then + ynh_backup --src_path="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" +fi #================================================= # BACKUP THE POSTGRESQL DATABASE diff --git a/scripts/install b/scripts/install index 4a8280a..7d6226c 100644 --- a/scripts/install +++ b/scripts/install @@ -293,6 +293,16 @@ 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/remove b/scripts/remove index 8c11c69..a7d5f55 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,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) +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) turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) @@ -91,6 +92,7 @@ ynh_secure_remove --file=/var/log/matrix-$app ynh_secure_remove --file=/etc/matrix-$app ynh_secure_remove --file=/etc/default/matrix-$app ynh_secure_remove --file=/etc/default/coturn-$app +ynh_secure_remove --file=/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 892f552..1839deb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -212,6 +212,16 @@ 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 #=================================================