1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/couchdb_ynh.git synced 2024-09-03 18:16:11 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2022-02-04 01:28:16 +01:00
parent f5636eb0dc
commit 7206a47665
9 changed files with 41 additions and 48 deletions

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -3,7 +3,7 @@
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
is_public=1 is_public=1
password="strong-password" password="1Strong-Password"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -12,6 +12,8 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 3.1.1~ynh2
upgrade=1 from_commit=41cae71da176f9028ae5daa4ffcc349d9b16c47e
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
change_url=1 change_url=1

View file

@ -1,10 +1,5 @@
location __PATH__/ { 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_pass http://127.0.0.1:__PORT__/;
proxy_redirect off; proxy_redirect off;
proxy_set_header Host $host; proxy_set_header Host $host;

1
doc/DESCRIPTION.md Normal file
View file

@ -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 CouchDBs incremental replication. CouchDB supports master-master setups with automatic conflict detection.

View file

@ -6,7 +6,7 @@
"en": "Open-source document-oriented NoSQL database", "en": "Open-source document-oriented NoSQL database",
"fr": "Système de gestion de base de données orienté documents" "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/", "url": "https://couchdb.apache.org/",
"upstream": { "upstream": {
"license": "Apache-2.0", "license": "Apache-2.0",
@ -32,8 +32,7 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "example.com"
}, },
{ {
"name": "path", "name": "path",
@ -44,16 +43,11 @@
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "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 nayant pas de compte YunoHost sur votre serveur, mais CouchDB a son propre système d'autentification des utilisateurs."
},
"default": true "default": true
}, },
{ {
"name": "password", "name": "password",
"type": "password", "type": "password"
"example": "Choose a password"
} }
] ]
} }

View file

@ -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" 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" ynh_add_config --template="../conf/couch_ynh.ini" --destination="$final_path/etc/local.d/couch_ynh.ini"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path" chown -R $app:$app "$final_path"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================

View file

@ -26,28 +26,13 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# REMOVE SERVICE INTEGRATION IN YUNOHOST # 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 if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --weight=2 ynh_script_progression --message="Removing $app service integration..." --weight=2
yunohost service remove $app yunohost service remove $app
fi 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 # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
@ -56,10 +41,26 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate 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 # 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 # Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config ynh_remove_fail2ban_config

View file

@ -38,8 +38,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2 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 \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
@ -48,6 +46,7 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # 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" 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_script_progression --message="Restoring the Fail2Ban configuration..." --weight=2
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban ynh_systemd_action --action=restart --service_name=fail2ban
#================================================= #=================================================
@ -101,13 +100,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:$app "$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 # 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" 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 # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -25,6 +25,7 @@ password=$(ynh_app_setting_get --app=$app --key=password)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)