diff --git a/README_fr.md b/README_fr.md index 3c7aa97..4bbc662 100644 --- a/README_fr.md +++ b/README_fr.md @@ -47,4 +47,4 @@ ou sudo yunohost app upgrade movim -u https://github.com/YunoHost-Apps/movim_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 035f7ee..9c79cf0 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1 +1 @@ -After installing the app, it can be configured at https://__DOMAIN__/movim/?admin using the username and password defined during the installation. +The app can be configured at using the username and password defined during the installation. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 4a138b2..ed9211f 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1 +1 @@ -Après l'installation, l'application peut être configurée sur https://__DOMAIN__/movim/?admin en utilisant le nom d'utilisateur et le mot de passe définis lors de l'installation. +L'application peut être configurée sur en utilisant le nom d'utilisateur et le mot de passe définis lors de l'installation. diff --git a/manifest.toml b/manifest.toml index 4de835a..bd31315 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "movim" @@ -45,13 +47,13 @@ ram.runtime = "50M" type = "password" [resources] - [resources.sources.main] - url = "https://github.com/movim/movim/archive/v0.22.5.tar.gz" - sha256 = "fcf0ae66fb48b013f277f39f7bebdc8a0a0b0312a4c3ecb8c23a8ed956a87c77" - autoupdate.strategy = "latest_github_tag" + [resources.sources.main] + url = "https://github.com/movim/movim/archive/v0.22.5.tar.gz" + sha256 = "fcf0ae66fb48b013f277f39f7bebdc8a0a0b0312a4c3ecb8c23a8ed956a87c77" + autoupdate.strategy = "latest_github_tag" [resources.ports] - + [resources.system_user] [resources.install_dir] @@ -60,7 +62,18 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "postgresql, php8.2-dom, php8.2-curl, php8.2-mbstring, php8.2-imagick, php8.2-gd, php8.2-pgsql, php8.2-xml" + packages = [ + "php8.2-curl", + "php8.2-mbstring", + "php8.2-imagick", + "php8.2-gd", + "php8.2-dom", + "php8.2-pgsql", + "php8.2-xml", + "postgresql", + "postgresql-contrib", + "apt-transport-https", + ] [resources.database] type = "postgresql" diff --git a/scripts/backup b/scripts/backup index 722244d..b371c66 100644 --- a/scripts/backup +++ b/scripts/backup @@ -22,21 +22,13 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= - ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/change_url b/scripts/change_url index c4e20f3..dde6c32 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -28,23 +28,16 @@ ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS #================================================= -# SETUP SYSTEMD -#================================================= ynh_script_progression --message="Configuring a systemd service..." -domain=$new_domain -path=$new_path ynh_add_systemd_config -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a 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="Movim daemon launched" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Movim daemon launched" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index bfd629b..3401602 100644 --- a/scripts/install +++ b/scripts/install @@ -8,18 +8,12 @@ source _common.sh source /usr/share/yunohost/helpers - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= timezone=$(cat /etc/timezone) -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -29,23 +23,7 @@ ynh_script_progression --message="Setting up source files..." ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP-FPM..." - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low - -# Create a dedicated NGINX config -ynh_add_nginx_config - -# Create a dedicated systemd config -ynh_add_systemd_config - -yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" +chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC SETUP @@ -57,7 +35,7 @@ ynh_script_progression --message="Adding a configuration file..." ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 650 "$install_dir/.env" -chown $app:$app "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # BUILD MOVIM @@ -71,13 +49,28 @@ ynh_install_composer #ynh_exec_warn_less ynh_exec_as "$app" ynh_composer_exec --commands="movim:migrate" ynh_composer_exec --commands="movim:migrate" +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring PHP-FPM..." + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --usage=low --footprint=low + +# Create a dedicated NGINX config +ynh_add_nginx_config + +# Create a dedicated systemd config +ynh_add_systemd_config +yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Movim daemon launched" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Movim daemon launched" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 9c92c69..24adb09 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,15 +12,11 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE -#================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" fi # Remove the dedicated systemd config diff --git a/scripts/restore b/scripts/restore index 112e9ec..62e084c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,33 +24,30 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." -ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint +#FIXME: ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - -yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" +systemctl enable "$app.service" --quiet +yunohost service add "$app" --description="Responsive web-based XMPP client" #================================================= # GENERIC FINALIZATION @@ -59,10 +56,10 @@ yunohost service add $app --description="Responsive web-based XMPP client" --log #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Movim daemon launched" -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Movim daemon launched" +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=nginx --action=Reloading #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index e0b6048..a6b60b4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,12 +15,6 @@ source /usr/share/yunohost/helpers timezone=$(cat /etc/timezone) -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -28,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -38,52 +32,32 @@ ynh_script_progression --message="Ensuring downward compatibility..." # If fpm_footprint doesn't exist, create it if [ -z "${fpm_footprint:-}" ]; then fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint + ynh_app_setting_set --app="$app" --key=fpm_footprint --value="$fpm_footprint" fi # If fpm_free_footprint doesn't exist, create it if [ -z "${fpm_free_footprint:-}" ]; then fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint + ynh_app_setting_set --app="$app" --key=fpm_free_footprint --value="$fpm_free_footprint" fi # If fpm_usage doesn't exist, create it if [ -z "${fpm_usage:-}" ]; then fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + ynh_app_setting_set --app="$app" --key=fpm_usage --value="$fpm_usage" fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" - -fi +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint - -# Create a dedicated NGINX config -ynh_add_nginx_config - -# Create a dedicated systemd config -ynh_add_systemd_config - -yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" #================================================= # SPECIFIC UPGRADE @@ -95,7 +69,7 @@ ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" -chown $app:$app "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # BUILD MOVIM @@ -108,12 +82,28 @@ ynh_exec_warn_less ynh_composer_exec --commands="config --global discard-changes ynh_exec_warn_less ynh_composer_exec --commands="update --no-interaction --quiet" ynh_exec_warn_less ynh_composer_exec --commands="movim:migrate --quiet" +#================================================= +# REAPPLY SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --phpversion="$phpversion" --usage="$fpm_usage" --footprint="$fpm_footprint" + +# Create a dedicated NGINX config +ynh_add_nginx_config + +# Create a dedicated systemd config +ynh_add_systemd_config +yunohost service add "$app" --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Movim daemon launched" +# Start a systemd service +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Movim daemon launched" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml index b04c0fe..f1e72b7 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default]