From 7077f3ab70c08667dfe31fc84b572d92ef981022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:09:21 +0100 Subject: [PATCH 01/37] v2 --- conf/app.src | 5 --- conf/systemd.service | 2 +- manifest.toml | 64 ++++++++++++++++++++++++++++++++++++++ scripts/backup | 16 +++++----- scripts/change_url | 70 ++++++++++++++++++++--------------------- scripts/install | 74 ++++++++++++++++++++++---------------------- scripts/remove | 24 +++++++------- scripts/restore | 32 +++++++++---------- scripts/upgrade | 60 +++++++++++++++++------------------ 9 files changed, 203 insertions(+), 144 deletions(-) delete mode 100644 conf/app.src create mode 100644 manifest.toml diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 6ade810..0000000 --- a/conf/app.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.8.7/synapse-admin-0.8.7-dirty.tar.gz -SOURCE_SUM=3f74cbfec0a3b14b5684d1bded4816a7946d2e9b88b7186767189c14811224e9 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 679d91d..1ff4e0e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__ +WorkingDirectory=__INSTALL_DIR__ Environment="PATH=__ENV_PATH__" Environment="NODE_ENV=production" ExecStart=/usr/bin/yarn start -p __PORT__ diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..9d9cd1e --- /dev/null +++ b/manifest.toml @@ -0,0 +1,64 @@ +packaging_format = 2 + +id = "synapse-admin" +name = "Synapse Admin" +description.en = "Admin UI for Synapse" +description.fr = "Admin UI pour Synapse" + +version = "0.8.7~ynh1" + +maintainers = [] + +[upstream] +license = "Apache-2.0" +code = "https://github.com/Awesome-Technologies/synapse-admin" +website = "https://github.com/Awesome-Technologies/synapse-admin" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.1.14" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = false +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + full_domain = true + + [install.synapse_app] + ask.en = "Input the Synapse app ID you wish to connect to." + ask.fr = "Entrez l'ID de l'app Synapse à laquelle vous souhaitez vous connecter." + help.en = "Leave the default value if you have only one Synapse server installed." + help.fr = "Laissez la valeur par défaut si vous n'avez installé qu'un seul serveur Synapse." + type = "string" + default = "synapse" + + [install.init_main_permission] + help.en = "If enabled, Synapse Admin will be accessible by people who do not have an account. This can be changed later via the webadmin." + help.fr = "Si cette case est cochée, Synapse Admin sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + +[resources] + [resources.sources.main] + url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.8.7/synapse-admin-0.8.7-dirty.tar.gz" + sha256 = "3f74cbfec0a3b14b5684d1bded4816a7946d2e9b88b7186767189c14811224e9" + + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + [[resources.apt.extras]] + repo = "deb https://dl.yarnpkg.com/debian/ stable main" + key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + packages = "yarn" diff --git a/scripts/backup b/scripts/backup index e9ea8a1..c39d0e6 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,19 +14,19 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) -synapse_domain=$(ynh_app_setting_get --app=$app --key=synapse_domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) +#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$app --key=synapse_domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -37,7 +37,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 18ec2f6..c2963ff 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,22 +13,22 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -36,31 +36,31 @@ port=$(ynh_app_setting_get --app=$app --key=port) ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -77,28 +77,28 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" #================================================= ynh_script_progression --message="Updating Nginx web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +#REMOVEME? # Change the path in the nginx config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config +#REMOVEME? # Make a backup of the original nginx config file if modified +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? # Set global variables for nginx helper +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" +#REMOVEME? # Create a dedicated nginx config +#REMOVEME? ynh_add_nginx_config fi -# Change the domain for nginx +#REMOVEME? # Change the domain for nginx if [ $change_domain -eq 1 ] then # 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/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -114,9 +114,9 @@ ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index e0dfae6..c917579 100644 --- a/scripts/install +++ b/scripts/install @@ -14,85 +14,85 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -synapse_app=$YNH_APP_ARG_SYNAPSE_APP -synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) -synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path="/" +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? synapse_app=$YNH_APP_ARG_SYNAPSE_APP +#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) +#REMOVEME? synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app -ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain -ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port +#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain +#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2 # Find an available port -port=$(ynh_find_port --port=9090) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=9090) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=20 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=20 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=2 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir=$final_path +ynh_setup_source --dest_dir=$install_dir -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -112,7 +112,7 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d #============================================== ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=40 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less yarn install ynh_exec_warn_less yarn build @@ -123,9 +123,9 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chown -R $app:www-data "$final_path" +chown -R $app:www-data "$install_dir" #================================================= # SETUP SYSTEMD @@ -161,20 +161,20 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #-- #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary or protect it -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 3661268..282dca7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) -synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) +#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) #================================================= # STANDARD REMOVE @@ -54,7 +54,7 @@ ynh_remove_logrotate #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_nodejs @@ -62,10 +62,10 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=6 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=6 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -83,10 +83,10 @@ ynh_remove_nginx_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index e9610b3..b856eb4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,26 +14,26 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -synapse_domain=$(ynh_app_setting_get --app=$app --key=synapse_domain) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$app --key=synapse_domain) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -48,34 +48,34 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpo #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=60 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=7 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 3f070a4..8fb7c52 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) #================================================= # CHECK VERSION @@ -34,13 +34,13 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=20 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -52,8 +52,8 @@ then ynh_die --message="Upgrade from version 0.8.3 is not possible. You must uninstall and reinstall Synapse-admin package manually" fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -65,10 +65,10 @@ if [ -z "$synapse_app" ]; then fi # Reload and store Synapse's settings, in case of they changed -synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) -synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) -ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain -ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port +#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) +#REMOVEME? synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) +#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain +#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port #================================================= # STANDARD UPGRADE STEPS @@ -82,10 +82,10 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -95,12 +95,12 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=160 - ynh_setup_source --dest_dir="$final_path" --keep=".env" + ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -116,13 +116,13 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=18 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=18 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # SPECIFIC UPGRADE @@ -133,7 +133,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=60 - pushd "$final_path" + pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less yarn install ynh_exec_warn_less yarn build @@ -145,9 +145,9 @@ fi #================================================= #ynh_script_progression --message="Adding a configuration file..." --weight=1 -#ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +#ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -#chown -R $app:www-data "$final_path" +#chown -R $app:www-data "$install_dir" #================================================= # SETUP SYSTEMD @@ -175,9 +175,9 @@ ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 3355f430d8ebc65a7aefbbf1df1605a3ad55ea2f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 10 Mar 2023 07:09:26 +0000 Subject: [PATCH 02/37] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6175b06..66028e8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Admin UI for Synapse -**Shipped version:** 0.8.5~ynh5 +**Shipped version:** 0.8.7~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 414ea73..fba7e78 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Admin UI pour Synapse -**Version incluse :** 0.8.5~ynh5 +**Version incluse :** 0.8.7~ynh1 ## Captures d’écran From 6eca76cc89f671bb5f74e79afa3edd39cb0c3381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:19:05 +0100 Subject: [PATCH 03/37] v2 --- manifest.json | 56 ------------------------------ manifest.toml | 33 +++++++++--------- scripts/_common.sh | 2 -- scripts/backup | 19 ----------- scripts/change_url | 85 +--------------------------------------------- scripts/install | 67 +----------------------------------- scripts/remove | 32 ----------------- scripts/upgrade | 64 ---------------------------------- tests.toml | 0 9 files changed, 18 insertions(+), 340 deletions(-) delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 9ffaaee..0000000 --- a/manifest.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "Synapse Admin", - "id": "synapse-admin", - "packaging_format": 1, - "description": { - "en": "Admin UI for Synapse", - "fr": "Admin UI pour Synapse" - }, - "version": "0.8.7~ynh1", - "url": "https://github.com/Awesome-Technologies/synapse-admin", - "upstream": { - "license": "Apache-2.0", - "code": "https://github.com/Awesome-Technologies/synapse-admin" - }, - "license": "Apache-2.0", - "maintainer": { - "name": "" - }, - "requirements": { - "yunohost": ">= 11.1.14" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "synapse_app", - "type": "string", - "ask": { - "en": "Input the Synapse app ID you wish to connect to.", - "fr": "Entrez l'ID de l'app Synapse à laquelle vous souhaitez vous connecter." - }, - "help": { - "en": "Leave the default value if you have only one Synapse server installed.", - "fr": "Laissez la valeur par défaut si vous n'avez installé qu'un seul serveur Synapse." - }, - "default": "synapse" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Synapse Admin will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Synapse Admin sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 9d9cd1e..09387b4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,28 +7,25 @@ description.fr = "Admin UI pour Synapse" version = "0.8.7~ynh1" -maintainers = [] +maintainers = ["eric_G"] [upstream] license = "Apache-2.0" code = "https://github.com/Awesome-Technologies/synapse-admin" website = "https://github.com/Awesome-Technologies/synapse-admin" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] yunohost = ">= 11.1.14" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true @@ -47,10 +44,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "visitors" [resources] - [resources.sources.main] - url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.8.7/synapse-admin-0.8.7-dirty.tar.gz" - sha256 = "3f74cbfec0a3b14b5684d1bded4816a7946d2e9b88b7186767189c14811224e9" + [resources.sources.main] + url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.8.7/synapse-admin-0.8.7-dirty.tar.gz" + sha256 = "3f74cbfec0a3b14b5684d1bded4816a7946d2e9b88b7186767189c14811224e9" + [resources.ports] [resources.system_user] @@ -58,7 +56,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" - [[resources.apt.extras]] - repo = "deb https://dl.yarnpkg.com/debian/ stable main" - key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - packages = "yarn" + + [[resources.apt.extras]] + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.yarn.packages = "yarn" diff --git a/scripts/_common.sh b/scripts/_common.sh index a70846c..b818f0f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -version_commit="9b43d41040b79cc8ad240dbadc66098bc8231c2b" - nodejs_version=16 #================================================= diff --git a/scripts/backup b/scripts/backup index c39d0e6..70268d1 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,25 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) -#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$app --key=synapse_domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index c2963ff..f1ba7b7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" #================================================= ynh_script_progression --message="Updating Nginx web server configuration..." --weight=1 -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -#REMOVEME? # Change the path in the nginx config file -if [ $change_path -eq 1 ] -then -#REMOVEME? # Make a backup of the original nginx config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" -#REMOVEME? # Set global variables for nginx helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" -#REMOVEME? # Create a dedicated nginx config -#REMOVEME? ynh_add_nginx_config -fi - -#REMOVEME? # Change the domain for nginx -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # GENERIC FINALISATION @@ -111,13 +35,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index c917579..c2a332d 100644 --- a/scripts/install +++ b/scripts/install @@ -9,37 +9,14 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path="/" -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC #REMOVEME? synapse_app=$YNH_APP_ARG_SYNAPSE_APP #REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) #REMOVEME? synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -51,46 +28,22 @@ ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app #REMOVEME? ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain #REMOVEME? ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=9090) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=20 +ynh_script_progression --message="Installing dependencies..." --weight=20 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=2 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -158,24 +111,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary or protect it -#REMOVEME? if [ $is_public -eq 1 ] -then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 282dca7..42605b9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,19 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) -#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) - #================================================= # STANDARD REMOVE #================================================= @@ -54,19 +41,10 @@ ynh_remove_logrotate #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_nodejs -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=6 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -78,16 +56,6 @@ ynh_secure_remove --file="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.co # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8fb7c52..1fa4559 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,39 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app) - #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=20 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -51,24 +24,6 @@ if ynh_compare_current_package_version --comparison le --version 0.8.3~ynh2 then ynh_die --message="Upgrade from version 0.8.3 is not possible. You must uninstall and reinstall Synapse-admin package manually" fi -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# If synapse_app doesn't exist, create it and assume it is `synapse` -if [ -z "$synapse_app" ]; then - synapse_app="synapse" - ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app -fi - -# Reload and store Synapse's settings, in case of they changed -#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) -#REMOVEME? synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) -#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain -#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port #================================================= # STANDARD UPGRADE STEPS @@ -79,14 +34,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -98,7 +45,6 @@ then ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -121,9 +67,6 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - #================================================= # SPECIFIC UPGRADE #============================================== @@ -172,13 +115,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="HTTP Server listening" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..e69de29 From 51d59f7332d65d50803b816dddd5ad2cd1ca333b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 10 Mar 2023 07:19:15 +0000 Subject: [PATCH 04/37] Auto-update README --- README.md | 1 + README_fr.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 66028e8..9018efe 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Admin UI for Synapse ## Documentation and resources +* Official app website: * Upstream app code repository: * YunoHost documentation for this app: * Report a bug: diff --git a/README_fr.md b/README_fr.md index fba7e78..3f271dc 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,6 +26,7 @@ Admin UI pour Synapse ## Documentations et ressources +* Site officiel de l’app : * Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : From 72cda090d3f680c4d691c8df8ae6a4093781aa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:20:02 +0100 Subject: [PATCH 05/37] fix --- scripts/install | 13 ++++--------- scripts/restore | 41 ----------------------------------------- tests.toml | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 50 deletions(-) diff --git a/scripts/install b/scripts/install index c2a332d..a5f915e 100644 --- a/scripts/install +++ b/scripts/install @@ -13,20 +13,15 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? synapse_app=$YNH_APP_ARG_SYNAPSE_APP -#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) -#REMOVEME? synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) +synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) +synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app -#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain -#REMOVEME? ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port +ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain +ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port #================================================= # INSTALL DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index b856eb4..105d683 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,32 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? synapse_domain=$(ynh_app_setting_get --app=$app --key=synapse_domain) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -45,14 +19,6 @@ ynh_script_progression --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -60,23 +26,16 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC RESTORATION #================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/tests.toml b/tests.toml index e69de29..a0d8f0f 100644 --- a/tests.toml +++ b/tests.toml @@ -0,0 +1,15 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + preinstall = """ + sudo yunohost tools update apps + sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force + """ + + + \ No newline at end of file From 4b1e4242133594932fab3009e0dc97945da54e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:45:25 +0100 Subject: [PATCH 06/37] Create description.md --- doc/description.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/description.md diff --git a/doc/description.md b/doc/description.md new file mode 100644 index 0000000..f5f7f4f --- /dev/null +++ b/doc/description.md @@ -0,0 +1 @@ +Synapse-admin is an Admin UI for Matrix Synapse homeserver. \ No newline at end of file From 9f5c1a85168f2a9890d840d67e0e0030c57a98a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:46:25 +0100 Subject: [PATCH 07/37] Fix --- manifest.toml | 1 - scripts/upgrade | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 09387b4..5688f34 100644 --- a/manifest.toml +++ b/manifest.toml @@ -12,7 +12,6 @@ maintainers = ["eric_G"] [upstream] license = "Apache-2.0" code = "https://github.com/Awesome-Technologies/synapse-admin" -website = "https://github.com/Awesome-Technologies/synapse-admin" [integration] yunohost = ">= 11.1.14" diff --git a/scripts/upgrade b/scripts/upgrade index 1fa4559..30a5c7b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,7 +40,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=160 + ynh_script_progression --message="Upgrading source files..." --weight=16 ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi @@ -74,7 +74,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #============================================== if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=60 + ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=6 pushd "$install_dir" ynh_use_nodejs From c87f08a058f048c3979b089dee3df65eed80764f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 10 Mar 2023 07:46:30 +0000 Subject: [PATCH 08/37] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 9018efe..66028e8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ Admin UI for Synapse ## Documentation and resources -* Official app website: * Upstream app code repository: * YunoHost documentation for this app: * Report a bug: diff --git a/README_fr.md b/README_fr.md index 3f271dc..fba7e78 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,6 @@ Admin UI pour Synapse ## Documentations et ressources -* Site officiel de l’app : * Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : From 444d4d8fde3f5f3e7a1f4669e3d5fe98e7c57013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:57:42 +0100 Subject: [PATCH 09/37] Update tests.toml --- tests.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests.toml b/tests.toml index a0d8f0f..4f4d3a6 100644 --- a/tests.toml +++ b/tests.toml @@ -11,5 +11,12 @@ test_format = 1.0 sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force """ + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.synapse_app = "synapse" + args.synapse_domain="sub.domain.tld" + \ No newline at end of file From 87865686c6f3991318fc26adeca22b9c6970fb72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:58:40 +0100 Subject: [PATCH 10/37] Update tests.toml --- tests.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.toml b/tests.toml index 4f4d3a6..9a1659b 100644 --- a/tests.toml +++ b/tests.toml @@ -6,6 +6,8 @@ test_format = 1.0 # Tests to run # ------------ + exclude = ["install.multi"] + preinstall = """ sudo yunohost tools update apps sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force From 0dcd59eac3e73ea003c8feff7960a4ab17e3b95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 15:38:54 +0200 Subject: [PATCH 11/37] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 5688f34..759449b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "Apache-2.0" code = "https://github.com/Awesome-Technologies/synapse-admin" [integration] -yunohost = ">= 11.1.14" +yunohost = ">= 11.1.17" architectures = "all" multi_instance = false ldap = false From 29966399de5f52597954957ae5d5ce26e652b434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 18:59:54 +0200 Subject: [PATCH 12/37] Update change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index f1ba7b7..fb3d33c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,7 +21,7 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating Nginx web server configuration..." --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_change_url_nginx_config From f384d0334ad850ba94c8d6a8de909879a662588c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:29:04 +0200 Subject: [PATCH 13/37] Update manifest.toml --- manifest.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 759449b..4d0eaa7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -55,8 +55,11 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" - - [[resources.apt.extras]] + + [resources.apt] + packages = "" + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" extras.yarn.packages = "yarn" + \ No newline at end of file From 451d2d722956fb9d049526268276854cac112ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:30:26 +0200 Subject: [PATCH 14/37] cleaning --- check_process | 23 ----------------------- tests.toml | 2 -- 2 files changed, 25 deletions(-) delete mode 100644 check_process diff --git a/check_process b/check_process deleted file mode 100644 index e89ada0..0000000 --- a/check_process +++ /dev/null @@ -1,23 +0,0 @@ -;; Test complet - ; pre-install - sudo yunohost tools update apps - sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force - ; Manifest - domain="domain.tld" - synapse_app="synapse" - synapse_domain="sub.domain.tld" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none diff --git a/tests.toml b/tests.toml index 9a1659b..0bbfd42 100644 --- a/tests.toml +++ b/tests.toml @@ -19,6 +19,4 @@ test_format = 1.0 args.synapse_app = "synapse" args.synapse_domain="sub.domain.tld" - - \ No newline at end of file From 6409375694bec1b9a35dac577f2fde24e18ee0c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:45:18 +0200 Subject: [PATCH 15/37] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 4d0eaa7..9376089 100644 --- a/manifest.toml +++ b/manifest.toml @@ -44,8 +44,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.8.7/synapse-admin-0.8.7-dirty.tar.gz" - sha256 = "3f74cbfec0a3b14b5684d1bded4816a7946d2e9b88b7186767189c14811224e9" + url = "https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.7.tar.gz" + sha256 = "76d2d938e9b67a65a07cd2fe921bb810258ff3b5d6b30d00d62112e30acece08" [resources.ports] From c60b9f306e64619cd36d8b6df6fc92bcc3bcefd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 20:07:20 +0200 Subject: [PATCH 16/37] Delete description.md --- doc/description.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 doc/description.md diff --git a/doc/description.md b/doc/description.md deleted file mode 100644 index f5f7f4f..0000000 --- a/doc/description.md +++ /dev/null @@ -1 +0,0 @@ -Synapse-admin is an Admin UI for Matrix Synapse homeserver. \ No newline at end of file From 0f00228e430fb79fc8b447a26da4b86c08c74383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 20:07:39 +0200 Subject: [PATCH 17/37] Create DESCRIPTION.md --- doc/DESCRIPTION.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/DESCRIPTION.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..f5f7f4f --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Synapse-admin is an Admin UI for Matrix Synapse homeserver. \ No newline at end of file From 6caae11ffcc8ad16fdd76c5cbf7af9233d3305d7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 7 Apr 2023 18:07:44 +0000 Subject: [PATCH 18/37] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66028e8..f5addcf 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Admin UI for Synapse +Synapse-admin is an Admin UI for Matrix Synapse homeserver. **Shipped version:** 0.8.7~ynh1 diff --git a/README_fr.md b/README_fr.md index fba7e78..0ef8818 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Admin UI pour Synapse +Synapse-admin is an Admin UI for Matrix Synapse homeserver. **Version incluse :** 0.8.7~ynh1 From df0a65fe6036d1f2674457d5546c3580a36042b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 7 Apr 2023 20:08:10 +0200 Subject: [PATCH 19/37] Update systemd.service --- conf/systemd.service | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/conf/systemd.service b/conf/systemd.service index 1ff4e0e..8507e80 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -12,5 +12,39 @@ Environment="NODE_ENV=production" ExecStart=/usr/bin/yarn start -p __PORT__ Restart=always +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallArchitectures=native +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target From e5369ab93e0630ed0519a2d32f50923e47b3bbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 10 Apr 2023 17:51:17 +0200 Subject: [PATCH 20/37] cleaning --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index a5f915e..7b92c62 100644 --- a/scripts/install +++ b/scripts/install @@ -58,7 +58,7 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d #============================================== # INSTALL SYNAPSE-ADMIN #============================================== -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=40 +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 pushd "$install_dir" ynh_use_nodejs diff --git a/scripts/upgrade b/scripts/upgrade index 30a5c7b..3254d26 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,7 +74,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #============================================== if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=6 + ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 pushd "$install_dir" ynh_use_nodejs From ce4b41eb1c9d4404573365f8e8f1944801c1c1e6 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 10 Apr 2023 17:22:13 +0000 Subject: [PATCH 21/37] Auto-update README --- README.md | 4 ---- README_fr.md | 4 ---- 2 files changed, 8 deletions(-) diff --git a/README.md b/README.md index 294fc4b..9ca1f2e 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Synapse-admin is an Admin UI for Matrix Synapse homeserver. -<<<<<<< HEAD -**Shipped version:** 0.8.7~ynh1 -======= **Shipped version:** 0.8.7~ynh2 ->>>>>>> testing ## Screenshots diff --git a/README_fr.md b/README_fr.md index 438b4ea..6f39ecc 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,11 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Synapse-admin is an Admin UI for Matrix Synapse homeserver. -<<<<<<< HEAD -**Version incluse :** 0.8.7~ynh1 -======= **Version incluse :** 0.8.7~ynh2 ->>>>>>> testing ## Captures d’écran From 4a96d1e35bf65cf97694e417110226f6bbe544b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:53:36 +0200 Subject: [PATCH 22/37] Update manifest.toml --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index 9376089..7d88ff1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -46,6 +46,7 @@ ram.runtime = "50M" [resources.sources.main] url = "https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.7.tar.gz" sha256 = "76d2d938e9b67a65a07cd2fe921bb810258ff3b5d6b30d00d62112e30acece08" + autoupdate.strategy = "latest_github_tag" [resources.ports] From 7284613f0309cd08b2351857bbd0e09bad6d868b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 10 Apr 2023 21:15:32 +0200 Subject: [PATCH 23/37] revert --- README.md | 4 ++ README_fr.md | 4 ++ check_process | 28 ------------- conf/.env | 8 ++++ conf/nginx.conf | 15 +++++-- manifest.json | 56 ------------------------- scripts/_common.sh | 3 -- scripts/backup | 12 ++++++ scripts/change_url | 14 +++++-- scripts/install | 62 ++++++++++++++++++++++++---- scripts/remove | 30 +++++++++----- scripts/restore | 3 -- scripts/upgrade | 101 +++++++++++++++++++++++++++++---------------- 13 files changed, 190 insertions(+), 150 deletions(-) delete mode 100644 check_process create mode 100644 conf/.env delete mode 100644 manifest.json diff --git a/README.md b/README.md index 9ca1f2e..eaf6314 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Synapse-admin is an Admin UI for Matrix Synapse homeserver. +<<<<<<< HEAD **Shipped version:** 0.8.7~ynh2 +======= +**Shipped version:** 0.8.7~ynh1 +>>>>>>> parent of ec2cc1d (Merge branch 'testing' into version-2) ## Screenshots diff --git a/README_fr.md b/README_fr.md index 6f39ecc..8255298 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,11 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Synapse-admin is an Admin UI for Matrix Synapse homeserver. +<<<<<<< HEAD **Version incluse :** 0.8.7~ynh2 +======= +**Version incluse :** 0.8.7~ynh1 +>>>>>>> parent of ec2cc1d (Merge branch 'testing' into version-2) ## Captures d’écran diff --git a/check_process b/check_process deleted file mode 100644 index e2b820a..0000000 --- a/check_process +++ /dev/null @@ -1,28 +0,0 @@ -;; Test complet - ; pre-install - sudo yunohost tools update apps - sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force - ; Manifest - domain="domain.tld" - synapse_app="synapse" - synapse_domain="sub.domain.tld" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=4eaa242f11e8e9c6ed7afbb7cdf07fd95f8d04a1 - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=4eaa242f11e8e9c6ed7afbb7cdf07fd95f8d04a1 - name=Upgrade from 0.8.5~ynh5 and remove app build - manifest_arg=domain=DOMAIN&synapse_app=synapse&synapse_domain=sub.domain.tld& diff --git a/conf/.env b/conf/.env new file mode 100644 index 0000000..3be4fc3 --- /dev/null +++ b/conf/.env @@ -0,0 +1,8 @@ +# This setting allows to fix the homeserver. +# If you set this setting, the user will not be able to select +# the server and have to use synapse-admin with this server. + +REACT_APP_SERVER=https://__SYNAPSE_DOMAIN__ + +#Define the port to avoid collisions on port 3000 +PORT=__PORT__ diff --git a/conf/nginx.conf b/conf/nginx.conf index 0ac62b9..0880bcd 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,19 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - alias __FINAL_PATH__/; + proxy_pass http://127.0.0.1:__PORT__; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; - index index.html; - try_files $uri $uri/ /index.html; + client_max_body_size 50M; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 86a2ca2..0000000 --- a/manifest.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "Synapse Admin", - "id": "synapse-admin", - "packaging_format": 1, - "description": { - "en": "Admin UI for Synapse", - "fr": "Admin UI pour Synapse" - }, - "version": "0.8.7~ynh2", - "url": "https://github.com/Awesome-Technologies/synapse-admin", - "upstream": { - "license": "Apache-2.0", - "code": "https://github.com/Awesome-Technologies/synapse-admin" - }, - "license": "Apache-2.0", - "maintainer": { - "name": "" - }, - "requirements": { - "yunohost": ">= 11.1.14" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "synapse_app", - "type": "string", - "ask": { - "en": "Input the Synapse app ID you wish to connect to.", - "fr": "Entrez l'ID de l'app Synapse à laquelle vous souhaitez vous connecter." - }, - "help": { - "en": "Leave the default value if you have only one Synapse server installed.", - "fr": "Laissez la valeur par défaut si vous n'avez installé qu'un seul serveur Synapse." - }, - "default": "synapse" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Synapse Admin will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Synapse Admin sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} diff --git a/scripts/_common.sh b/scripts/_common.sh index a03f47e..b818f0f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,11 +4,8 @@ # COMMON VARIABLES #================================================= -<<<<<<< HEAD nodejs_version=16 -======= ->>>>>>> testing #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 1b290e6..70268d1 100644 --- a/scripts/backup +++ b/scripts/backup @@ -27,6 +27,18 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/$app.service" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 4e09eb5..fb3d33c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -11,6 +11,13 @@ source /usr/share/yunohost/helpers #================================================= # STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" + #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -21,11 +28,12 @@ ynh_change_url_nginx_config #================================================= # GENERIC FINALISATION #================================================= -# RELOAD NGINX +# START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +# Start a systemd service +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 1f745eb..7b92c62 100644 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,13 @@ ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port #================================================= -# STANDARD MODIFICATIONS +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=20 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -50,15 +56,55 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d #================================================= # SPECIFIC SETUP #============================================== -# SETUP SSOWAT +# INSTALL SYNAPSE-ADMIN +#============================================== +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 + +pushd "$install_dir" + ynh_use_nodejs + ynh_exec_warn_less yarn install + ynh_exec_warn_less yarn build +popd + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" + +chown -R $app:www-data "$install_dir" + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=1 + +env_path="$PATH" +ynh_add_systemd_config + +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." + +yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=2 -# Make app public if necessary or protect it -if [ $is_public -eq 1 ] -then - ynh_permission_update --permission="main" --add="visitors" -fi +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 4d96c09..42605b9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,13 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) - #================================================= # STANDARD REMOVE #================================================= @@ -30,12 +23,27 @@ then fi #================================================= -# REMOVE APP MAIN DIR +# STOP AND REMOVE SERVICE +#================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 + +# Remove the dedicated systemd config +ynh_remove_systemd_config + +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + +#================================================= +# REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=6 -# Remove the app directory securely -ynh_secure_remove --file="$final_path" +# Remove metapackage and its dependencies +ynh_remove_nodejs #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index e3bfe87..105d683 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,6 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -<<<<<<< HEAD # SPECIFIC RESTORATION #================================================= @@ -67,8 +66,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening" #================================================= -======= ->>>>>>> testing # GENERIC FINALIZATION #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index 06e2398..3254d26 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,49 +25,24 @@ then ynh_die --message="Upgrade from version 0.8.3 is not possible. You must uninstall and reinstall Synapse-admin package manually" fi -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# If synapse_app doesn't exist, create it and assume it is `synapse` -if [ -z "$synapse_app" ]; then - synapse_app="synapse" - ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app -fi - -# Delete service and nodejs dependencies -if ynh_compare_current_package_version --comparison lt --version 0.8.7~ynh1 -then - ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" - yunohost service remove $app - ynh_remove_nodejs - ynh_remove_logrotate - ynh_remove_app_dependencies - - ynh_app_setting_delete --app=$app --key=synapse_port - ynh_app_setting_delete --app=$app --key=port -fi - -# Reload and store Synapse's settings, in case of they changed -synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) -synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) -ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain -ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port - #================================================= # STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=2 + ynh_script_progression --message="Upgrading source files..." --weight=16 - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi chmod -R o-rwx "$install_dir" @@ -76,7 +51,7 @@ chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -84,6 +59,62 @@ ynh_add_nginx_config # Create NGINX config to access /_synapse/admin endpoint ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=18 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + +#================================================= +# SPECIFIC UPGRADE +#============================================== +# INSTALL CODIMD +#============================================== +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 + + pushd "$install_dir" + ynh_use_nodejs + ynh_exec_warn_less yarn install + ynh_exec_warn_less yarn build + popd +fi + +#================================================= +# ADD A CONFIGURATION +#================================================= +#ynh_script_progression --message="Adding a configuration file..." --weight=1 + +#ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" + +#chown -R $app:www-data "$install_dir" + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=2 + +env_path="$PATH" +# Create a dedicated systemd config +ynh_add_systemd_config + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." + +yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="HTTP Server listening" + #================================================= # END OF SCRIPT #================================================= From f4f16d930119f1dad63d7b624f73e8f8848bfad9 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 10 Apr 2023 19:15:38 +0000 Subject: [PATCH 24/37] Auto-update README --- README.md | 4 ---- README_fr.md | 4 ---- 2 files changed, 8 deletions(-) diff --git a/README.md b/README.md index eaf6314..f5addcf 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Synapse-admin is an Admin UI for Matrix Synapse homeserver. -<<<<<<< HEAD -**Shipped version:** 0.8.7~ynh2 -======= **Shipped version:** 0.8.7~ynh1 ->>>>>>> parent of ec2cc1d (Merge branch 'testing' into version-2) ## Screenshots diff --git a/README_fr.md b/README_fr.md index 8255298..0ef8818 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,11 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Synapse-admin is an Admin UI for Matrix Synapse homeserver. -<<<<<<< HEAD -**Version incluse :** 0.8.7~ynh2 -======= **Version incluse :** 0.8.7~ynh1 ->>>>>>> parent of ec2cc1d (Merge branch 'testing' into version-2) ## Captures d’écran From 33ce16ffd12d3a979eed98484d971f0d54a34bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 12:57:53 +0200 Subject: [PATCH 25/37] revertremove systemd --- conf/systemd.service | 50 -------------------------------------------- scripts/backup | 6 ------ scripts/change_url | 19 ----------------- scripts/install | 23 -------------------- scripts/remove | 21 ------------------- scripts/restore | 22 ------------------- scripts/upgrade | 34 +----------------------------- 7 files changed, 1 insertion(+), 174 deletions(-) delete mode 100644 conf/systemd.service diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 8507e80..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,50 +0,0 @@ -[Unit] -Description=Synapse Admin -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__INSTALL_DIR__ -Environment="PATH=__ENV_PATH__" -Environment="NODE_ENV=production" -ExecStart=/usr/bin/yarn start -p __PORT__ -Restart=always - -# Sandboxing options to harden security -# Depending on specificities of your service/app, you may need to tweak these -# .. but this should be a good baseline -# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html -NoNewPrivileges=yes -PrivateTmp=yes -PrivateDevices=yes -RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK -RestrictNamespaces=yes -RestrictRealtime=yes -DevicePolicy=closed -ProtectClock=yes -ProtectHostname=yes -ProtectProc=invisible -ProtectSystem=full -ProtectControlGroups=yes -ProtectKernelModules=yes -ProtectKernelTunables=yes -LockPersonality=yes -SystemCallArchitectures=native -SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged - -# Denying access to capabilities that should not be relevant for webapps -# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html -CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD -CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE -CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT -CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK -CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM -CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG -CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE -CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW -CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG - -[Install] -WantedBy=multi-user.target diff --git a/scripts/backup b/scripts/backup index 70268d1..427816a 100644 --- a/scripts/backup +++ b/scripts/backup @@ -33,12 +33,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" ynh_backup --src_path="/etc/logrotate.d/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index fb3d33c..4ba8cf7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,15 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" - #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -25,16 +16,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#================================================= -# GENERIC FINALISATION -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -# Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 7b92c62..57bffee 100644 --- a/scripts/install +++ b/scripts/install @@ -75,14 +75,6 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chown -R $app:www-data "$install_dir" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -env_path="$PATH" -ynh_add_systemd_config - #================================================= # SETUP LOGROTATE #================================================= @@ -91,21 +83,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 - -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 42605b9..bdc4abe 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,27 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST -#================================================= - -# 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..." --weight=1 - yunohost service remove $app -fi - -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - -# Remove the dedicated systemd config -ynh_remove_systemd_config - #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 105d683..aa8a742 100644 --- a/scripts/restore +++ b/scripts/restore @@ -36,14 +36,6 @@ chown -R $app:www-data "$install_dir" # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -51,20 +43,6 @@ ynh_script_progression --message="Restoring the logrotate configuration..." --we ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3254d26..edf96c1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,15 +25,6 @@ then ynh_die --message="Upgrade from version 0.8.3 is not possible. You must uninstall and reinstall Synapse-admin package manually" fi -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -62,7 +53,7 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d #================================================= # UPGRADE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=18 +ynh_script_progression --message="Upgrading dependencies..." --weight=18 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -92,29 +83,6 @@ fi #chown -R $app:www-data "$install_dir" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=2 - -env_path="$PATH" -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="HTTP Server listening" - #================================================= # END OF SCRIPT #================================================= From 6bebda5ed0354586bb319797a8be29617edb2562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 12:59:44 +0200 Subject: [PATCH 26/37] remove yarn --- manifest.toml | 8 -------- scripts/_common.sh | 2 -- scripts/install | 21 --------------------- scripts/remove | 7 ------- scripts/restore | 7 ------- scripts/upgrade | 24 ------------------------ 6 files changed, 69 deletions(-) diff --git a/manifest.toml b/manifest.toml index 7d88ff1..13c5260 100644 --- a/manifest.toml +++ b/manifest.toml @@ -56,11 +56,3 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" - - [resources.apt] - packages = "" - - extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" - extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - extras.yarn.packages = "yarn" - \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index b818f0f..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -nodejs_version=16 - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 57bffee..cb23c70 100644 --- a/scripts/install +++ b/scripts/install @@ -23,14 +23,6 @@ synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=20 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -53,19 +45,6 @@ ynh_add_nginx_config # Create NGINX config to access /_synapse/admin endpoint ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" -#================================================= -# SPECIFIC SETUP -#============================================== -# INSTALL SYNAPSE-ADMIN -#============================================== -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 - -pushd "$install_dir" - ynh_use_nodejs - ynh_exec_warn_less yarn install - ynh_exec_warn_less yarn build -popd - #================================================= # ADD A CONFIGURATION #================================================= diff --git a/scripts/remove b/scripts/remove index bdc4abe..818dde6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,13 +17,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE DEPENDENCIES -#================================================= - -# Remove metapackage and its dependencies -ynh_remove_nodejs - #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index aa8a742..5ad44b5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,13 +29,6 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# SPECIFIC RESTORATION -#================================================= - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index edf96c1..705c98f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,30 +50,6 @@ ynh_add_nginx_config # Create NGINX config to access /_synapse/admin endpoint ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=18 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - -#================================================= -# SPECIFIC UPGRADE -#============================================== -# INSTALL CODIMD -#============================================== -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 - - pushd "$install_dir" - ynh_use_nodejs - ynh_exec_warn_less yarn install - ynh_exec_warn_less yarn build - popd -fi - #================================================= # ADD A CONFIGURATION #================================================= From d0de9f215864c211af32532e88db0e11fd90e4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 13:01:22 +0200 Subject: [PATCH 27/37] remove logrotate --- scripts/backup | 6 ------ scripts/install | 8 -------- scripts/remove | 8 -------- scripts/restore | 7 ------- 4 files changed, 29 deletions(-) diff --git a/scripts/backup b/scripts/backup index 427816a..1b290e6 100644 --- a/scripts/backup +++ b/scripts/backup @@ -27,12 +27,6 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index cb23c70..411daff 100644 --- a/scripts/install +++ b/scripts/install @@ -54,14 +54,6 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chown -R $app:www-data "$install_dir" -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 818dde6..938ac22 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,14 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 5ad44b5..e2e5e78 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,13 +29,6 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= From a341d4bf8048846fda4a471eb05701f0f4e2f173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:45:47 +0200 Subject: [PATCH 28/37] Update install --- scripts/install | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/install b/scripts/install index 411daff..0adbc34 100644 --- a/scripts/install +++ b/scripts/install @@ -45,15 +45,6 @@ ynh_add_nginx_config # Create NGINX config to access /_synapse/admin endpoint ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" - -chown -R $app:www-data "$install_dir" - #================================================= # END OF SCRIPT #================================================= From 67997713589e71badf02a8e959aae74f27963988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:46:14 +0200 Subject: [PATCH 29/37] Update upgrade --- scripts/upgrade | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 705c98f..f57afdc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,7 +33,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=16 - ynh_setup_source --dest_dir="$install_dir" --keep=".env" + ynh_setup_source --dest_dir="$install_dir" fi chmod -R o-rwx "$install_dir" @@ -50,15 +50,6 @@ ynh_add_nginx_config # Create NGINX config to access /_synapse/admin endpoint ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" -#================================================= -# ADD A CONFIGURATION -#================================================= -#ynh_script_progression --message="Adding a configuration file..." --weight=1 - -#ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" - -#chown -R $app:www-data "$install_dir" - #================================================= # END OF SCRIPT #================================================= From f9afb4dff0294a09de30a0b0685be0d92ebee237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:47:30 +0200 Subject: [PATCH 30/37] Delete .env --- conf/.env | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 conf/.env diff --git a/conf/.env b/conf/.env deleted file mode 100644 index 3be4fc3..0000000 --- a/conf/.env +++ /dev/null @@ -1,8 +0,0 @@ -# This setting allows to fix the homeserver. -# If you set this setting, the user will not be able to select -# the server and have to use synapse-admin with this server. - -REACT_APP_SERVER=https://__SYNAPSE_DOMAIN__ - -#Define the port to avoid collisions on port 3000 -PORT=__PORT__ From 6046da75ee72a8f5b68d2352d024e6689e269891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:47:54 +0200 Subject: [PATCH 31/37] cleaning --- .github/workflows/updater.sh | 122 ---------------------------------- .github/workflows/updater.yml | 49 -------------- 2 files changed, 171 deletions(-) delete mode 100755 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100755 index 7185409..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically -# Since each app is different, maintainers can adapt its contents so as to perform -# automatic actions when a new upstream release is detected. - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").tarball_url ] | join(" ") | @sh' | tr -d "'")) - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. -# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. - -# Let's loop over the array of assets URLs -for asset_url in ${assets[@]}; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"tarball"*) - src="app" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -#if [[ $filename == *.tar.gz ]]; then -extension=tar.gz -#else -#extension=${filename##*.} -#fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=true -EOT -echo "... conf/$src.src updated" - -else -echo "... asset ignored" -fi - -done - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index 81d9902..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - ./.github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - base: testing - branch: ci-auto-update-v${{ env.VERSION }} - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - draft: false From 0849ca7e517fe620d2880d68142a32724acdac5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:49:53 +0200 Subject: [PATCH 32/37] Update nginx.conf --- conf/nginx.conf | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0880bcd..0ac62b9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,19 +1,10 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_pass http://127.0.0.1:__PORT__; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + alias __FINAL_PATH__/; - client_max_body_size 50M; + index index.html; + try_files $uri $uri/ /index.html; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; From 9c223e7523ef3d1d348adc7d85752c3856b97cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 14:21:00 +0200 Subject: [PATCH 33/37] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0ac62b9..0cf760a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,7 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - alias __FINAL_PATH__/; + alias __INSTALL_DIR__/; index index.html; try_files $uri $uri/ /index.html; From 71c465bd1fb11bac4b95ee4d2916820c9cff0e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:47:13 +0200 Subject: [PATCH 34/37] cleaning --- conf/nginx.conf | 3 ++- scripts/install | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0cf760a..839a900 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,7 +4,8 @@ location __PATH__/ { alias __INSTALL_DIR__/; index index.html; - try_files $uri $uri/ /index.html; + + try_files $uri $uri/ __PATH__/index.html; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/scripts/install b/scripts/install index 0adbc34..e670487 100644 --- a/scripts/install +++ b/scripts/install @@ -16,10 +16,6 @@ source /usr/share/yunohost/helpers synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain) synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port) -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port From f45e98c6a5c4ba72b5a6856a08301512add953ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:49:16 +0200 Subject: [PATCH 35/37] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index e670487..6b37d13 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,7 @@ ynh_script_progression --message="Setting up source files..." --weight=2 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir +chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" From ea43f207502fc71575664ef53fc3a1f1fe4583d6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 9 Jul 2023 08:46:05 +0200 Subject: [PATCH 36/37] Update tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 0bbfd42..03c735c 100644 --- a/tests.toml +++ b/tests.toml @@ -10,7 +10,7 @@ test_format = 1.0 preinstall = """ sudo yunohost tools update apps - sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force + sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/1c36215f03e5bc1b4c22ec42f93e6188f73a9f36 -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force """ # ------------------------------- From 155f623263918d14b1ab4c5a61119ee9fdde6785 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 9 Jul 2023 08:48:39 +0200 Subject: [PATCH 37/37] cleaning --- manifest.toml | 2 +- scripts/install | 1 - scripts/restore | 20 +++++++++----------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/manifest.toml b/manifest.toml index 13c5260..0c61df6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "Apache-2.0" code = "https://github.com/Awesome-Technologies/synapse-admin" [integration] -yunohost = ">= 11.1.17" +yunohost = ">= 11.1.21" architectures = "all" multi_instance = false ldap = false diff --git a/scripts/install b/scripts/install index 6b37d13..e670487 100644 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,6 @@ ynh_script_progression --message="Setting up source files..." --weight=2 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" diff --git a/scripts/restore b/scripts/restore index e2e5e78..de3a7ef 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,26 +9,24 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=60 +ynh_script_progression --message="Restoring the app main directory..." --weight=10 ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf" + #================================================= # GENERIC FINALIZATION #=================================================