From 9149354f5a1394cc8896176d70bf27200589bbb2 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 31 Aug 2024 00:59:19 +0200 Subject: [PATCH 1/2] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + conf/extra_php-fpm.conf | 5 ---- conf/nginx.conf | 2 +- manifest.toml | 4 ++- scripts/_common.sh | 14 +---------- scripts/backup | 25 ++++++------------- scripts/change_url | 14 +++-------- scripts/install | 33 +++++++++++-------------- scripts/remove | 14 +++-------- scripts/restore | 39 ++++++++++++------------------ scripts/upgrade | 21 ++++++---------- sources/extra_files/app/.gitignore | 2 -- sources/patches/.gitignore | 2 -- 13 files changed, 58 insertions(+), 118 deletions(-) delete mode 100644 conf/extra_php-fpm.conf delete mode 100644 sources/extra_files/app/.gitignore delete mode 100644 sources/patches/.gitignore diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index 076e6a9..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,5 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 50M -php_admin_value[memory_limit] = 512M diff --git a/conf/nginx.conf b/conf/nginx.conf index f5f5591..82eec07 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ location ^~ __PATH__/ { location ~* \.php$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/manifest.toml b/manifest.toml index bbd9326..74370d2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,8 @@ cpe = "cpe:2.3:a:koel:koel" fund = "https://opencollective.com/koel" [integration] -yunohost = ">= 11.1.21" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = false @@ -53,6 +54,7 @@ ram.runtime = "50M" allow_email = true [resources.install_dir] + group = "www-data:r-x" [resources.data_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..3d7f008 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,5 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 9d63962..82951e9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,49 +1,40 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$data_dir" --is_big +ynh_backup "$data_dir" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index a4fcb69..39d37fc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,25 +1,17 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 21704ee..b38805a 100755 --- a/scripts/install +++ b/scripts/install @@ -1,29 +1,24 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set --key=php_memory_limit --value=512M + #================================================= # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir="$install_dir" -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================ -ynh_script_progression --message="Initializing multimedia directories..." --weight=1 +ynh_script_progression "Initializing multimedia directories..." ynh_multimedia_build_main_dir ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="$app" @@ -34,31 +29,31 @@ ynh_multimedia_addaccess $app #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression "Adding $app's configuration..." app_key=$(ynh_string_random --length=32) -ynh_app_setting_set --app="$app" --key="app_key" --value="$app_key" -ynh_add_config --template="env" --destination="$install_dir/.env" +ynh_app_setting_set --key="app_key" --value="$app_key" +ynh_config_add --template="env" --destination="$install_dir/.env" #================================================= # INITIALIZE THE APP #================================================= -ynh_script_progression --message="Initializing $app..." --weight=1 +ynh_script_progression "Initializing $app..." pushd $install_dir - ynh_exec_as $app php$phpversion artisan koel:init --no-assets --no-interaction --quiet + ynh_exec_as_app php$php_version artisan koel:init --no-assets --no-interaction --quiet popd #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index e7a51e2..d35597a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -13,14 +7,14 @@ source /usr/share/yunohost/helpers # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_remove_nginx_config +ynh_config_remove_nginx -ynh_remove_fpm_config +ynh_config_remove_phpfpm -ynh_secure_remove --file="/home/yunohost.multimedia/$app" +ynh_safe_rm "/home/yunohost.multimedia/$app" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 19f0b44..fcbe58e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,25 +7,24 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chown -R $app:www-data "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Restoring the data directory..." --weight=1 +ynh_script_progression "Restoring the data directory..." -ynh_restore_file --origin_path="$data_dir" --not_mandatory +ynh_restore "$data_dir" chown -R $app:www-data "$data_dir" #================================================= # RESTORING MULTIMEDIA DIRECTORIES #================================================ -ynh_script_progression --message="Restoring multimedia directories..." --weight=1 +ynh_script_progression "Restoring multimedia directories..." ynh_multimedia_build_main_dir ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="$app" @@ -40,35 +33,33 @@ ynh_multimedia_addaccess $app #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression "Restoring the MySQL database..." -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." # Typically you only have either $app or php-fpm but not both at the same time... -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemctl --service=php$php_version-fpm --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 145220e..8881e80 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,37 +1,32 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set_default --key=php_memory_limit --value=512M + #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=1 +ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed" diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] From 3c84842acd820047a718702f67526038c00c9949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:02:05 +0200 Subject: [PATCH 2/2] cleaning --- manifest.toml | 2 +- scripts/install | 6 +----- scripts/restore | 3 --- scripts/upgrade | 4 ---- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/manifest.toml b/manifest.toml index 74370d2..d8ad063 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ cpe = "cpe:2.3:a:koel:koel" fund = "https://opencollective.com/koel" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = true diff --git a/scripts/install b/scripts/install index b38805a..e073788 100755 --- a/scripts/install +++ b/scripts/install @@ -5,8 +5,6 @@ source /usr/share/yunohost/helpers ynh_app_setting_set --key=php_memory_limit --value=512M -#================================================= -# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -14,7 +12,6 @@ ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir="$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================ @@ -24,8 +21,6 @@ ynh_multimedia_build_main_dir ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="$app" ynh_multimedia_addaccess $app -#================================================= -# APP INITIAL CONFIGURATION #================================================= # ADD A CONFIGURATION #================================================= @@ -56,4 +51,5 @@ ynh_config_add_nginx #================================================= # END OF SCRIPT #================================================= + ynh_script_progression "Installation of $app completed" diff --git a/scripts/restore b/scripts/restore index fcbe58e..2a5e447 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -11,7 +10,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= @@ -53,7 +51,6 @@ ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression "Reloading NGINX web server and $app's service..." -# Typically you only have either $app or php-fpm but not both at the same time... ynh_systemctl --service=php$php_version-fpm --action=reload ynh_systemctl --service=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 8881e80..3e0d740 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -5,17 +5,13 @@ source /usr/share/yunohost/helpers ynh_app_setting_set_default --key=php_memory_limit --value=512M -#================================================= -# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #=================================================