From ef51fe721f7731db1acc530cd09fccf8fdc3a44f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 15:58:58 +0100 Subject: [PATCH 01/33] Fix settings in install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 7be651a..e1d1c5a 100755 --- a/scripts/install +++ b/scripts/install @@ -66,7 +66,7 @@ ynh_exec_warn_less yunohost firewall allow TCP $tls_port # Store opened ports ynh_app_setting_set --app=$app --key=port --value=$port -ynh_app_setting_set --app=$app --key=port --value=$port +ynh_app_setting_set --app=$app --key=tls_port --value=$tls_port #================================================= # INSTALL DEPENDENCIES @@ -88,7 +88,7 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=4 ynh_print_OFF db_pwd=$(ynh_string_random --length=30) -ynh_app_setting_set --app=$app --key=synapse_db_pwd --value=$db_pwd +ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_print_ON # Create postgresql database From a839954d94848eafa82d3d7366821e9b2e387c93 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:01:46 +0100 Subject: [PATCH 02/33] Proper db_name in install --- scripts/install | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index e1d1c5a..f644405 100755 --- a/scripts/install +++ b/scripts/install @@ -93,11 +93,13 @@ ynh_print_ON # Create postgresql database ynh_psql_test_if_first_run +db_name=$app ynh_print_OFF -ynh_psql_create_user $app $db_pwd +ynh_psql_create_user $db_name $db_pwd ynh_print_ON ynh_psql_execute_as_root \ ---sql="CREATE DATABASE $app ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;" +--sql="CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;" +ynh_app_setting_set --app=$app --key=db_name --value=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From 3fe3c16f667e35bf020ff16c60c0ffc2a8088e96 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:17:11 +0100 Subject: [PATCH 03/33] Fix backup --- scripts/backup | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/scripts/backup b/scripts/backup index 6ea8892..20d4f9a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,7 +31,6 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -55,19 +54,6 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - #================================================= # SPECIFIC BACKUP #================================================= @@ -86,19 +72,12 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/cron.d/$app" - -ynh_backup --src_path="/etc/$app/" - #================================================= -# BACKUP THE MYSQL DATABASE +# BACKUP THE PSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info --message="Backing up the PSQL database..." -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT From fd7a5c118e82f8b4009ae3a4e8b571fd99886c43 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:22:13 +0100 Subject: [PATCH 04/33] Fix restore --- scripts/restore | 52 ++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/scripts/restore b/scripts/restore index c334a77..04baa3f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,7 +33,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -73,41 +72,33 @@ ynh_system_user_create --username=$app #================================================= # Restore permissions on app files -chown -R root: $final_path - -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# RESTORE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the Fail2Ban configuration..." --time --weight=1 - -ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" -ynh_systemd_action --action=restart --service_name=fail2ban +chown -R $app:root $final_path +mkdir -p /var/log/$app +chown -R $app:root /var/log/$app #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +if ! command -v /usr/local/go/bin/go &> /dev/null +then + ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 + ynh_setup_source --source_id="go" --dest_dir="/usr/local/" +fi + +export PATH=$PATH:/usr/local/go/bin +env_path=$PATH #================================================= -# RESTORE THE MYSQL DATABASE +# RESTORE THE PSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1 +ynh_script_progression --message="Restoring the PSQL database..." --weight=1 -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RESTORE SYSTEMD @@ -122,7 +113,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE @@ -135,10 +126,6 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap # RESTORE VARIOUS FILES #================================================= -ynh_restore_file --origin_path="/etc/cron.d/$app" - -ynh_restore_file --origin_path="/etc/$app/" - #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -148,11 +135,10 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= From 8ad6d6aff841808f412802daeb69ee521b536d79 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:41:33 +0100 Subject: [PATCH 05/33] Fix upgrade --- scripts/upgrade | 64 +++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 50 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6e61d9f..ed2c219 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,10 +18,8 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= @@ -39,25 +37,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 - -# -# N.B. : the followings setting migrations snippets are provided as *EXAMPLES* -# of what you may want to do in some cases (e.g. a setting was not defined on -# some legacy installs and you therefore want to initiaze stuff during upgrade) -# - -# If db_name doesn't exist, create it -#if [ -z "$db_name" ]; then -# db_name=$(ynh_sanitize_dbid --db_name=$app) -# ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#fi - -# If final_path doesn't exist, create it -#if [ -z "$final_path" ]; then -# final_path=/var/www/$app -# ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#fi +#ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -105,9 +85,16 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 -ynh_install_app_dependencies $pkg_dependencies +# TODO: check Go version and upgrade if needed +if ! command -v /usr/local/go/bin/go &> /dev/null +then + ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 + ynh_setup_source --source_id="go" --dest_dir="/usr/local/" +fi + +export PATH=$PATH:/usr/local/go/bin +env_path=$PATH #================================================= # CREATE DEDICATED USER @@ -117,14 +104,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1 - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config - #================================================= # SPECIFIC UPGRADE #================================================= @@ -143,15 +122,6 @@ ynh_add_systemd_config # MODIFY A CONFIG FILE #================================================= -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" - -ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" - -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= @@ -159,7 +129,9 @@ ynh_store_file_checksum --file="$final_path/CONFIG_FILE" #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R $app:root $final_path +mkdir -p /var/log/$app +chown -R $app:root /var/log/$app #================================================= # SETUP LOGROTATE @@ -174,7 +146,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE @@ -183,14 +155,6 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# UPGRADE FAIL2BAN -#================================================= -ynh_script_progression --message="Reconfiguring Fail2Ban..." --time --weight=1 - -# Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # SETUP SSOWAT #================================================= From 0d326165a769cc75aa2c0f9893cc6f24d06dde96 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:42:19 +0100 Subject: [PATCH 06/33] Not using pkg_dependencies yet --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index d11cbe1..6a0fc98 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="golang-go" +#pkg_dependencies="golang-go" #================================================= # PERSONAL HELPERS From cb4156b0c6e4f475fdbc761fbfd03da57805d143 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:45:43 +0100 Subject: [PATCH 07/33] Remove instructions on dev CI --- pull_request_template.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pull_request_template.md b/pull_request_template.md index 0287f9f..69ce5a0 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -10,9 +10,3 @@ - [ ] Fix or enhancement tested. - [ ] Upgrade from last version tested. - [ ] Can be reviewed and tested. - -## Package_check results ---- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/) From 9d69384201744aa752d110d6d158e996e69e66a4 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 16:58:16 +0100 Subject: [PATCH 08/33] Add check_process --- check_process | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 check_process diff --git a/check_process b/check_process new file mode 100644 index 0000000..ed92383 --- /dev/null +++ b/check_process @@ -0,0 +1,27 @@ +;; Test complet + ; Manifest + domain="domain.tld" (DOMAIN) + path="/path" (PATH) + is_public=1 (PUBLIC|public=1|private=0) + port="666" (PORT) + ; Checks + pkg_linter=1 + setup_sub_dir=1 + setup_root=1 + setup_nourl=0 + setup_private=1 + setup_public=1 + upgrade=1 +# upgrade=1 from_commit=CommitHash + backup_restore=1 + multi_instance=1 + port_already_use=0 + change_url=1 +;;; Options +Email= +Notification=none +;;; Upgrade options + ; commit=CommitHash + name=Name and date of the commit. + manifest_arg=domain=DOMAIN&path=PATH&is_public=1&port=666& + From e3ce7bc238e40c42edf185807fa8f5618b9f19fd Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 17:04:29 +0100 Subject: [PATCH 09/33] Add psql dependency --- scripts/_common.sh | 2 +- scripts/install | 4 ++++ scripts/remove | 4 ++-- scripts/restore | 5 +++++ scripts/upgrade | 3 +++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6a0fc98..5c4b0ab 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -#pkg_dependencies="golang-go" +pkg_dependencies="postgresql postgresql-contrib" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index f644405..435c233 100755 --- a/scripts/install +++ b/scripts/install @@ -71,7 +71,11 @@ ynh_app_setting_set --app=$app --key=tls_port --value=$tls_port #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_install_app_dependencies $pkg_dependencies + +# Install Go if needed if ! command -v /usr/local/go/bin/go &> /dev/null then ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 diff --git a/scripts/remove b/scripts/remove index db682ee..4b25223 100755 --- a/scripts/remove +++ b/scripts/remove @@ -53,10 +53,10 @@ ynh_psql_remove_db --db_user=$app --db_name=$app #================================================= # REMOVE DEPENDENCIES #================================================= -#ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --time --weight=1 # Remove metapackage and its dependencies -#ynh_remove_app_dependencies +ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 04baa3f..30cf7c5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -81,7 +81,12 @@ chown -R $app:root /var/log/$app #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + +# Install Go if needed if ! command -v /usr/local/go/bin/go &> /dev/null then ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 diff --git a/scripts/upgrade b/scripts/upgrade index ed2c219..a3c585c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,6 +85,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +ynh_install_app_dependencies "$pkg_dependencies" # TODO: check Go version and upgrade if needed if ! command -v /usr/local/go/bin/go &> /dev/null From e408898b7438fc2d357e9621baf65da9a0a6f24b Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 17:19:08 +0100 Subject: [PATCH 10/33] Silence warnings from ynh_install_app_dependencies --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 435c233..876640b 100755 --- a/scripts/install +++ b/scripts/install @@ -73,7 +73,7 @@ ynh_app_setting_set --app=$app --key=tls_port --value=$tls_port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Go if needed if ! command -v /usr/local/go/bin/go &> /dev/null diff --git a/scripts/restore b/scripts/restore index 30cf7c5..6d3404e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -84,7 +84,7 @@ chown -R $app:root /var/log/$app ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Go if needed if ! command -v /usr/local/go/bin/go &> /dev/null diff --git a/scripts/upgrade b/scripts/upgrade index a3c585c..9ce69b3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,7 +87,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies "$pkg_dependencies" +ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" # TODO: check Go version and upgrade if needed if ! command -v /usr/local/go/bin/go &> /dev/null From 85fd07172eb673c1e5221c76588937663c2541e2 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 17:26:00 +0100 Subject: [PATCH 11/33] Silence Dendrite's build --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 876640b..d0436ac 100755 --- a/scripts/install +++ b/scripts/install @@ -140,7 +140,7 @@ adduser $app ssl-cert pushd "$final_path" || ynh_die ynh_script_progression --message="Building the sources (it will take some time)..." --time --weight=4 # Build the sources - ./build.sh + ynh_exec_warn_less ./build.sh ynh_script_progression --message="Generating the keys..." --time --weight=1 # Generate a Matrix signing key for federation ./bin/generate-keys --private-key matrix_key.pem From abe5aa41d92a2340f9212c0974b4972810c1d288 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 18:15:42 +0100 Subject: [PATCH 12/33] [CI] Try getting a 200 code from path --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index ed92383..426bad7 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) + path="/_matrix/client/versions" (PATH) is_public=1 (PUBLIC|public=1|private=0) port="666" (PORT) ; Checks From e85aeb9003d260bb0567a59d72696a164f913b65 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 20:04:53 +0100 Subject: [PATCH 13/33] Load ports in upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 9ce69b3..3d066d3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,8 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) +tls_port=$(ynh_app_setting_get --app=$app --key=tls_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= From aca5c74cc292c93dc54ef2dc4fafd3e26009f861 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 20:05:05 +0100 Subject: [PATCH 14/33] Temp fix for port in restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 6d3404e..3a8c53c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -118,7 +118,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 -yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log"# --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE From eafc9a4ea4b8369f2ae9a7a2beab26390527e094 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 20:10:04 +0100 Subject: [PATCH 15/33] Fix PSQL in restore --- scripts/restore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 3a8c53c..f0048e4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,6 +33,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -101,9 +102,9 @@ env_path=$PATH #================================================= ynh_script_progression --message="Restoring the PSQL database..." --weight=1 -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD From 9c8da57337db3f8c3e65dee77e5a71dd2307a484 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 21:54:35 +0100 Subject: [PATCH 16/33] Fix NGINX and CI --- check_process | 2 +- conf/nginx.conf | 25 ++++++++++++++++++++----- manifest.json | 2 +- scripts/install | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index 426bad7..ed92383 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/_matrix/client/versions" (PATH) + path="/path" (PATH) is_public=1 (PUBLIC|public=1|private=0) port="666" (PORT) ; Checks diff --git a/conf/nginx.conf b/conf/nginx.conf index ba105da..d192170 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,21 @@ -location __PATH__ { - proxy_pass http://localhost:__PORT__; - proxy_set_header X-Forwarded-For $remote_addr; - - client_max_body_size 100M; +rewrite ^$ /; +location ~ ^/$ { + default_type text/plain; + return 200 "This is where Dendrite is installed."; +} + +location /.well-known/matrix/server { + return 200 '{ "m.server": "__DOMAIN__:443" }'; +} + +location /.well-known/matrix/client { + return 200 '{ "m.homeserver": { "base_url": "https://__DOMAIN__" } }'; +} + +location /_matrix { + proxy_pass http://localhost:__PORT__; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + proxy_read_timeout 600; + client_max_body_size 100M; } diff --git a/manifest.json b/manifest.json index b3eb16f..3f92d3b 100644 --- a/manifest.json +++ b/manifest.json @@ -33,7 +33,7 @@ }, "help": { "en": "Dendrite requires its own domain, so make sure to create a new one.", - "fr": "Dendrite a besoin de son propre domain, créez-en un au préalable." + "fr": "Dendrite a besoin de son propre domaine, créez-en un au préalable." }, "example": "dendrite.example.com" }, diff --git a/scripts/install b/scripts/install index d0436ac..09a2f4b 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url="/_matrix" +path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME From ff420dd92dee6aade605f4746a691dec73be9eeb Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 22:00:07 +0100 Subject: [PATCH 17/33] Load ports in restore --- scripts/restore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index f0048e4..8a21845 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,8 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) +tls_port=$(ynh_app_setting_get --app=$app --key=tls_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) @@ -119,7 +121,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 -yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log"# --needs_exposed_ports "$tls_port" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE From 4487b94d62935cd0de9a04a7f48a9ef821be7e14 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 22:11:30 +0100 Subject: [PATCH 18/33] Use permissions system --- scripts/install | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index 09a2f4b..730d6f3 100755 --- a/scripts/install +++ b/scripts/install @@ -48,7 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --time --wei 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=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -200,24 +199,17 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# SETUP FAIL2BAN -#================================================= -#ynh_script_progression --message="Configuring Fail2Ban..." --time --weight=1 - -# Create a dedicated Fail2Ban config -#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring permissions..." --time --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= From 50c6a9c46f6ad58a5051d84193df601cf524d520 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 22:13:12 +0100 Subject: [PATCH 19/33] [CI] do not test for subpath installation --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index ed92383..9ac5340 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,7 @@ port="666" (PORT) ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 From a1d2b77eb9512f533d322524d49bc90b04f4ed79 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 22:27:21 +0100 Subject: [PATCH 20/33] Set progression indicators and remove old ssowat conf in upgrade --- scripts/backup | 0 scripts/install | 36 ++++++++++++++++++------------------ scripts/remove | 30 +++++++++++------------------- scripts/restore | 24 ++++++++++++------------ scripts/upgrade | 40 ++++++++++++++-------------------------- 5 files changed, 55 insertions(+), 75 deletions(-) mode change 100755 => 100644 scripts/backup mode change 100755 => 100644 scripts/install mode change 100755 => 100644 scripts/remove mode change 100755 => 100644 scripts/restore diff --git a/scripts/backup b/scripts/backup old mode 100755 new mode 100644 diff --git a/scripts/install b/scripts/install old mode 100755 new mode 100644 index 730d6f3..e52eeb4 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -44,7 +44,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -54,7 +54,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --time --weight=1 +ynh_script_progression --message="Configuring firewall..." --weight=1 # Find available ports port=$(ynh_find_port --port=8008) @@ -70,14 +70,14 @@ ynh_app_setting_set --app=$app --key=tls_port --value=$tls_port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=3 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Go if needed if ! command -v /usr/local/go/bin/go &> /dev/null then - ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 + ynh_script_progression --message="Installing Go dependency... (this will take some time)" --weight=3 ynh_setup_source --source_id="go" --dest_dir="/usr/local/" fi @@ -87,7 +87,7 @@ env_path=$PATH #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." --weight=4 +ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 ynh_print_OFF db_pwd=$(ynh_string_random --length=30) @@ -107,7 +107,7 @@ ynh_app_setting_set --app=$app --key=db_name --value=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=2 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -116,7 +116,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -124,7 +124,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app @@ -137,10 +137,10 @@ adduser $app ssl-cert #================================================= pushd "$final_path" || ynh_die - ynh_script_progression --message="Building the sources (it will take some time)..." --time --weight=4 + ynh_script_progression --message="Building the sources (it will take some time)..." --weight=6 # Build the sources ynh_exec_warn_less ./build.sh - ynh_script_progression --message="Generating the keys..." --time --weight=1 + ynh_script_progression --message="Generating the keys..." --weight=1 # Generate a Matrix signing key for federation ./bin/generate-keys --private-key matrix_key.pem # Generate a self-signed certificate @@ -153,7 +153,7 @@ ynh_add_config --template="../conf/dendrite.yaml" --destination="$final_path/den #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 +ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config --others_var="port tls_port domain" @@ -179,7 +179,7 @@ chown -R $app:root /var/log/$app #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -187,14 +187,14 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" @@ -202,7 +202,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --time --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] @@ -215,7 +215,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -223,4 +223,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove old mode 100755 new mode 100644 index 4b25223..8ea6236 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -30,14 +30,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --time --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -53,7 +53,7 @@ ynh_psql_remove_db --db_user=$app --db_name=$app #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=3 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -61,7 +61,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -69,7 +69,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config @@ -77,7 +77,7 @@ ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 # Remove the app-specific logrotate config ynh_remove_logrotate @@ -88,24 +88,16 @@ ynh_remove_logrotate if yunohost firewall list | grep -q "\- $port$" then - ynh_script_progression --message="Closing port $port..." --time --weight=1 + ynh_script_progression --message="Closing port $port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow TCP $port fi if yunohost firewall list | grep -q "\- $tls_port$" then - ynh_script_progression --message="Closing port $tls_port..." --time --weight=1 + ynh_script_progression --message="Closing port $tls_port..." --weight=1 ynh_exec_warn_less yunohost firewall disallow TCP $tls_port fi -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -#ynh_script_progression --message="Removing Fail2ban configuration..." --time --weight=1 - -# Remove the dedicated Fail2Ban config -#ynh_remove_fail2ban_config - #================================================= # SPECIFIC REMOVE #================================================= @@ -120,7 +112,7 @@ ynh_secure_remove --file="/var/log/$app/" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -129,4 +121,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore old mode 100755 new mode 100644 index 8a21845..a68fbe2 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -40,7 +40,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -58,14 +58,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -84,7 +84,7 @@ chown -R $app:root /var/log/$app #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=3 # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies @@ -92,7 +92,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Go if needed if ! command -v /usr/local/go/bin/go &> /dev/null then - ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 + ynh_script_progression --message="Installing Go dependency... (this will take some time)" --weight=3 ynh_setup_source --source_id="go" --dest_dir="/usr/local/" fi @@ -102,7 +102,7 @@ env_path=$PATH #================================================= # RESTORE THE PSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PSQL database..." --weight=1 +ynh_script_progression --message="Restoring the PSQL database..." --weight=3 ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd @@ -111,7 +111,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet @@ -119,14 +119,14 @@ systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" @@ -145,7 +145,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -153,4 +153,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 3d066d3..0f1e2db 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -39,12 +39,12 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -#ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 +#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 # Backup the current version of the app ynh_backup_before_upgrade @@ -60,7 +60,7 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" @@ -70,7 +70,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=3 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -79,7 +79,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -94,7 +94,7 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" # TODO: check Go version and upgrade if needed if ! command -v /usr/local/go/bin/go &> /dev/null then - ynh_script_progression --message="Installing Go dependency... (this will take some time)" --time --weight=3 + ynh_script_progression --message="Installing Go dependency... (this will take some time)" --weight=3 ynh_setup_source --source_id="go" --dest_dir="/usr/local/" fi @@ -104,7 +104,7 @@ env_path=$PATH #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -118,7 +118,7 @@ ynh_system_user_create --username=$app #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config @@ -141,7 +141,7 @@ chown -R $app:root /var/log/$app #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -149,33 +149,21 @@ ynh_use_logrotate --non-append #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -183,4 +171,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last From 04a98cffbab4f75c3627e1204ae689c93da09ad9 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 22:59:52 +0100 Subject: [PATCH 21/33] Try to catch the rotated logs in logrotate --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index e52eeb4..44b5c81 100644 --- a/scripts/install +++ b/scripts/install @@ -183,6 +183,9 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate +# HACKY: Match the weirdly renamed rotated logs. +# Looking at you, matrix-org/dugong library +ynh_replace_string --match_string="/var/log/$app/*.log" --replace_string="/var/log/$app/*.log.????-??-??" --target_file="/etc/logrotate.d/$app" #================================================= # INTEGRATE SERVICE IN YUNOHOST From a2a33781c64d41be272d5614d034b541f1cc1a92 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 17 Jan 2021 23:07:35 +0100 Subject: [PATCH 22/33] Detect successful systemd actions --- scripts/change_url | 4 ++-- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 126010e..91ed67f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -74,7 +74,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Dentrite Matrix homeserver" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -118,7 +118,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --time --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 44b5c81..a6c3949 100644 --- a/scripts/install +++ b/scripts/install @@ -200,7 +200,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index a68fbe2..18f7a8b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -128,7 +128,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" #================================================= # RESTORE VARIOUS FILES diff --git a/scripts/upgrade b/scripts/upgrade index 0f1e2db..04196f4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,7 +62,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Dentrite Matrix homeserver" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -158,7 +158,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" #================================================= # RELOAD NGINX From d2abbf373d470c79305f54e64fcb076c4beaa9ef Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 18:40:44 +0100 Subject: [PATCH 23/33] Require v3.7.0 for permissions system --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 3f92d3b..dd3a8da 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "tituspijean@outlook.com" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.7.0" }, "multi_instance": true, "services": [ From 11da26d782d922019d61d6139e262d3b584c8168 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 18:52:43 +0100 Subject: [PATCH 24/33] Enable registration based of is_public --- check_process | 2 +- conf/dendrite.yaml | 2 +- manifest.json | 6 +++++- scripts/install | 21 ++++++++------------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/check_process b/check_process index 9ac5340..4cba368 100644 --- a/check_process +++ b/check_process @@ -9,7 +9,7 @@ setup_sub_dir=0 setup_root=1 setup_nourl=0 - setup_private=1 + setup_private=0 setup_public=1 upgrade=1 # upgrade=1 from_commit=CommitHash diff --git a/conf/dendrite.yaml b/conf/dendrite.yaml index 9137f9c..dfb450b 100644 --- a/conf/dendrite.yaml +++ b/conf/dendrite.yaml @@ -127,7 +127,7 @@ client_api: # Prevents new users from being able to register on this homeserver, except when # using the registration shared secret below. - registration_disabled: false + registration_disabled: __REGISTRATION__ # If set, allows registration by anyone who knows the shared secret, regardless of # whether registration is otherwise disabled. diff --git a/manifest.json b/manifest.json index dd3a8da..8fb98e2 100644 --- a/manifest.json +++ b/manifest.json @@ -44,7 +44,11 @@ "en": "Is it a public application?", "fr": "Est-ce une application publique ?" }, - "default": true + "help": { + "en": "A public server means that anybody will be able to register.", + "fr": "Un serveur public permet à quiconque de s'y enregistrer." + }, + "default": false } ] } diff --git a/scripts/install b/scripts/install index a6c3949..e220830 100644 --- a/scripts/install +++ b/scripts/install @@ -147,6 +147,14 @@ pushd "$final_path" || ynh_die ./bin/generate-keys --tls-cert server.crt --tls-key server.key popd || ynh_die +# Allow or deny registration based of is_public +if [ $is_public -eq 1 ] +then + registration = true +else + registration = false +fi + # Copy and modify the config file ynh_add_config --template="../conf/dendrite.yaml" --destination="$final_path/dentrite.yaml" @@ -202,19 +210,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - #================================================= # RELOAD NGINX #================================================= From 477b2b994297c11a3b48e901ba02f4e17d634e07 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 20:05:29 +0100 Subject: [PATCH 25/33] Fix $registration definition --- scripts/install | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index e220830..5324771 100644 --- a/scripts/install +++ b/scripts/install @@ -148,11 +148,10 @@ pushd "$final_path" || ynh_die popd || ynh_die # Allow or deny registration based of is_public +registration=false if [ $is_public -eq 1 ] then - registration = true -else - registration = false + registration=true fi # Copy and modify the config file From a23e703ede2949746c7c49fbf65cf71deffc408a Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 20:42:01 +0100 Subject: [PATCH 26/33] Use actual app id for the log directory --- conf/dendrite.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/dendrite.yaml b/conf/dendrite.yaml index dfb450b..a66caef 100644 --- a/conf/dendrite.yaml +++ b/conf/dendrite.yaml @@ -347,5 +347,5 @@ logging: - type: file level: info params: - path: /var/log/dendrite + path: /var/log/__APP__ From c4d89c9baa3b39788c34608467caae5b2c0f5a7e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 20:45:05 +0100 Subject: [PATCH 27/33] Fix service start detection and log filename --- scripts/install | 4 ++-- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 5324771..6889f54 100644 --- a/scripts/install +++ b/scripts/install @@ -199,7 +199,7 @@ ynh_replace_string --match_string="/var/log/$app/*.log" --replace_string="/var/l #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/Monolith.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE @@ -207,7 +207,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="systemd" #================================================= # RELOAD NGINX diff --git a/scripts/restore b/scripts/restore index 18f7a8b..e30eae7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -121,14 +121,14 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/Monolith.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="systemd" #================================================= # RESTORE VARIOUS FILES diff --git a/scripts/upgrade b/scripts/upgrade index 04196f4..f34cca7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -151,14 +151,14 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/$app.log" --needs_exposed_ports "$tls_port" +yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var/log/$app/Monolith.log" --needs_exposed_ports "$tls_port" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="systemd" #================================================= # RELOAD NGINX From f83e69c6f43f73a65fa236de2fd6f67192fdff1d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 21:34:47 +0100 Subject: [PATCH 28/33] Fix service start detection in change_url --- scripts/change_url | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 91ed67f..2b33d91 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -74,7 +74,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Dentrite Matrix homeserver" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF @@ -118,7 +118,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --time --weight=1 -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Dentrite Matrix homeserver" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="systemd" #================================================= # RELOAD NGINX From 5f1ec918fe11a713e78b3bae7315a94e29116f22 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 22:25:38 +0100 Subject: [PATCH 29/33] Add warning about Dendrite being in beta --- manifest.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 8fb98e2..dfee7a6 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Serveur Matrix de seconde génération" }, "version": "1.0~ynh1", - "url": "https://example.com", + "url": "https://matrix.org/", "license": "Apache-2.0", "maintainer": { "name": "tituspijean", @@ -24,6 +24,14 @@ ], "arguments": { "install" : [ + { + "name": "warning", + "type": "display_text", + "ask": { + "en": "Dendrite is still in beta phase.\nIt is functional, but all Matrix features are yet to be implemented.\nSee the upstream repo for more information: https://github.com/matrix-org/dendrite\n\nThis package est encore en development, all features from Matrix/Synapse are yet to be implemented.", + "fr": "Dendrite est encore en phase bêta.\nElle est fonctionnelle, mais n'implémente pas encore toutes les fonctionnalités de Matrix.\nConsultez le dépôt source pour plus d'information: https://github.com/matrix-org/dendrite\n\nCe package est encore en développement, toutes les fonctionalités de Matrix/Synapse ne sont pas encore implémentées." + } + }, { "name": "domain", "type": "domain", From 2a6ff47828fddde234fc8c78d86564a7312aa5fe Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 18 Jan 2021 22:27:31 +0100 Subject: [PATCH 30/33] Bump to v0.3.6 --- conf/app.src | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index a7a8991..3e8ee75 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/matrix-org/dendrite/archive/v0.3.3.zip -SOURCE_SUM=652C9B08A01FDCE459F57BECE0FA6D5EDA00A2EF8C283876EB3CF30B8D153B3E +SOURCE_URL=https://github.com/matrix-org/dendrite/archive/v0.3.6.zip +SOURCE_SUM=B4A97BBE2DD106C18C0E3D8B466F96F312168CDAE3E9FC41E04CAFE926615AB6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index dfee7a6..69f5ffc 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Matrix homeserver of second generation", "fr": "Serveur Matrix de seconde génération" }, - "version": "1.0~ynh1", + "version": "0.3.6~ynh1", "url": "https://matrix.org/", "license": "Apache-2.0", "maintainer": { From 782b3add8790669581a70f56a1ce5dfd990bc98f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 19 Jan 2021 20:55:52 +0100 Subject: [PATCH 31/33] Replace REPLACEBYYOURAPP in issue_template --- issue_template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/issue_template.md b/issue_template.md index 4a290c4..df0eab4 100644 --- a/issue_template.md +++ b/issue_template.md @@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - - *Otherwise, the issue may be due to REPLACEBYYOURAPP itself. Refer to its documentation or repository for help.* + - *Otherwise, the issue may be due to Dendrite itself. Refer to its documentation or repository for help.* - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* --- @@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install REPLACEBYYOURAPP + sudo yunohost app install dendrite ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* From 485c39a49a176ce510b200a5c50566001e371626 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 19 Jan 2021 20:56:08 +0100 Subject: [PATCH 32/33] Have the ./bin directory ready before building --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 6889f54..bbb804e 100644 --- a/scripts/install +++ b/scripts/install @@ -139,6 +139,7 @@ adduser $app ssl-cert pushd "$final_path" || ynh_die ynh_script_progression --message="Building the sources (it will take some time)..." --weight=6 # Build the sources + mkdir ./bin ynh_exec_warn_less ./build.sh ynh_script_progression --message="Generating the keys..." --weight=1 # Generate a Matrix signing key for federation From 9792646e7d90a91cfa144fec46428e47b1814e74 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 19 Jan 2021 20:56:25 +0100 Subject: [PATCH 33/33] Build during the upgrade... --- scripts/upgrade | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f34cca7..315ae64 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -112,9 +112,15 @@ ynh_system_user_create --username=$app #================================================= # SPECIFIC UPGRADE #================================================= -# ... +# BUILDING SOURCES AND SETTING UP THE SERVER #================================================= +pushd "$final_path" || ynh_die + ynh_script_progression --message="Building the sources (it will take some time)..." --weight=6 + # Build the sources + ynh_exec_warn_less ./build.sh +popd || ynh_die + #================================================= # SETUP SYSTEMD #=================================================