diff --git a/README.md b/README.md index ccec91e..46da2a6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Shaarli for YunoHost -[![Integration level](https://dash.yunohost.org/integration/shaarli.svg)](https://dash.yunohost.org/appci/app/shaarli) ![](https://ci-apps.yunohost.org/ci/badges/shaarli.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/shaarli.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/shaarli.svg)](https://dash.yunohost.org/appci/app/shaarli) ![Working status](https://ci-apps.yunohost.org/ci/badges/shaarli.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/shaarli.maintain.svg) [![Install Shaarli with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=shaarli) *[Lire ce readme en français.](./README_fr.md)* @@ -30,13 +30,13 @@ Shaarli is a minimalist bookmark manager and link sharing service that you can i - feed other blogs, aggregators, social networks... -**Shipped version:** 0.12.1~ynh3 +**Shipped version:** 0.12.1~ynh4 **Demo:** https://demo.shaarli.org/ ## Screenshots -![](./doc/screenshots/27wYsbC.png) +![Screenshot of Shaarli](./doc/screenshots/27wYsbC.png) ## Disclaimers / important information @@ -47,20 +47,21 @@ During the installation app will prompt you to install itself as public or priva After the installation is complete, go to the domain where the Shaarli is installed and create your account. After the creation of the account the registration will be locked. ## Documentation and resources -* Official admin documentation: https://shaarli.readthedocs.io/en/master/ -* Upstream app code repository: https://github.com/shaarli/Shaarli -* YunoHost documentation for this app: https://yunohost.org/app_shaarli -* Report a bug: https://github.com/YunoHost-Apps/shaarli_ynh/issues +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing --debug or sudo yunohost app upgrade shaarli -u https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index b2a4c84..795a922 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Shaarli pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/shaarli.svg)](https://dash.yunohost.org/appci/app/shaarli) ![](https://ci-apps.yunohost.org/ci/badges/shaarli.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/shaarli.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/shaarli.svg)](https://dash.yunohost.org/appci/app/shaarli) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/shaarli.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/shaarli.maintain.svg) [![Installer Shaarli avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=shaarli) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Shaarli rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -26,13 +30,13 @@ Shaarli is a minimalist bookmark manager and link sharing service that you can i - feed other blogs, aggregators, social networks... -**Version incluse :** 0.12.1~ynh3 +**Version incluse :** 0.12.1~ynh4 **Démo :** https://demo.shaarli.org/ ## Captures d'écran -![](./doc/screenshots/27wYsbC.png) +![Capture d'écran de Shaarli](./doc/screenshots/27wYsbC.png) ## Avertissements / informations importantes @@ -43,20 +47,21 @@ During the installation app will prompt you to install itself as public or priva After the installation is complete, go to the domain where the Shaarli is installed and create your account. After the creation of the account the registration will be locked. ## Documentations et ressources -* Documentation officielle de l'admin : https://shaarli.readthedocs.io/en/master/ -* Dépôt de code officiel de l'app : https://github.com/shaarli/Shaarli -* Documentation YunoHost pour cette app : https://yunohost.org/app_shaarli -* Signaler un bug : https://github.com/YunoHost-Apps/shaarli_ynh/issues +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing --debug ou sudo yunohost app upgrade shaarli -u https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index aa9ec79..4f8ddd2 100644 --- a/check_process +++ b/check_process @@ -1,10 +1,10 @@ -;; Test complet sans multisite +;; Test complet ; Manifest domain="domain.tld" path="/path" is_public=1 admin="john" - password="pass" + password="1Strong-Password" title="Shaarli" ; Checks pkg_linter=1 @@ -14,8 +14,11 @@ setup_private=1 setup_public=1 upgrade=1 + # 0.12.1~ynh3 + upgrade=1 from_commit=f61a2392a4df80d92a5f2042d1b503958f1f4fdf backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= diff --git a/conf/nginx.conf b/conf/nginx.conf index 98e374a..648132f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,24 +2,25 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; if (!-f $request_filename) { - rewrite ^ __PATH__/index.php last; - } + rewrite ^ __PATH__/index.php last; + } client_max_body_size 50M; try_files $uri $uri/ index.php$is_args$args; location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } diff --git a/manifest.json b/manifest.json index 55050d0..a002ecd 100644 --- a/manifest.json +++ b/manifest.json @@ -1,72 +1,70 @@ { - "name": "Shaarli", - "id": "shaarli", - "packaging_format": 1, - "description": { - "en": "The personal, minimalist, super-fast, no-database delicious clone", - "fr": "Clone de delicious, rapide, simple et sans base de données" - }, - "version": "0.12.1~ynh3", - "url": "https://github.com/shaarli/Shaarli", - "upstream": { + "name": "Shaarli", + "id": "shaarli", + "packaging_format": 1, + "description": { + "en": "The personal, minimalist, super-fast, no-database delicious clone", + "fr": "Clone de delicious, rapide, simple et sans base de données" + }, + "version": "0.12.1~ynh4", + "url": "https://github.com/shaarli/Shaarli", + "upstream": { "license": "MIT", "demo": "https://demo.shaarli.org/", "admindoc": "https://shaarli.readthedocs.io/en/master/", "code": "https://github.com/shaarli/Shaarli" }, - "license": "MIT", - "maintainer": { - "name": "lapineige et rafi59", - "email": "rafi59_dev@srvmaison.fr.nf", - "url": "" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": true, - "services": [ + "license": "MIT", + "maintainer": { + "name": "lapineige" + }, + "requirements": { + "yunohost": ">= 4.3.0" + }, + "multi_instance": true, + "services": [ "nginx", "php7.3-fpm" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/shaarli", - "default": "/shaarli" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" - }, - { - "name": "title", - "type": "string", - "ask": { - "en": "Choose a title for your Shaarli instance", - "fr": "Choisissez un titre pour votre instance Shaarli" - }, - "example": "Shaarli", - "default": "Shaarli" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If set as public, Shaarli will be visible to anyone, including non-Yunohost users. However only Shaarli users can add bookmarks. Your links will be public by default, but you can change that in Shaarli's configuration page.", - "fr": "Si configuré en public, Shaarli sera visible par tout le monde, y compris des personnes sans compte sur votre Yunohost. Cependant seules les personnes avec un compte Shaarli pourrons ajouter des marques-pages. Vos nouveaux liens seront publics par défaut, mais vous pourrez changer ça dans la page de configuration de Shaarli." - }, - "default": false - } - ] - } + ], + "arguments": { + "install": [ + { + "name": "domain", + "type": "domain" + }, + { + "name": "path", + "type": "path", + "example": "/shaarli", + "default": "/shaarli" + }, + { + "name": "is_public", + "type": "boolean", + "help": { + "en": "If set as public, Shaarli will be visible to anyone, including non-Yunohost users. However only Shaarli users can add bookmarks. Your links will be public by default, but you can change that in Shaarli's configuration page.", + "fr": "Si configuré en public, Shaarli sera visible par tout le monde, y compris des personnes sans compte sur votre Yunohost. Cependant seules les personnes avec un compte Shaarli pourrons ajouter des marques-pages. Vos nouveaux liens seront publics par défaut, mais vous pourrez changer ça dans la page de configuration de Shaarli." + }, + "default": false + }, + { + "name": "admin", + "type": "user" + }, + { + "name": "password", + "type": "password" + }, + { + "name": "title", + "type": "string", + "ask": { + "en": "Choose a title for your Shaarli instance", + "fr": "Choisissez un titre pour votre instance Shaarli" + }, + "example": "Shaarli", + "default": "Shaarli" + } + ] + } } diff --git a/scripts/backup b/scripts/backup index feb1e4a..fc8e0a2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# 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 @@ -25,7 +25,7 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= @@ -51,6 +51,13 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# BACKUP FAIL2BAN CONFIGURATION +#================================================= + +ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" +ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" + #================================================= # SPECIFIC BACKUP #================================================= @@ -59,13 +66,6 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 845519b..f0dc3e6 100644 --- a/scripts/install +++ b/scripts/install @@ -22,11 +22,10 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH +is_public=$YNH_APP_ARG_IS_PUBLIC admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD title=$YNH_APP_ARG_TITLE -is_public=$YNH_APP_ARG_IS_PUBLIC -phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -48,8 +47,9 @@ ynh_script_progression --message="Storing installation settings..." 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=phpversion --value=$phpversion +#================================================= +# STANDARD MODIFICATIONS #================================================= # INSTALL DEPENDENCIES #================================================= @@ -63,7 +63,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -79,6 +79,15 @@ chmod -R o-rwx "$final_path" chmod -R u+rwX $final_path/{cache/,data/,pagecache/,tmp/} chown -R $app:www-data "$final_path" +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring PHP-FPM..." + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --usage=low --footprint=low +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # NGINX CONFIGURATION #================================================= @@ -88,36 +97,20 @@ ynh_script_progression --message="Configuring NGINX web server..." ynh_add_nginx_config #================================================= -# PHP-FPM CONFIGURATION +# SPECIFIC SETUP #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low - +# ADD A CONFIGURATION #================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." - -# Use logrotate to manage application logfile(s) -touch "$final_path/data/log.txt" -ynh_use_logrotate "$final_path/data/log.txt" -chown $app:www-data "$final_path/data/log.txt" - -#================================================= -# MODIFY A CONFIG FILE -#================================================= -ynh_script_progression --message="Configuring Shaarli..." +ynh_script_progression --message="Adding a configuration file..." # Get the timezone timezone=$(cat /etc/timezone) # Generate the salt -salt=$(php${YNH_PHP_VERSION} -r 'echo sha1(uniqid("", true) ."_". mt_rand());') +salt=$(php$phpversion -r 'echo sha1(uniqid("", true) ."_". mt_rand());') # Generate the hash with the password -hash=$(php${YNH_PHP_VERSION} -r "echo sha1('${password}'.'${admin}'.'${salt}');") +hash=$(php$phpversion -r "echo sha1('${password}'.'${admin}'.'${salt}');") # Generate the API secret secret=$(php${YNH_PHP_VERSION} -r "echo str_shuffle(substr(hash_hmac('sha512', uniqid('${salt}'), '${admin}'), 10, 12));") @@ -134,6 +127,18 @@ fi ynh_add_config --template="../conf/config.json.php" --destination="$final_path/data/config.json.php" chmod 700 "$final_path/data/config.json.php" +#================================================= +# GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." + +# Use logrotate to manage application logfile(s) +touch "$final_path/data/log.txt" +ynh_use_logrotate "$final_path/data/log.txt" +chown $app:www-data "$final_path/data/log.txt" + #================================================= # SETUP FAIL2BAN #================================================= @@ -150,7 +155,9 @@ ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 7c0e74d..b427d8e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,16 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#================================================= +# STANDARD REMOVE +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE APP MAIN DIR #================================================= @@ -43,20 +53,12 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= ynh_script_progression --message="Removing Fail2Ban configuration..." -# Remove the dedicated fail2ban config +# Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config #================================================= diff --git a/scripts/restore b/scripts/restore index 4e9f1d4..a65fe05 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# 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 @@ -39,20 +39,13 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR @@ -68,12 +61,16 @@ chown -R $app:www-data "$final_path" chmod 700 "$final_path/data/config.json.php" #================================================= -# RESTORE THE PHP-FPM CONFIGURATION +# RESTORE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." +ynh_script_progression --message="Restoring the Fail2Ban configuration..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" +ynh_systemd_action --action=restart --service_name=fail2ban +#================================================= +# SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -83,7 +80,19 @@ ynh_script_progression --message="Reinstalling dependencies..." ynh_install_app_dependencies $pkg_dependencies #================================================= -# SPECIFIC RESTORATION +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -91,15 +100,6 @@ ynh_script_progression --message="Restoring the logrotate configuration..." ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# RESTORE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the Fail2Ban configuration..." - -ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" -ynh_systemd_action --action=restart --service_name=fail2ban - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index cdb65b4..04de953 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -34,7 +35,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -64,7 +65,7 @@ fi ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -100,14 +101,6 @@ chmod -R u+rwX $final_path/{cache/,data/,pagecache/,tmp/} chown -R $app:www-data "$final_path" chmod 700 "$final_path/data/config.json.php" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -120,9 +113,19 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= 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 +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." + +# Create a dedicated NGINX config +ynh_add_nginx_config + +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #=================================================