diff --git a/README.md b/README.md index 5f4861f..eda4df6 100755 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Hosting platform made for podcasters -**Shipped version:** 1.0.0-76~ynh1 +**Shipped version:** 1.0.0-77~ynh1 **Demo:** https://podcast.podlibre.org/@podlibre_fr diff --git a/README_fr.md b/README_fr.md index c2036f0..a33e63d 100755 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Plateforme d'hébergement conçue pour les podcasteurs -**Version incluse :** 1.0.0-76~ynh1 +**Version incluse :** 1.0.0-77~ynh1 **Démo :** https://podcast.podlibre.org/@podlibre_fr diff --git a/check_process b/check_process index 4763159..a1f6cf8 100755 --- a/check_process +++ b/check_process @@ -13,8 +13,6 @@ setup_private=1 setup_public=1 upgrade=1 - #1.0.0 alpha.64 - upgrade=1 from_commit=8ae9bec1e274f8764ad0a5db5297542c3274d999 #1.0.0 alpha.75 upgrade=1 from_commit=c8a5545d2b1d61342d837b7608fdc64a5b71b25b backup_restore=1 @@ -24,8 +22,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=8ae9bec1e274f8764ad0a5db5297542c3274d999 - name=1.0.0 alpha.64 ; commit=c8a5545d2b1d61342d837b7608fdc64a5b71b25b name=1.0.0 alpha.75 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass& diff --git a/conf/app.src b/conf/app.src index 8a081c2..b43607c 100755 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://code.podlibre.org/podlibre/castopod-host/uploads/d55c14c57d8ab40911bdd53bd7e8c2a5/castopod-host-1.0.0-alpha.76.zip -SOURCE_SUM=5f28f6cc1b8bf1b49f7238de7916b18f7e7a880235397dc5dfb17cec897ad9d5 +SOURCE_URL=https://code.podlibre.org/podlibre/castopod-host/uploads/85507bef4675ce7e04e71b7dd419f0ce/castopod-host-1.0.0-alpha.77.zip +SOURCE_SUM=89d6315cf7b16518f7dc2dbc675508806582df674d4a734311525b96c54ec861 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index ca9e59f..c5aa3be 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,17 +3,11 @@ location / { # Path to source alias __FINALPATH__/public/; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - index index.php; client_max_body_size 512M; try_files $uri $uri/ /index.php; - location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; diff --git a/manifest.json b/manifest.json index d19e3ba..753a955 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Hosting platform made for podcasters", "fr": "Plateforme d'hébergement conçue pour les podcasteurs" }, - "version": "1.0.0-76~ynh1", + "version": "1.0.0-77~ynh1", "url": "https://podlibre.org/", "upstream": { "license": "GPL-3.0-only", @@ -21,12 +21,12 @@ "email": "" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ "nginx", - "php7.3-fpm", + "php8.0-fpm", "mysql" ], "arguments": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 60ae74d..9d4db91 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ YNH_PHP_VERSION="8.0" -extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysqlnd" +pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysqlnd" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index ac247e1..e4c7888 100755 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD email=$(ynh_user_get_info --username=$admin --key=mail) +phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -48,6 +49,14 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin +ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion + +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -94,8 +103,7 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +ynh_add_fpm_config #================================================= # SPECIFIC SETUP @@ -119,6 +127,8 @@ chown $app:www-data "$final_path/.env" ynh_script_progression --message="Setuping a cron..." ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # SETUP APPLICATION WITH CURL diff --git a/scripts/remove b/scripts/remove index 7b22d1d..d2d7fa7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -30,6 +30,14 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE THE REDIS DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index bd7ca7b..0ef7741 100755 --- a/scripts/restore +++ b/scripts/restore @@ -36,8 +36,7 @@ phpversion=$YNH_PHP_VERSION #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -69,11 +68,17 @@ chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 -#ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE MYSQL DATABASE @@ -87,8 +92,11 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= # RESTORE VARIOUS FILES #================================================= +ynh_script_progression --message="Restoring cron job..." --weight=1 ynh_restore_file --origin_path="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index c9350fb..11035f9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,6 +30,20 @@ phpversion=$YNH_PHP_VERSION upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -54,20 +68,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # CREATE DEDICATED USER #================================================= @@ -102,13 +102,20 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config #================================================= # CONFIGURE CASTOPOD @@ -122,9 +129,11 @@ chown $app:www-data "$final_path/.env" #================================================= # SETUP CRON #================================================= -ynh_script_progression --message="Setuping cron..." +ynh_script_progression --message="Setuping cron..." --weight=1 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # RELOAD NGINX