From f5636eb0dc524f4531f8e4a57ff46510683d1bff Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 4 Feb 2022 01:17:48 +0100 Subject: [PATCH 1/2] Fix release --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 35d3fae..37fdfb9 100755 --- a/scripts/install +++ b/scripts/install @@ -97,7 +97,7 @@ DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 390EF70BB1EA12B2773962950EE62FB37A00258D 2>/dev/null -ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ buster main" --package="couchdb" +ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" #================================================= # ADD SOME CUSTOM CONFIGURATION TO COUCH diff --git a/scripts/restore b/scripts/restore index 55b864a..c698075 100755 --- a/scripts/restore +++ b/scripts/restore @@ -95,7 +95,7 @@ DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 390EF70BB1EA12B2773962950EE62FB37A00258D 2>/dev/null -ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ buster main" --package="couchdb" +ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 896dfc3..7386948 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,7 +80,7 @@ then apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 390EF70BB1EA12B2773962950EE62FB37A00258D 2>/dev/null - ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ buster main" --package="couchdb" + ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" fi #================================================= From 7206a4766598dfb208ef2c0132b80b6a32eb798b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 4 Feb 2022 01:28:16 +0100 Subject: [PATCH 2/2] Apply last example_ynh --- .gitignore | 2 -- check_process | 4 +++- conf/nginx.conf | 5 ----- doc/DESCRIPTION.md | 1 + manifest.json | 12 +++--------- scripts/install | 8 +++++--- scripts/remove | 35 ++++++++++++++++++----------------- scripts/restore | 21 ++++++++++----------- scripts/upgrade | 1 + 9 files changed, 41 insertions(+), 48 deletions(-) delete mode 100644 .gitignore create mode 100644 doc/DESCRIPTION.md diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/check_process b/check_process index 2129b4a..96ba5aa 100644 --- a/check_process +++ b/check_process @@ -3,7 +3,7 @@ domain="domain.tld" path="/path" is_public=1 - password="strong-password" + password="1Strong-Password" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -12,6 +12,8 @@ setup_private=1 setup_public=1 upgrade=1 + # 3.1.1~ynh2 + upgrade=1 from_commit=41cae71da176f9028ae5daa4ffcc349d9b16c47e backup_restore=1 multi_instance=0 change_url=1 diff --git a/conf/nginx.conf b/conf/nginx.conf index f5ad6cb..e89a443 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,5 @@ location __PATH__/ { - # Force usage of https - # if ($scheme = http) { - # rewrite ^ https://$server_name$request_uri? permanent; - # } - proxy_pass http://127.0.0.1:__PORT__/; proxy_redirect off; proxy_set_header Host $host; diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..e29a3aa --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents with your web browser, via HTTP. Query, combine, and transform your documents with JavaScript. CouchDB works well with modern web and mobile apps. You can distribute your data, efficiently using CouchDB’s incremental replication. CouchDB supports master-master setups with automatic conflict detection. \ No newline at end of file diff --git a/manifest.json b/manifest.json index 335526f..38a536f 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source document-oriented NoSQL database", "fr": "Système de gestion de base de donnĂ©es orientĂ© documents" }, - "version": "3.1.1~ynh2", + "version": "3.1.1~ynh3", "url": "https://couchdb.apache.org/", "upstream": { "license": "Apache-2.0", @@ -32,8 +32,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "path", @@ -44,16 +43,11 @@ { "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" + "type": "password" } ] } diff --git a/scripts/install b/scripts/install index 37fdfb9..a31dfa5 100755 --- a/scripts/install +++ b/scripts/install @@ -100,17 +100,19 @@ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 390EF70BB1EA12B27739629 ynh_install_extra_app_dependencies --repo="https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" --package="couchdb" #================================================= -# ADD SOME CUSTOM CONFIGURATION TO COUCH +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Customizing CouchDB config..." --weight=2 +ynh_script_progression --message="Adding a configuration file..." --weight=2 -# customize a bit the couch config +# 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" +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/remove b/scripts/remove index 1a7e215..f4d1f82 100755 --- a/scripts/remove +++ b/scripts/remove @@ -26,28 +26,13 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=2 yunohost service remove $app fi -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=16 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2 - -# Remove the dedicated NGINX config -ynh_remove_nginx_config - #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= @@ -56,10 +41,26 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2 + +# 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 #================================================= -ynh_script_progression --message="Removing Fail2ban configuration..." --weight=2 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=2 # Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index c698075..5dcd193 100755 --- a/scripts/restore +++ b/scripts/restore @@ -38,8 +38,6 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -48,6 +46,7 @@ test ! -d $final_path \ #================================================= # 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" @@ -63,8 +62,8 @@ ynh_restore_file --origin_path="$final_path" #================================================= ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=2 -ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file "/etc/fail2ban/filter.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 #================================================= @@ -101,13 +100,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Open-source document-oriented NoSQL database" --log="/var/log/$app/$app.log" --needs_exposed_ports "$port" - #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -115,6 +107,13 @@ ynh_script_progression --message="Restoring the logrotate configuration..." ynh_restore_file --origin_path="/etc/logrotate.d/$app" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Open-source document-oriented NoSQL database" --log="/var/log/$app/$app.log" --needs_exposed_ports "$port" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7386948..75f298c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed)