From bb8ee187f5c469403ca3e9a8d48c3874277278eb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 7 Dec 2020 16:57:49 +0100 Subject: [PATCH] fix --- README.md | 42 ++++++++++++++++++++++++---------------- check_process | 3 --- check_process.default | 40 -------------------------------------- conf/php-fpm.conf | 2 +- manifest.json | 7 +------ pull_request_template.md | 2 +- scripts/_common.sh | 2 +- scripts/backup | 24 +++++++++-------------- scripts/install | 12 +++++------- scripts/remove | 31 ++++++++--------------------- scripts/restore | 5 ++--- scripts/upgrade | 11 ++++------- 12 files changed, 57 insertions(+), 124 deletions(-) delete mode 100644 check_process.default diff --git a/README.md b/README.md index 2d329bd..01bbed8 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,18 @@ # ZAP for YunoHost -[![Integration level](https://dash.yunohost.org/integration/zap.svg)](https://dash.yunohost.org/appci/app/zap) ![](https://ci-apps.yunohost.org/ci/badges/zap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zap.maintain.svg) - +[![Integration level](https://dash.yunohost.org/integration/zap.svg)](https://dash.yunohost.org/appci/app/zap) ![](https://ci-apps.yunohost.org/ci/badges/zap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zap.maintain.svg) [![Install Zap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=zap) > *This package allow you to install ZAP quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* -Version: 2020-12-07 - - -### Interesting links - -- [YunoHost project](https://yunohost.org) -- [Zap website](https://zotlabs.com/zap/) -- [Zap code on codeberg](https://codeberg.org/zot/zap) -- [Zap addons on codeberg](https://codeberg.org/zot/zap-addons) - -## ZAP +## Overview [Zap](https://zotlabs.com/zap/) is an an ethical alternative to Fediverse that provides powerful features for creating interconnected websites featuring a decentralized identity, communications, and permissions framework built using common webserver technology. Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more. +**Shipped version:** 2020-12-07 + ## Unique Features of ZAP - **Groups** : public, private, and moderated. @@ -32,8 +23,6 @@ Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzil - **Lists**: Sometimes referred to as circles or aspects, this lets you define your own groups of related friends and- communicate with them as a private group. - **Extend** : Change or upgrade your software functionality as desired by installing additional features from addons and- the free app collection. - - ## This app claims following features: - [X] Ldap integration - [X] Multi-instance @@ -41,7 +30,6 @@ Compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzil - [X] Fail2ban - [X] Option to choose between **Mysql** and **PostgreSQL**. - ## Installation Before installing, read the [Zap installation instructions](https://codeberg.org/zot/zap/src/branch/release/install/INSTALL.txt) for important information about: @@ -64,5 +52,25 @@ Before installing, read the [Zap installation instructions](https://codeberg.org #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/Zap%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/zap/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/Zap%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/zap/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/Zap%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/zap/) + +## Links + + * YunoHost project: https://yunohost.org + * Zap website: https://zotlabs.com/zap/ + * Zap code on codeberg: https://codeberg.org/zot/zap + * Zap addons on codeberg: https://codeberg.org/zot/zap-addons + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/zap_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug +or +sudo yunohost app upgrade zap -u https://github.com/YunoHost-Apps/zap_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index 6dcb008..2053b22 100644 --- a/check_process +++ b/check_process @@ -20,11 +20,8 @@ #upgrade=1 from_commit=a2a416d743aaab3c01f36baec81b36b21720235f backup_restore=1 multi_instance=1 - incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - Level 5=auto ;;; Options Email=anmol@datamol.org Notification=change diff --git a/check_process.default b/check_process.default deleted file mode 100644 index 97a2bc5..0000000 --- a/check_process.default +++ /dev/null @@ -1,40 +0,0 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - -;; Test complet - ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) - language="fr" - is_public=1 (PUBLIC|public=1|private=0) - password="pass" - port="666" (PORT) - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=CommitHash - backup_restore=1 - multi_instance=1 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 - port_already_use=0 - change_url=1 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab5dca9..ab1a471 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 11802c7..daac81b 100644 --- a/manifest.json +++ b/manifest.json @@ -5,16 +5,14 @@ "description": { "en": "A fediverse server." }, - "version": "2020-12-07~ynh1", - "url": "https://zotlabs.com/zap/", "license": "MIT", "maintainer": { "name": "Anmol Sharma" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "multi_instance": true, "services": [ @@ -51,9 +49,6 @@ "choices": ["1", "2"], "default": "1" } - - - ] } } diff --git a/pull_request_template.md b/pull_request_template.md index 1128385..c6bb784 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -16,4 +16,4 @@ --- *If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/REPLACEBYYOURAPP_ynh%20PR-NUM-%20(USERNAME)/) +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/zap_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/zap_ynh%20PR-NUM-%20(USERNAME)/) diff --git a/scripts/_common.sh b/scripts/_common.sh index ac5de66..62e4233 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app YNH_PHP_VERSION="7.3" -extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd" +extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd" # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib" diff --git a/scripts/backup b/scripts/backup index 40bc780..480e42b 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -#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 @@ -15,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -24,7 +22,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -34,49 +32,46 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) database=$(ynh_app_setting_get --app=$app --key=database) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP OF THE DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." if [ $database -eq 1 ]; then - ynh_script_progression --message="Backup of the MySQL database..." + ynh_print_info --message="Backup of the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql elif [ $database -eq 2 ]; then - # Removing postgresql database - ynh_script_progression --message="Backup of the postgresql database..." + # Removing postgresSQL database + ynh_print_info --message="Backup of the postgreSQL database..." ynh_psql_dump_db --database="$db_name" > db.sql fi - #================================================= # SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= -ynh_script_progression --message="Backing up logrotate configuration..." ynh_backup --src_path="/etc/logrotate.d/$app" @@ -89,7 +84,6 @@ ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Backing up fail2ban configuration..." ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" @@ -98,4 +92,4 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index fb8aa2f..c1e738e 100755 --- a/scripts/install +++ b/scripts/install @@ -132,11 +132,8 @@ elif [ $database -eq 2 ]; then ynh_psql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_postgres.sql else ynh_die --message="Some problem occured in creating the database, contact maintainer" - fi - - #================================================= # MODIFY A CONFIG FILE #================================================= @@ -163,7 +160,7 @@ cat ../conf/ldap_conf.php >> $final_path/.htconfig.php #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -179,7 +176,7 @@ 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 ynh_add_fpm_config --package="$extra_php_dependencies" @@ -214,19 +211,20 @@ ynh_use_logrotate "$final_path/php.log" # SETUP FAIL2BAN #================================================= ynh_script_progression --message="Add Fail2Ban..." + ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP .*$" --max_retry="5" #================================================= # SETUP SSOWAT #================================================= -# As Zap is social network and have its own permission there is no need to keep Zap behind SSO ynh_script_progression --message="Configuring SSOwat..." +# As Zap is social network and have its own permission there is no need to keep Zap behind SSO ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" #================================================= # 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 ca6bb10..8655412 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,37 +22,23 @@ db_user="$db_name" final_path=$(ynh_app_setting_get --app=$app --key=final_path) database=$(ynh_app_setting_get --app=$app --key=database) -#================================================= -# STANDARD REMOVE -#================================================= - -#================================================= -# STANDARD REMOVE -#================================================= - #================================================= # REMOVE THE DATABASE #================================================= + if [ $database -eq 1 ]; then ynh_script_progression --message="Removing MySQL database..." ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name elif [ $database -eq 2 ]; then # Removing postgresql database - ynh_script_progression --message="Removing postgresql database..." + ynh_script_progression --message="Removing postgreSQL database..." ynh_psql_remove_db --db_user=$db_user --db_name=$db_name fi #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info "Removing dependencies" - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." +ynh_script_progression --message="Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -68,15 +54,15 @@ 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 ynh_remove_fpm_config @@ -96,11 +82,10 @@ ynh_remove_logrotate # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" - #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." +ynh_script_progression --message="Removing Fail2Ban configuration..." ynh_remove_fail2ban_config @@ -118,4 +103,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" \ No newline at end of file +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 33d5372..5f8af87 100755 --- a/scripts/restore +++ b/scripts/restore @@ -105,7 +105,6 @@ ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SPECIFIC RESTORATION #================================================= -#================================================= # RESTORE THE CRON FILE #================================================= @@ -120,7 +119,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the 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" @@ -134,7 +133,7 @@ ynh_app_setting_set $app skipped_uris "/" #================================================= # 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 48046aa..897bac0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,7 +35,6 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -56,7 +55,8 @@ ynh_abort_if_errors #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." + # Create a temporary directory tmpdir="$(ynh_smart_mktemp 6000)" # Backup the config file in the temp dir @@ -80,13 +80,11 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= - ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -106,11 +104,10 @@ chmod -R 777 $final_path/store mkdir $final_path/addon ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" - #================================================= # 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 ynh_add_nginx_config @@ -129,7 +126,7 @@ chown -R $app: $final_path #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config --package="$extra_php_dependencies"