From 62fe2f3716f4dacc72fc5cc4ab20f797683e825a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 31 Oct 2023 14:02:20 +0000 Subject: [PATCH 1/8] Auto-update README --- README.md | 5 +++-- README_fr.md | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cf4b7fc..f3d6439 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # CouchDB for YunoHost -[![Integration level](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Working status](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Working status](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) + [![Install CouchDB with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=couchdb) *[Lire ce readme en français.](./README_fr.md)* @@ -41,7 +42,7 @@ You can do most configuration of CouchDB from fauxton, the web interface, access * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index ce8e69b..49b6a83 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,15 +5,16 @@ It shall NOT be edited by hand. # CouchDB pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) + [![Installer CouchDB avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=couchdb) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer CouchDB 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.* +> *Ce package vous permet d’installer CouchDB 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.* -## Vue d'ensemble +## Vue d’ensemble Couchdb est un gestionnaire de bases de données dans lesquelles les entrées sont des documents jsons (avec possibilité de pièces jointes), qui peuvent être manipulées par de simples requêtes http. @@ -24,9 +25,9 @@ Comme le présente wikipédia: **Version incluse :** 3.2.2~ynh2 -## Captures d'écran +## Captures d’écran -![Capture d'écran de CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png) +![Capture d’écran de CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png) ## Avertissements / informations importantes @@ -36,10 +37,10 @@ Vous pouvez effectuer la plupart des configurations de CouchDB à partir de faux ## Documentations et ressources -* Site officiel de l'app : -* Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : -* Documentation YunoHost pour cette app : +* Site officiel de l’app : +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs @@ -54,4 +55,4 @@ ou sudo yunohost app upgrade couchdb -u https://github.com/YunoHost-Apps/couchdb_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From 8b23cbd939809f15c39780c6de46dcaf7c9da243 Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Sun, 10 Dec 2023 17:17:02 +0100 Subject: [PATCH 2/8] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 9efe801..28e31ca 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,7 @@ "url": "https://squeak.eauchat.org" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 11.1" }, "multi_instance": false, "services": [ From aaf46eafe1cfbb71b29340bfcc8de01b88fd793e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 10 Dec 2023 16:17:05 +0000 Subject: [PATCH 3/8] Auto-update README --- README.md | 5 +++-- README_fr.md | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cf4b7fc..f3d6439 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # CouchDB for YunoHost -[![Integration level](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Working status](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Working status](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) + [![Install CouchDB with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=couchdb) *[Lire ce readme en français.](./README_fr.md)* @@ -41,7 +42,7 @@ You can do most configuration of CouchDB from fauxton, the web interface, access * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index ce8e69b..49b6a83 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,15 +5,16 @@ It shall NOT be edited by hand. # CouchDB pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/couchdb.svg)](https://dash.yunohost.org/appci/app/couchdb) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/couchdb.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/couchdb.maintain.svg) + [![Installer CouchDB avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=couchdb) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer CouchDB 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.* +> *Ce package vous permet d’installer CouchDB 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.* -## Vue d'ensemble +## Vue d’ensemble Couchdb est un gestionnaire de bases de données dans lesquelles les entrées sont des documents jsons (avec possibilité de pièces jointes), qui peuvent être manipulées par de simples requêtes http. @@ -24,9 +25,9 @@ Comme le présente wikipédia: **Version incluse :** 3.2.2~ynh2 -## Captures d'écran +## Captures d’écran -![Capture d'écran de CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png) +![Capture d’écran de CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png) ## Avertissements / informations importantes @@ -36,10 +37,10 @@ Vous pouvez effectuer la plupart des configurations de CouchDB à partir de faux ## Documentations et ressources -* Site officiel de l'app : -* Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : -* Documentation YunoHost pour cette app : +* Site officiel de l’app : +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs @@ -54,4 +55,4 @@ ou sudo yunohost app upgrade couchdb -u https://github.com/YunoHost-Apps/couchdb_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From e72e5c29643219f8e461550475416eedf6156bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 12 Dec 2023 14:41:46 +0100 Subject: [PATCH 4/8] manifestv2 --- check_process | 23 ------- doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 doc/{DISCLAIMER.md => ADMIn.md} | 0 manifest.json | 54 --------------- manifest.toml | 69 +++++++++++++++++++ scripts/_common.sh | 3 - scripts/backup | 25 +------ scripts/change_url | 89 +----------------------- scripts/install | 99 +++------------------------ scripts/remove | 49 ------------- scripts/restore | 63 ++++------------- scripts/upgrade | 59 +++------------- tests.toml | 8 +++ 13 files changed, 109 insertions(+), 432 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) rename doc/{DISCLAIMER.md => ADMIn.md} (100%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 5be5a1a..0000000 --- a/check_process +++ /dev/null @@ -1,23 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 3.1.1~ynh3 - upgrade=1 from_commit=0e91958cfd8406e71e9c4e506620c5e9b7110a5f - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=1 -;;; Options -Email=squeak@eauchat.org -Notification=none diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/doc/DISCLAIMER.md b/doc/ADMIn.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIn.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 28e31ca..0000000 --- a/manifest.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "CouchDB", - "id": "couchdb", - "packaging_format": 1, - "description": { - "en": "Open-source document-oriented NoSQL database", - "fr": "Système de gestion de base de données orienté documents" - }, - "version": "3.2.2~ynh2", - "url": "https://couchdb.apache.org/", - "upstream": { - "license": "Apache-2.0", - "website": "https://couchdb.apache.org/", - "admindoc": "https://docs.couchdb.org/en/stable/", - "code": "https://github.com/apache/couchdb", - "cpe": "cpe:2.3:a:apache:couchdb" - }, - "license": "Apache-2.0", - "maintainer": { - "name": "Squeak", - "email": "squeak@eauchat.org", - "url": "https://squeak.eauchat.org" - }, - "requirements": { - "yunohost": ">= 11.1" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/couch", - "default": "/couch" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "password", - "type": "password" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..af8aee9 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,69 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "couchdb" +name = "CouchDB" +description.en = "Open-source document-oriented NoSQL database" +description.fr = "Système de gestion de base de données orienté documents" + +version = "3.2.2~ynh2" + +maintainers = ["Squeak"] + +[upstream] +license = "Apache-2.0" +website = "https://couchdb.apache.org/" +admindoc = "https://docs.couchdb.org/en/stable/" +code = "https://github.com/apache/couchdb" +cpe = "cpe:2.3:a:apache:couchdb" + +[integration] +yunohost = ">= 11.1" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = false +ldap = "not_relevant" +sso = "not_relevant" +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/couch" + + [install.init_main_permission] + type = "group" + default = "visitors" + + [install.password] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "password" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 5984 + + [resources.apt] + packages = ["gnupg", "ca-certificates"] + + # FIXME : find a way to do that here + # [resources.apt.extras.couchdb] + # repo = "deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" + # key = "https://couchdb.apache.org/repo/keys.asc" + # packages = ["couchdb"] diff --git a/scripts/_common.sh b/scripts/_common.sh index 196f5af..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app (must be on a single line) -pkg_dependencies="gnupg ca-certificates" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 143d201..907da7a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -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) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -40,13 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 04a206d..16e0f3c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,62 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -# Add settings here as needed by your application -port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=15 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -72,38 +16,7 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# 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 - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_change_url_nginx_config #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 8ebd4c9..ff925ec 100755 --- a/scripts/install +++ b/scripts/install @@ -9,69 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC -password=$YNH_APP_ARG_PASSWORD - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/opt/couchdb -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -datadir=/var/lib/$app - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -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 -ynh_app_setting_set --app=$app --key=password --value=$password -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -ynh_app_setting_set --app=$app --key=datadir --value=$datadir - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -port=$(ynh_find_port --port=5984) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=8 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # NGINX CONFIGURATION #================================================= @@ -99,7 +36,10 @@ couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD} couchdb couchdb/adminpass_again seen true" | debconf-set-selections DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb -ynh_install_extra_app_dependencies --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" --key="https://couchdb.apache.org/repo/keys.asc" +ynh_install_extra_app_dependencies \ + --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \ + --key="https://couchdb.apache.org/repo/keys.asc" \ + --package="couchdb" #================================================= # ADD A CONFIGURATION @@ -107,11 +47,11 @@ ynh_install_extra_app_dependencies --repo="deb https://apache.jfrog.io/artifacto ynh_script_progression --message="Adding a configuration file..." --weight=2 # Customize a bit the couch config -ynh_add_config --template="../conf/couch_ynh.ini" --destination="$final_path/etc/local.d/couch_ynh.ini" +ynh_add_config --template="../conf/couch_ynh.ini" --destination="$install_dir/etc/local.d/couch_ynh.ini" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" #================================================= # GENERIC FINALIZATION @@ -138,29 +78,6 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=3 # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/couchdb/couchdb.log" --failregex="[warning] .*couch_httpd_auth: Authentication failed for user .+ from " --max_retry=5 -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=3 - -# Setup that clicking SSO tile opens fauxton UI -ynh_permission_url --permission="main" --url="/_utils/index.html" --add_url="/" --auth_header=false - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=3 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index a8ba343..681116d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,18 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - #================================================= # STANDARD REMOVE #================================================= @@ -42,25 +30,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=1 - ynh_secure_remove --file="$datadir" -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -69,14 +38,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=16 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= @@ -85,16 +46,6 @@ ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=2 # Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=2 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 8556d62..ee14f67 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,38 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -password=$(ynh_app_setting_get --app=$app --key=password) -port=$(ynh_app_setting_get --app=$app --key=port) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -49,16 +17,16 @@ test ! -d $final_path \ #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=10 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $datadir +mkdir -p $data_dir #================================================= # RESTORE FAIL2BAN CONFIGURATION @@ -71,14 +39,6 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= # SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=6 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -103,15 +63,18 @@ couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD} couchdb couchdb/adminpass_again seen true" | debconf-set-selections DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb -ynh_install_extra_app_dependencies --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" --key="https://couchdb.apache.org/repo/keys.asc" +ynh_install_extra_app_dependencies \ + --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \ + --key="https://couchdb.apache.org/repo/keys.asc" \ + --package="couchdb" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index f61ae1d..4b644f2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,47 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -password=$(ynh_app_setting_get --app=$app --key=password) - -#================================================= -# CHECK VERSION -#================================================= -ynh_script_progression --message="Checking version..." --weight=1 - upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=15 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # NGINX CONFIGURATION #================================================= @@ -80,7 +41,10 @@ then couchdb couchdb/adminpass_again seen true" | debconf-set-selections DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb - ynh_install_extra_app_dependencies --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" --key="https://couchdb.apache.org/repo/keys.asc" + ynh_install_extra_app_dependencies \ + --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \ + --key="https://couchdb.apache.org/repo/keys.asc" \ + --package="couchdb" fi #================================================= @@ -88,11 +52,11 @@ fi #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/couch_ynh.ini" --destination="$final_path/etc/local.d/couch_ynh.ini" +ynh_add_config --template="../conf/couch_ynh.ini" --destination="$install_dir/etc/local.d/couch_ynh.ini" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" #================================================= # GENERIC FINALIZATION @@ -119,13 +83,6 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=3 # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/couchdb/couchdb.log" --failregex="[warning] .*couch_httpd_auth: Authentication failed for user .+ from " --max_retry=5 -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..c2deb4d --- /dev/null +++ b/tests.toml @@ -0,0 +1,8 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + [default.test_upgrade_from.0e91958cfd8406e71e9c4e506620c5e9b7110a5f] + name = "3.1.1~ynh3" From 5113e1a9456c1d1b60ba4ad957cb5b966b7facff Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 12 Dec 2023 13:47:42 +0000 Subject: [PATCH 5/8] Auto-update README --- README.md | 6 ------ README_fr.md | 6 ------ 2 files changed, 12 deletions(-) diff --git a/README.md b/README.md index f3d6439..db71bbc 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,6 @@ And as described in the couchdb official website: ![Screenshot of CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png) -## Disclaimers / important information - -## Configuration - -You can do most configuration of CouchDB from fauxton, the web interface, accessible at the domain you specified: `https://domain.tld/_utils/index.html` - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 49b6a83..9a7a3ea 100644 --- a/README_fr.md +++ b/README_fr.md @@ -29,12 +29,6 @@ Comme le présente wikipédia: ![Capture d’écran de CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png) -## Avertissements / informations importantes - -## Configuration - -Vous pouvez effectuer la plupart des configurations de CouchDB à partir de fauxton, l'interface Web, accessible sur le domaine que vous avez spécifié : `https://domain.tld/_utils/index.html` - ## Documentations et ressources * Site officiel de l’app : From 30b0e0dd62789fc211773a7a3a229b187878fd0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 12 Dec 2023 15:25:59 +0100 Subject: [PATCH 6/8] formatting --- scripts/install | 10 +++++----- scripts/restore | 10 +++++----- scripts/upgrade | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/install b/scripts/install index ff925ec..706e974 100755 --- a/scripts/install +++ b/scripts/install @@ -24,15 +24,15 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Installing CouchDB..." --weight=60 -COUCHDB_PASSWORD=$password -echo "couchdb couchdb/mode select standalone +echo "\ +couchdb couchdb/mode select standalone couchdb couchdb/mode seen true couchdb couchdb/bindaddress string 127.0.0.1 couchdb couchdb/bindaddress seen true -couchdb couchdb/cookie string ${COUCHDB_PASSWORD} -couchdb couchdb/adminpass password ${COUCHDB_PASSWORD} +couchdb couchdb/cookie string $password +couchdb couchdb/adminpass password $password couchdb couchdb/adminpass seen true -couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD} +couchdb couchdb/adminpass_again password $password couchdb couchdb/adminpass_again seen true" | debconf-set-selections DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb diff --git a/scripts/restore b/scripts/restore index ee14f67..82e7cca 100755 --- a/scripts/restore +++ b/scripts/restore @@ -51,15 +51,15 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Reinstalling couchdb..." --weight=40 -COUCHDB_PASSWORD=$password -echo "couchdb couchdb/mode select standalone +echo "\ +couchdb couchdb/mode select standalone couchdb couchdb/mode seen true couchdb couchdb/bindaddress string 127.0.0.1 couchdb couchdb/bindaddress seen true -couchdb couchdb/cookie string ${COUCHDB_PASSWORD} -couchdb couchdb/adminpass password ${COUCHDB_PASSWORD} +couchdb couchdb/cookie string $password +couchdb couchdb/adminpass password $password couchdb couchdb/adminpass seen true -couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD} +couchdb couchdb/adminpass_again password $password couchdb couchdb/adminpass_again seen true" | debconf-set-selections DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb diff --git a/scripts/upgrade b/scripts/upgrade index 4b644f2..4ef7419 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,15 +29,15 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading CouchDB..." --weight=50 - COUCHDB_PASSWORD=$password - echo "couchdb couchdb/mode select standalone + echo "\ + couchdb couchdb/mode select standalone couchdb couchdb/mode seen true couchdb couchdb/bindaddress string 127.0.0.1 couchdb couchdb/bindaddress seen true - couchdb couchdb/cookie string ${COUCHDB_PASSWORD} - couchdb couchdb/adminpass password ${COUCHDB_PASSWORD} + couchdb couchdb/cookie string $password + couchdb couchdb/adminpass password $password couchdb couchdb/adminpass seen true - couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD} + couchdb couchdb/adminpass_again password $password couchdb couchdb/adminpass_again seen true" | debconf-set-selections DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb From e391cca2e57c3a071f4c27c17495f51d48a759c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 12 Dec 2023 15:26:11 +0100 Subject: [PATCH 7/8] Fix install: use package's installdir --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index af8aee9..afd4511 100644 --- a/manifest.toml +++ b/manifest.toml @@ -50,6 +50,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.system_user] [resources.install_dir] + dir = "/opt/couchdb" [resources.data_dir] From 6254625545ae6e89c946be11aa0c9be2f47acbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 12 Dec 2023 16:00:34 +0100 Subject: [PATCH 8/8] Remove fixmes --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index afd4511..1bc766a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -24,9 +24,9 @@ architectures = "all" # FIXME: can be replaced by a list of supported archs usin multi_instance = false ldap = "not_relevant" sso = "not_relevant" -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +disk = "20M" +ram.build = "150M" +ram.runtime = "60M" [install] [install.domain]