From 76fe8fc214c79ee77348059e662db2e6cca24325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= Date: Sun, 29 Nov 2020 13:29:22 +0000 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d986e02..d6485b0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A modern, convivial and free music server on YunoHost Installation requires a dedicated domain or subdomain. Installing in a subpath is not supported by the upstream project due to dependency requirements. -**Shipped version:** 0.21.1 +**Shipped version:** 1.0 ## Screenshots From 452f2cad22a5546087f5a69d4dace8154ba71a59 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 16:51:27 +0100 Subject: [PATCH 2/6] Fix linter warnings --- scripts/_common.sh | 69 ---------------------------------------------- scripts/restore | 12 ++++---- scripts/upgrade | 13 ++++----- 3 files changed, 11 insertions(+), 83 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 180e689..45b1e90 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -125,72 +125,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" # Send the email to the recipients echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" } - -#================================================= -# fail2ban helpers -# taken from https://github.com/YunoHost-Apps/shaarli_ynh -#================================================= - -# Create a dedicated fail2ban config (jail and filter conf files) -# -# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]] -# | arg: log_file - Log file to be checked by fail2ban -# | arg: failregex - Failregex to be looked for by fail2ban -# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3 -# | arg: ports - Ports blocked for a banned IP address - default: http,https -ynh_add_fail2ban_config () { - local logpath - local failregex - local max_retry - local ports - - logpath=$1 - failregex=$2 - max_retry=${3:-3} - ports=${4:-http,https} - - test -n "$logpath" || ynh_die --message="ynh_add_fail2ban_config expects a logfile path as first argument and received nothing." - test -n "$failregex" || ynh_die --message="ynh_add_fail2ban_config expects a failure regex as second argument and received nothing." - - finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf" - finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1 - ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1 - - sudo tee "$finalfail2banjailconf" <&2 - echo "WARNING${fail2ban_error#*WARNING}" >&2 - fi -} - -# Remove the dedicated fail2ban config (jail and filter conf files) -# -# usage: ynh_remove_fail2ban_config -ynh_remove_fail2ban_config () { - ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf" - ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf" - systemctl reload fail2ban -} diff --git a/scripts/restore b/scripts/restore index d135d4e..0eb59f6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -131,17 +131,17 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app-server.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-worker.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.target" -systemctl enable "$app-beat.service" -systemctl enable "$app-server.service" -systemctl enable "$app-worker.service" +systemctl enable "$app-beat.service" --quiet +systemctl enable "$app-server.service" --quiet +systemctl enable "$app-worker.service" --quiet #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add "$app-server" --log "/var/log/$app/server.log" -yunohost service add "$app-worker" --log "/var/log/$app/worker.log" -yunohost service add "$app-beat" --log "/var/log/$app/beat.log" +yunohost service add "$app-server" --log="/var/log/$app/server.log" +yunohost service add "$app-worker" --log="/var/log/$app/worker.log" +yunohost service add "$app-beat" --log="/var/log/$app/beat.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 7cf2238..e88049c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,13 +74,6 @@ ynh_abort_if_errors # CHECK THE PATH #================================================= -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path "$path_url") - -#================================================= -# CHECK THE PATH -#================================================= - # see 0.20.0: https://docs.funkwhale.audio/changelog.html#automatically-load-env-file loadfile="$final_path/code/load_env" if [ -e "$loadfile" ] ; then @@ -220,7 +213,7 @@ ynh_replace_string --match_string="__KEY__" --replace_string="$key" # Delete the original thumbnails and generate new ones for # higher quality images # https://docs.funkwhale.audio/changelog.html#increased-quality-of-jpeg-thumbnails-manual-action-required - rm -rf "$final_path/media/__sized__" + ynh_secure_remove "$final_path/media/__sized__" python api/manage.py fw media generate-thumbnails ) @@ -263,6 +256,10 @@ chmod -R 755 "$final_path/code/front/dist/" mkdir -p "/var/log/$app" chown -R "$app": "/var/log/$app" +yunohost service add "$app-server" --log="/var/log/$app/server.log" +yunohost service add "$app-worker" --log="/var/log/$app/worker.log" +yunohost service add "$app-beat" --log="/var/log/$app/beat.log" + #================================================= # SETUP SSOWAT #================================================= From f0a628dc6ddd1de04f2bfaa80ec3559234485df0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 16:56:37 +0100 Subject: [PATCH 3/6] Fix linter --- scripts/backup | 8 ++++---- scripts/install | 6 +++--- scripts/upgrade | 4 ++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/backup b/scripts/backup index d8a772f..3c0c590 100644 --- a/scripts/backup +++ b/scripts/backup @@ -32,11 +32,13 @@ domain=$(ynh_app_setting_get --app="$app" --key=domain) db_name=$(ynh_app_setting_get --app="$app" --key=db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info --message="Backing up the main app directory..." backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only) # If backup_core_only have any value in the settings.yml file, do not backup the data directory @@ -51,7 +53,6 @@ fi #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.conf" @@ -68,7 +69,6 @@ ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # BACKUP SYSTEMD #================================================= -ynh_print_info --message="Backing up systemd configuration..." ynh_backup --src_path="/etc/systemd/system/$app-beat.service" ynh_backup --src_path="/etc/systemd/system/$app-server.service" diff --git a/scripts/install b/scripts/install index c0a1315..f4ab769 100644 --- a/scripts/install +++ b/scripts/install @@ -212,9 +212,9 @@ chown -R "$app": "/var/log/$app" # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add "$app-server" --log "/var/log/$app/server.log" -yunohost service add "$app-worker" --log "/var/log/$app/worker.log" -yunohost service add "$app-beat" --log "/var/log/$app/beat.log" +yunohost service add "$app-server" --log="/var/log/$app/server.log" +yunohost service add "$app-worker" --log="/var/log/$app/worker.log" +yunohost service add "$app-beat" --log="/var/log/$app/beat.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index e88049c..fc75a1b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -256,6 +256,10 @@ chmod -R 755 "$final_path/code/front/dist/" mkdir -p "/var/log/$app" chown -R "$app": "/var/log/$app" +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + yunohost service add "$app-server" --log="/var/log/$app/server.log" yunohost service add "$app-worker" --log="/var/log/$app/worker.log" yunohost service add "$app-beat" --log="/var/log/$app/beat.log" From 4fcdd9badf54acdf4539b8fc68e89c77516687b7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 17:08:43 +0100 Subject: [PATCH 4/6] Fix linter warnings --- scripts/install | 28 ++++++++++++++-------------- scripts/remove | 36 +++++++++++++----------------------- scripts/restore | 20 ++++++++++---------- scripts/upgrade | 40 +++++++++++++++------------------------- 4 files changed, 52 insertions(+), 72 deletions(-) diff --git a/scripts/install b/scripts/install index f4ab769..66a3806 100644 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path="/var/www/$app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -44,7 +44,7 @@ ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app="$app" --key=domain --value="$domain" ynh_app_setting_set --app="$app" --key=path --value="$path_url" @@ -56,7 +56,7 @@ ynh_app_setting_set --app="$app" --key=admin --value="$admin" #================================================= # FIND AND OPEN A PORT #================================================= -ynh_print_info --message="Configuring firewall..." +ynh_script_progression --message="Configuring firewall..." # Find a free port port=$(ynh_find_port --port=5000) @@ -66,14 +66,14 @@ ynh_app_setting_set --app="$app" --key=port --value="$port" #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Creating a PostgreSQL database..." +ynh_script_progression --message="Creating a PostgreSQL database..." ynh_psql_test_if_first_run @@ -89,7 +89,7 @@ ynh_psql_setup_db --db_name="$db_name" --db_user="$db_user" --db_pwd="$db_pwd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Setting up source files..." +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" # Download, check integrity, uncompress and patch the source from app.src @@ -104,7 +104,7 @@ ynh_setup_source --dest_dir="$final_path/code" --source_id="app-frontend" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -112,7 +112,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username="$app" --home_dir="$final_path" @@ -179,7 +179,7 @@ admin_mail=$(ynh_user_get_info --username="$admin" --key="mail") #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." cp ../conf/funkwhale.target "/etc/systemd/system/$app.target" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/systemd/system/$app.target" @@ -219,7 +219,7 @@ yunohost service add "$app-beat" --log="/var/log/$app/beat.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --action="start" --service_name="${app}-beat" ynh_systemd_action --action="start" --service_name="${app}-server" @@ -228,7 +228,7 @@ ynh_systemd_action --action="start" --service_name="${app}-worker" #================================================= # SETUP FAIL2BAN #================================================= -ynh_print_info --message="Configuring fail2ban..." +ynh_script_progression --message="Configuring Fail2Ban..." # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex=".* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" --max_retry=5 @@ -236,7 +236,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." # Make app public if necessary if [ "$is_public" -eq 1 ] @@ -248,7 +248,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -256,4 +256,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 8cd36d7..ecbe446 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -32,26 +32,26 @@ redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db) # Remove a service from the admin panel, added by `yunohost service add` if yunohost service status "$app-server" >/dev/null 2>&1 then - ynh_print_info --message="Remove $app-server service" + ynh_script_progression --message="Remove $app-server service" yunohost service remove "$app-server" fi if yunohost service status "$app-worker" >/dev/null 2>&1 then - ynh_print_info --message="Remove $app-worker service" + ynh_script_progression --message="Remove $app-worker service" yunohost service remove "$app-worker" fi if yunohost service status "$app-beat" >/dev/null 2>&1 then - ynh_print_info --message="Remove $app-beat service" + ynh_script_progression --message="Remove $app-beat service" yunohost service remove "$app-beat" fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info --message="Stopping and removing the systemd service" +ynh_script_progression --message="Stopping and removing the systemd service" ynh_systemd_action --action="stop" --service_name="${app}-beat" ynh_systemd_action --action="stop" --service_name="${app}-server" @@ -67,7 +67,7 @@ ynh_secure_remove --file="/etc/systemd/system/$app.target" #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Removing the PostgreSQL database" +ynh_script_progression --message="Removing the PostgreSQL database" # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_name="$db_name" --db_user="$db_user" @@ -75,7 +75,7 @@ ynh_psql_remove_db --db_name="$db_name" --db_user="$db_user" #================================================= # REMOVE THE REDIS DATABASE #================================================= -ynh_print_info --message="Removing the Redis database" +ynh_script_progression --message="Removing the Redis database" # Remove a database if it exists, along with the associated user ynh_redis_remove_db "$redis_db" @@ -83,7 +83,7 @@ ynh_redis_remove_db "$redis_db" #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info --message="Removing dependencies" +ynh_script_progression --message="Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -91,7 +91,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory" +ynh_script_progression --message="Removing app main directory" # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -101,25 +101,15 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration" +ynh_script_progression --message="Removing NGINX web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_print_info --message="Closing port $port" - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_print_info --message="Removing fail2ban configuration..." +ynh_script_progression --message="Removing fail2ban configuration..." ynh_remove_fail2ban_config @@ -128,7 +118,7 @@ ynh_remove_fail2ban_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user" # Delete a system user ynh_system_user_delete --username="$app" @@ -137,4 +127,4 @@ ynh_system_user_delete --username="$app" # END OF SCRIPT #================================================= -ynh_print_info --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 0eb59f6..7802232 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -37,7 +37,7 @@ db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available --domain="$domain" --path_url="$path_url" \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -56,7 +56,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only) @@ -86,7 +86,7 @@ fi #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username="$app" --home_dir="$final_path" @@ -107,7 +107,7 @@ chown -R "$app": "/var/log/$app" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -115,7 +115,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Restoring the PostgreSQL database..." +ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_psql_test_if_first_run ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd" @@ -124,7 +124,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info --message="Restoring the systemd configuration..." +ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app-beat.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-server.service" @@ -146,7 +146,7 @@ yunohost service add "$app-beat" --log="/var/log/$app/beat.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --action="start" --service_name="${app}-beat" ynh_systemd_action --action="start" --service_name="${app}-server" @@ -157,7 +157,7 @@ ynh_systemd_action --action="start" --service_name="${app}-worker" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -165,4 +165,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index fc75a1b..890fe04 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -30,7 +30,7 @@ code_migration=$(ynh_app_setting_get --app="$app" --key=code_migration) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." # If redis_db doesn't exist, create it if [ -z "$redis_db" ]; then @@ -55,7 +55,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Inform the backup/restore process that it should not save the data directory ynh_app_setting_set --app="$app" --key=backup_core_only --value=1 @@ -80,22 +80,12 @@ if [ -e "$loadfile" ] ; then ynh_secure_remove --file="$loadfile" fi -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - echo "Close port $port" - yunohost firewall disallow TCP $port 2>&1 -fi - #================================================= # STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --action="stop" --service_name="${app}-beat" ynh_systemd_action --action="stop" --service_name="${app}-server" @@ -104,7 +94,7 @@ ynh_systemd_action --action="stop" --service_name="${app}-worker" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" # Download, check integrity, uncompress and patch the source from app.src @@ -119,22 +109,22 @@ ynh_setup_source --dest_dir="$final_path/code" --source_id="app-frontend" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info --message="Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username="$app" --home_dir="$final_path" @@ -227,7 +217,7 @@ ynh_store_file_checksum --file="$configfile" #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Upgrading systemd configuration..." +ynh_script_progression --message="Upgrading systemd configuration..." cp ../conf/funkwhale.target "/etc/systemd/system/$app.target" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/systemd/system/$app.target" @@ -242,7 +232,7 @@ ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.servic #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_print_info --message="Reconfiguring fail2ban..." +ynh_script_progression --message="Reconfiguring Fail2Ban..." ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex=".* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" --max_retry=5 @@ -267,7 +257,7 @@ yunohost service add "$app-beat" --log="/var/log/$app/beat.log" #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." # Make app public if necessary if [ "$is_public" -eq 1 ] @@ -279,7 +269,7 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --action="start" --service_name="${app}-beat" ynh_systemd_action --action="start" --service_name="${app}-server" @@ -288,7 +278,7 @@ ynh_systemd_action --action="start" --service_name="${app}-worker" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -302,4 +292,4 @@ ynh_app_setting_set --app="$app" --key=code_migration --value=2 # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" From eac6e16df08eaf0c46f93ffb36e3403e314b1385 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 17:47:05 +0100 Subject: [PATCH 5/6] Cleaning up --- check_process | 24 +++--------------------- scripts/remove | 2 +- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/check_process b/check_process index e52d86f..a451a0f 100644 --- a/check_process +++ b/check_process @@ -22,29 +22,11 @@ incorrect_path=0 port_already_use=0 change_url=0 -;;; Levels - ;;; Options Email=cda@rootkey.co.uk Notification=all ;;; Upgrade options - ; commit=80a5044d13a6782063fee2d7fb7a01832a6aa767 - name=Upgrade from 0.16.3 -manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 - ; commit=806bcb0f320d8e3e28711a9ae1d2b175b95c65ce - name=Upgrade from 0.17.0~ynh2 -manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 - ; commit=99bae16efca321ce50ba9a98c62996169195e0ba - name=Upgrade from 0.18.3 -manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 ; commit=4d4bf0981e2d3a00eaae6b19bd54344fe55d6530 - name=Upgrade from 0.19.1 -manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 - ; commit=4d4bf0981e2d3a00eaae6b19bd54344fe55d6530 - name=Upgrade from 0.20.1 -manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 - ; commit=18dd9d6a59ad1f0d03dc634b20e805b5c4f6c6e9 - name=Upgrade from 0.21 -manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 - ; commit=5fe8d545994eed02707ed0133a68db919bd5d3bb - name=Upgrade from 0.21.1 + name=Upgrade to 0.19.1 and fix channels-redis bug + manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 + \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index ecbe446..0567cde 100644 --- a/scripts/remove +++ b/scripts/remove @@ -109,7 +109,7 @@ ynh_remove_nginx_config #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." +ynh_script_progression --message="Removing Fail2Ban configuration..." ynh_remove_fail2ban_config From 5b240fb9005e1880851a6566ff4b3e2fbc6e216f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 17:48:30 +0100 Subject: [PATCH 6/6] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d6485b0..693a6f5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Install Funkwhale with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=funkwhale) > *This package allows you to install Funkwhale quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it. +If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* ## Overview A modern, convivial and free music server on YunoHost @@ -61,8 +61,7 @@ The admin interface is accessible at the address: your.domain.fr/api/admin --- -Developers info ----------------- +## Developers info Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/funkwhale_ynh/tree/testing).