From bc7a32da024865b57cbd882267c4b05e614d8952 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 09:49:01 +0200 Subject: [PATCH 1/9] Defines custom port to listen --- conf/couch_ynh.ini | 3 +++ scripts/install | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conf/couch_ynh.ini b/conf/couch_ynh.ini index 3739492..26981b3 100644 --- a/conf/couch_ynh.ini +++ b/conf/couch_ynh.ini @@ -2,3 +2,6 @@ [chttpd] ; prevent non admin users to be able to access the list of all databases admin_only_all_dbs = true + +; Defines the port number to listen: +port = __PORT__ diff --git a/scripts/install b/scripts/install index 4eec0e1..668916e 100755 --- a/scripts/install +++ b/scripts/install @@ -60,9 +60,7 @@ ynh_app_setting_set --app=$app --key=password --value=$password ynh_script_progression --message="Finding an available port..." --weight=2 # Find an available port -port="5984" -# NOTE: ideally, it would be nice to make sure that port 5984 is not taken, but if doing so, something should be done on couchdb install to customize the port it uses -# port=$(ynh_find_port --port=5984) +port=$(ynh_find_port --port=5984) ynh_app_setting_set --app=$app --key=port --value=$port #================================================= From 0263f9255b9a6fed95bf3cf6132768b58c1136a1 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Thu, 13 May 2021 17:45:57 +0200 Subject: [PATCH 2/9] [autopatch] Update issue and PR templates --- issue_template.md => .github/ISSUE_TEMPLATE.md | 6 +++--- .github/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++++++++ pull_request_template.md | 16 ---------------- 3 files changed, 19 insertions(+), 19 deletions(-) rename issue_template.md => .github/ISSUE_TEMPLATE.md (91%) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 pull_request_template.md diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 91% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 6e85715..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -8,10 +8,10 @@ about: When creating a bug report, please use the following template to provide 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - - *Otherwise, the issue may be due to dato itself. Refer to [its documentation](https://docs.couchdb.org/en/stable/index.html) or [repository](https://github.com/apache/couchdb/issues/) for help.* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* ---- +--- ### Describe the bug @@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install couchdb + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* From dc2fa0df4bc11bdf47b934d0a1023caa48fa865f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 15 May 2021 14:40:07 +0200 Subject: [PATCH 3/9] Apply example_ynh --- manifest.json | 118 ++++++++++++++++++++------------------------- scripts/backup | 6 --- scripts/change_url | 2 +- scripts/install | 5 +- scripts/restore | 2 +- scripts/upgrade | 87 +++++++++++++++++++++------------ 6 files changed, 110 insertions(+), 110 deletions(-) diff --git a/manifest.json b/manifest.json index 7d3b4f0..cdf0a6d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,69 +1,53 @@ { - "name": "Couchdb", - "id": "couchdb", - "packaging_format": 1, - "description": { - "en": "An open-source document-oriented NoSQL database.", - "fr": "Système de gestion de base de données orienté documents." - }, - "version": "3.1.1~ynh1", - "url": "https://couchdb.apache.org/", - "license": "Apache-2.0", - "maintainer": { - "name": "Squeak", - "email": "squeak@eauchat.org", - "url": "https://squeak.eauchat.org" - }, - "requirements": { - "yunohost": ">= 4.1.3" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain", - "ask": { - "en": "Choose a domain name for couchdb", - "fr": "Choisissez un nom de domaine pour couchdb" - }, - "example": "example.com" - }, - { - "name": "path", - "type": "path", - "ask": { - "en": "Choose a path for couchdb", - "fr": "Choisissez un chemin pour couchdb" - }, - "example": "/couch", - "default": "/couch" - }, - { - "name": "is_public", - "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, - "help": { - "en": "If enabled, couchdb will be accessible without yunohost account on your server, but couchdb contains it's own user authentication system.", - "fr": "Si cette case est cochée, couchdb sera accessible aux personnes n’ayant pas de compte yunohost sur votre serveur, mais couchdb a son propre système d'autentification des utilisateurs." - }, - "default": true - }, - { - "name": "password", - "type": "password", - "ask": { - "en": "Set the administrator password (between 8 and 30 characters)", - "fr": "Définissez le mot de passe administrateur (entre 8 et 30 caractères)" - }, - "example": "Choose a password" - } - ] - } + "name": "Couchdb", + "id": "couchdb", + "packaging_format": 1, + "description": { + "en": "An open-source document-oriented NoSQL database.", + "fr": "Système de gestion de base de données orienté documents." + }, + "version": "3.1.1~ynh1", + "url": "https://couchdb.apache.org/", + "license": "Apache-2.0", + "maintainer": { + "name": "Squeak", + "email": "squeak@eauchat.org", + "url": "https://squeak.eauchat.org" + }, + "requirements": { + "yunohost": ">= 4.1.3" + }, + "multi_instance": false, + "services": [ + "nginx" + ], + "arguments": { + "install" : [ + { + "name": "domain", + "type": "domain", + "example": "example.com" + }, + { + "name": "path", + "type": "path", + "example": "/couch", + "default": "/couch" + }, + { + "name": "is_public", + "type": "boolean", + "help": { + "en": "If enabled, couchdb will be accessible without yunohost account on your server, but couchdb contains it's own user authentication system.", + "fr": "Si cette case est cochée, couchdb sera accessible aux personnes n’ayant pas de compte yunohost sur votre serveur, mais couchdb a son propre système d'autentification des utilisateurs." + }, + "default": true + }, + { + "name": "password", + "type": "password", + "example": "Choose a password" + } + ] + } } diff --git a/scripts/backup b/scripts/backup index e0092b7..622ac8d 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,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 @@ -36,11 +35,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= diff --git a/scripts/change_url b/scripts/change_url index f072734..6506704 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# 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 diff --git a/scripts/install b/scripts/install index 668916e..3ad95a7 100755 --- a/scripts/install +++ b/scripts/install @@ -14,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,13 +23,13 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -app=$YNH_APP_INSTANCE_NAME - 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 #================================================= diff --git a/scripts/restore b/scripts/restore index cb458e4..139a1db 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,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 @@ -110,6 +109,7 @@ yunohost service add $app --description="Open-source document-oriented NoSQL dat #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." ynh_restore_file --origin_path="/etc/logrotate.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index a01bb3a..d4eada2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,44 +20,15 @@ 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..." -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=4 - -### If nobody installed your app before 4.1, -### then you may safely remove these lines - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -fi - -# Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true" -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -74,6 +45,28 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=4 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin +fi + +# Create a permission if needed +if ! ynh_permission_exists --permission="api"; then + ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" +fi + #================================================= # NGINX CONFIGURATION #================================================= @@ -87,7 +80,37 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=15 -ynh_install_app_dependencies $pkg_dependencies couchdb +ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# SPECIFIC UPGRADE +#================================================= +# UPGRADING COUCHDB +#================================================= +ynh_script_progression --message="Upgrading couchdb..." --weight=60 + +COUCHDB_PASSWORD=$password +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/adminpass password ${COUCHDB_PASSWORD} +couchdb couchdb/adminpass seen true +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 + +apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61 + +ynh_install_extra_app_dependencies --repo="https://apache.bintray.com/couchdb-deb buster main" --package="couchdb" +# ynh_install_extra_app_dependencies --repo="https://apache.bintray.com/couchdb-deb buster main" --package="couchdb" --key="https://apache.bintray.com/couchdb-deb/dists/buster/Release.gpg" + +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="../conf/couch_ynh.ini" --destination="$final_path/etc/local.d/couch_ynh.ini" #================================================= # GENERIC FINALIZATION From e11bca70b938e36fb9983f40483d3a2172b66d28 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 May 2021 11:56:37 +0200 Subject: [PATCH 4/9] Fix --- scripts/upgrade | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d4eada2..fc8e6aa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,16 +57,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -fi - -# Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" -fi - #================================================= # NGINX CONFIGURATION #================================================= From ac229141fb1f056e4fa68a011c3e58fdfc4b2f28 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 May 2021 11:57:26 +0200 Subject: [PATCH 5/9] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index cdf0a6d..829123f 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "url": "https://squeak.eauchat.org" }, "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.2.4" }, "multi_instance": false, "services": [ From 98ba8de164757c414c4cec3a8a5d7b4dc540e53c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 May 2021 11:58:06 +0200 Subject: [PATCH 6/9] Update check_process --- check_process | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index 4875cde..eef6d32 100644 --- a/check_process +++ b/check_process @@ -3,9 +3,9 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + is_public=1 password="pass" ; Checks pkg_linter=1 From c3fec1682064dd49a449535e6833c0a82aeffe1b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 16 May 2021 13:52:40 +0200 Subject: [PATCH 7/9] Fix upgrade --- scripts/upgrade | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d4eada2..c4d3680 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,15 +57,7 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -fi - -# Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" -fi +ynh_permission_url --permission="main" --url="/_utils/index.html" --add_url="/" --auth_header=false #================================================= # NGINX CONFIGURATION From d14e4b4ca0d76c3ebb5179e302e43708d455d39d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 16 May 2021 13:55:25 +0200 Subject: [PATCH 8/9] Update change_url --- scripts/change_url | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 6506704..113b205 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -65,8 +65,6 @@ fi #================================================= # STANDARD MODIFICATIONS -#================================================= - #================================================= # MODIFY URL IN NGINX CONF #================================================= From 60b8ab1ae2b1950d1334abed689f08edfa9bce52 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 19 May 2021 01:53:08 +0200 Subject: [PATCH 9/9] Fix rights --- scripts/install | 4 ++++ scripts/restore | 4 ++++ scripts/upgrade | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/scripts/install b/scripts/install index 3ad95a7..0058f20 100755 --- a/scripts/install +++ b/scripts/install @@ -108,6 +108,10 @@ ynh_script_progression --message="Customizing couchdb config..." --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" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" + #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/restore b/scripts/restore index 139a1db..850782a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -99,6 +99,10 @@ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8756C4F765C9AC3CB6B85D6 ynh_install_extra_app_dependencies --repo="https://apache.bintray.com/couchdb-deb buster main" --package="couchdb" # ynh_install_extra_app_dependencies --repo="https://apache.bintray.com/couchdb-deb buster main" --package="couchdb" --key="https://apache.bintray.com/couchdb-deb/dists/buster/Release.gpg" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c4d3680..a3487bf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -104,6 +104,10 @@ ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template="../conf/couch_ynh.ini" --destination="$final_path/etc/local.d/couch_ynh.ini" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" + #================================================= # GENERIC FINALIZATION #=================================================