diff --git a/README.md b/README.md index 22537f0..faede07 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Monica for YunoHost [![Integration level](https://dash.yunohost.org/integration/monica.svg)](https://dash.yunohost.org/appci/app/monica) ![](https://ci-apps.yunohost.org/ci/badges/monica.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/monica.maintain.svg) - [![Install Monica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=monica) > *This package allows you to install Monica quickly and simply on a YunoHost server. @@ -18,7 +17,7 @@ Monica is an open-source web application to organize the interactions with your ## Configuration -Change the settings of the app by changing the values in .env +Change the settings of the app by changing the values in `.env` ## YunoHost specific features @@ -36,23 +35,9 @@ Change the settings of the app by changing the values in .env * Upstream app repository: https://github.com/monicahq/monica * YunoHost website: https://yunohost.org/ -## Introduction - - -## What works? -* [X] Update and remove script -* [X] Upgrade script -* [X] Backup and restore script -* [X] Multi-instance -* [x] make root domain redirect to index.php -* [x] Chang URL (Need testing,backup before trying this) -* [ ] LDAP/SSO support -* [x] Make monica installable into subdirectory (eg. https://example.com/monica/) - --- -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/monica_ynh/tree/testing). diff --git a/check_process b/check_process index 49cc93f..9a26695 100644 --- a/check_process +++ b/check_process @@ -44,3 +44,5 @@ Notification=change name=2.14.0 ; commit=4b497cf6445fc515070265721f40ceb816864bf1 name=2.17.0~ynh1 + ; commit=d03eaae18c5b99f7933ae18378d5567fc46389f5 + name=2.17.0~ynh2 diff --git a/issue_template.md b/issue_template.md index 7b47b30..5d6c499 100644 --- a/issue_template.md +++ b/issue_template.md @@ -7,7 +7,7 @@ about: Create a report to help us debug, it would be nice to fill the template a **How to post a meaningful bug report** 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *Otherwise, the issue may be due to Monica itself. Refer to its documentation or repository for help.* - *If you have a doubt, post here, we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* @@ -34,8 +34,8 @@ about: Create a report to help us debug, it would be nice to fill the template a - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* **Expected behavior** diff --git a/manifest.json b/manifest.json index dd6bcdd..5cc62d6 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "url": "http://github.com/rndmh3ro/monica_ynh" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ @@ -75,7 +75,8 @@ "name": "dav_support", "type": "boolean", "ask": { - "en": "Enable DAV support?" + "en": "Enable DAV support?", + "fr": "Activer le support DAV ?" }, "default": true }, @@ -83,7 +84,8 @@ "name": "signup", "type": "boolean", "ask": { - "en": "Enable signup for public users?" + "en": "Enable signup for public users?", + "fr": "Activer l'inscription pour les utilisateurs publics ?" }, "default": false }, @@ -91,7 +93,8 @@ "name": "two_factor", "type": "boolean", "ask": { - "en": "Enable Two Factor Authentication for accounts?" + "en": "Enable Two Factor Authentication for accounts?", + "fr": "Activer l'authentification à deux facteurs pour les comptes ?" }, "default": false } diff --git a/scripts/_common.sh b/scripts/_common.sh index 094fc02..6254bc4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ pkg_dependencies="redis-server" YNH_PHP_VERSION="7.3" -extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-redis" +extra_php_dependencies="php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-redis" #================================================= # PERSONAL HELPERS diff --git a/scripts/change_url b/scripts/change_url index 2024b5d..d3a7955 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -38,7 +38,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -73,22 +73,23 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# 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 + # 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 + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -102,14 +103,16 @@ fi # SPECIFIC MODIFICATIONS #================================================= # Run monica update -cd $final_path && sudo /usr/bin/php7.2 artisan monica:update --force +pushd "$final_path" + php$phpversion artisan monica:update --force +popd #================================================= # GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index a2af4c3..8d7c6a9 100755 --- a/scripts/install +++ b/scripts/install @@ -94,9 +94,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -110,9 +110,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -121,7 +121,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # INSTALL COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Installing composer dependencies..." +ynh_script_progression --message="Installing Composer dependencies..." ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" @@ -217,6 +217,7 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R $app: $final_path chmod -R 775 "$final_path/storage" + #================================================= # SETUP SSOWAT #================================================= @@ -232,7 +233,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index f007d4a..f5ada37 100755 --- a/scripts/remove +++ b/scripts/remove @@ -50,17 +50,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." +ynh_script_progression --message="Removing PHP-FPM configuration..." -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= diff --git a/scripts/restore b/scripts/restore index 82fa4a5..4248aa3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -49,7 +49,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the nginx configuration..." +ynh_script_progression --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -76,6 +76,7 @@ ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files chown -R $app: $final_path chmod -R 775 "$final_path/storage" + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -83,7 +84,7 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..." ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -# Recreate a dedicated php-fpm config +# Recreate a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" #================================================= @@ -117,7 +118,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index d98d120..f56ad4f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -111,9 +111,9 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --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 #================================================= @@ -134,9 +134,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -145,9 +145,9 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # UPDATE PHP DEPENDENCIES #================================================= -ynh_script_progression --message="Updating php dependencies..." +ynh_script_progression --message="Updating PHP dependencies..." -chown -R "$app": "$final_path" +chown -R $app: "$final_path" ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update" @@ -261,6 +261,7 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R $app: $final_path chmod -R 775 "$final_path/storage" + #================================================= # SETUP SSOWAT #================================================= @@ -276,7 +277,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/ynh_composer__2 b/scripts/ynh_composer__2 index 6f9676b..532a01c 100644 --- a/scripts/ynh_composer__2 +++ b/scripts/ynh_composer__2 @@ -1,5 +1,10 @@ #!/bin/bash +readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17 +# Declare the actual composer version to use. +# A packager willing to use another version of composer can override the variable into its _common.sh. +YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION} + # Execute a command with Composer # # usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands" @@ -25,26 +30,28 @@ ynh_composer_exec () { # Install and initialize Composer in the given directory # -# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] +# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion] # | arg: -v, --phpversion - PHP version to use with composer # | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. # | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include ynh_install_composer () { # Declare an array to define the options of this helper. local legacy_args=vwa - declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args=) + declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=) local phpversion local workdir local install_args + local composerversion # Manage arguments with getopts ynh_handle_getopts_args "$@" workdir="${workdir:-$final_path}" phpversion="${phpversion:-$YNH_PHP_VERSION}" install_args="${install_args:-}" + composerversion="${composerversion:-$YNH_COMPOSER_VERSION}" curl -sS https://getcomposer.org/installer \ | COMPOSER_HOME="$workdir/.composer" \ - php${phpversion} -- --install-dir="$workdir" \ + php${phpversion} -- --install-dir="$workdir" --version="$composerversion" \ || ynh_die "Unable to install Composer." # update dependencies to create composer.lock