diff --git a/README.md b/README.md index 776fbd5..007502b 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ # Garradin for YunoHost -[![Integration level](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg) [![Install Garradin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=garradin) *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Garradin quickly and simply on a YunoHost server. +> *This package allows you to install Garradin quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview Garradin is a free association managing software. -**Shipped version:** 0.9.7 +**Shipped version:** 0.9.8.1 ## Screenshots @@ -26,7 +26,7 @@ Garradin is a free association managing software. * [Official demo](https://garradin.eu/essai/) ## Documentation - + * Official documentation: https://fossil.kd2.org/garradin/wiki?name=Documentation ## YunoHost specific features @@ -42,7 +42,8 @@ LDAP is not supported yet. ## Limitations -* Garradin is only available in French. +* The application is ONLY translated into french. +* Do not install this application on the default root path's domain name without adding a subpath, otherwise the sso conection page will be substitute by home's garradin page. ## Links @@ -53,8 +54,7 @@ LDAP is not supported yet. --- -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/garradin_ynh/tree/testing). @@ -62,5 +62,5 @@ To try the testing branch, please proceed like that. ``` sudo yunohost app install https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug or -sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug +sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug ``` diff --git a/README_fr.md b/README_fr.md index c29bc61..05337c9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## Vue d'ensemble Garradin est un logiciel libre de gestion associative. il permet de gérer des membres. -**Version incluse :** 0.9.7 +**Version incluse :** 0.9.8.1 ## Captures d'écran @@ -43,6 +43,7 @@ Garradin est un logiciel libre de gestion associative. il permet de gérer des m ## Limitations * Garradin n'est disponible qu'en français. +* N'installez pas cette apllication à la racine du domaine par défaut sans ajouter un sous-domaine. Sinon la page de connexion SSO sera remplacée par la page d'accueil de Garradin. ## Liens @@ -53,8 +54,7 @@ Garradin est un logiciel libre de gestion associative. il permet de gérer des m --- -Informations pour les développeurs ----------------- +## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/garradin_ynh/tree/testing). @@ -62,5 +62,5 @@ Pour essayer la branche testing, procédez comme suit. ``` sudo yunohost app install https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug ou -sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug +sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug ``` diff --git a/conf/app.src b/conf/app.src index 9d8fd61..a24c59a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,4 +1,3 @@ - SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-0.9.8.tar.bz2 SOURCE_SUM=98aa01b86521ff66dcc951ab6f0eb1915e3cee5dada15ba20c96ab72512f1e83 SOURCE_SUM_PRG=sha256sum diff --git a/conf/nginx.conf b/conf/nginx.conf index 30bfff0..e07a530 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,13 +1,5 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { - - # Path to source - alias __FINALPATH__/www/ ; +location __PATH__ { -if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - # Protecting sensibles urls location ~ 403 { rewrite ^(.*)$ /include/ redirect; @@ -20,17 +12,22 @@ if ($scheme = http) { rewrite ^(.*)$ /config\.(.*)\.php redirect; } - # Example PHP configuration (remove if not used) - location __PATH__/ { - index index.php /_route.php; - try_files $uri $uri/ index.php /_route.php; +# Path to source +alias __FINALPATH__/www/; + +if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; } + # Example PHP configuration (remove if not used) + index index.php index.html; + try_files $uri $uri/ /_route.php; + location ~ [^/]\.php(/|$) { try_files $uri $uri/ /_route.php; fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; - # fastcgi_index index.php; + fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; diff --git a/scripts/_common.sh b/scripts/_common.sh index 0a022c4..98e0574 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,10 +3,12 @@ #================================================= # COMMON VARIABLES #================================================= - # dependencies used by the app - -pkg_dependencies="php-sqlite3" +if [ "$lsb_release --codename --short" = "buster"]; then + pkg_dependencies="php7.3-sqlite3" +else [ "$lsb_release --codename --short" = "stretch"] + pkg_dependencies="php7.0-sqlite3" +fi #================================================= # PERSONAL HELPERS @@ -19,3 +21,7 @@ pkg_dependencies="php-sqlite3" #================================================= # FUTURE OFFICIAL HELPERS #================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index c8fb622..21116d2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -20,6 +20,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/change_url b/scripts/change_url index 3e10993..8121108 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -50,12 +50,12 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=3 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf final_path=/var/www/$app -# 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 @@ -90,7 +90,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 9169c22..b5a23ea 100644 --- a/scripts/install +++ b/scripts/install @@ -46,21 +46,20 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= 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 #================================================= # Install dependency to convert tracks to a readable format for the browser #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=9 +ynh_script_progression --message="Installing dependencies..." --weight=10 ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user ynh_system_user_create --username=$app @@ -77,14 +76,14 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=5 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -101,7 +100,7 @@ ynh_app_setting_delete --app=$app --key=skipped_uris #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=8 # Make app public if necessary if [ $is_public -eq 1 ] @@ -122,6 +121,7 @@ cp -a $final_path/config.dist.php $final_path/config.local.php key=$(ynh_string_random --length=50) # edit config.local.php ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = '/var/www/garradin';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ]; then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" else @@ -131,7 +131,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 systemctl reload nginx diff --git a/scripts/remove b/scripts/remove index eef1b1e..b5f4d8c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME @@ -22,7 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --time --weight=10 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -30,7 +30,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=5 +ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -38,7 +38,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -46,7 +46,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=1 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config diff --git a/scripts/restore b/scripts/restore index 5271f2e..3726ba2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=4 ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -56,7 +56,7 @@ ynh_restore_file "$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -80,11 +80,17 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restore PHP-FPM configuration..." --weight=30 + +ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 22afa25..396e7bc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=3 app=$YNH_APP_INSTANCE_NAME @@ -62,7 +62,7 @@ fi #================================================= # Backup Data #================================================= -ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --weight=30 bdd=$final_path/association.sqlite squelettes=$final_path/www/squelettes @@ -78,7 +78,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 # Backup the current version of the app ynh_backup_before_upgrade @@ -103,7 +103,7 @@ fi #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=3 +ynh_script_progression --message="Upgrading dependencies..." --weight=5 ynh_install_app_dependencies $pkg_dependencies @@ -118,38 +118,23 @@ ynh_system_user_create --username=$app #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config -#================================================= -# Change options in file config.dist.php -# and copy in local.dist.php -#================================================= -ynh_script_progression --message="final configuration needed..." --weight=1 - -key=$(ynh_string_random --length=50) -cp -a $final_path/config.dist.php $final_path/config.local.php -ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" -if [ "$path_url" == "/" ] -then - ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" -else - ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" -fi #======================================================= # backup bdd, squelettes directory and config.local.php #======================================================= -ynh_script_progression --message="restore data..." --time --weight=1 +ynh_script_progression --message="restore data..." --weight=10 backup_bdd=/tmp/association.sqlite backup_squelettes=/tmp/squelettes @@ -164,6 +149,16 @@ then cp -a $backup_bdd $final_path/association.sqlite fi +key=$(ynh_string_random --length=50) +cp -a $final_path/config.dist.php $final_path/config.local.php +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="'/var/www/garradin';" --target_file="$final_path/config.local.php" +if [ "$path_url" == "/" ]; then +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" +else +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" +fi + #================================================= # Files owned by user app #================================================= @@ -175,7 +170,7 @@ chmod 755 $final_path -R #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading permissions configuration..." --weight=1 +ynh_script_progression --message="Upgrading permissions configuration..." --weight=2 # Create the visitors permission if needed if ! ynh_permission_exists --permission "visitors"; then @@ -185,7 +180,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload