mirror of
https://github.com/YunoHost-Apps/couchdb_ynh.git
synced 2024-09-03 18:16:11 +02:00
Revert "Testing"
This commit is contained in:
parent
59b941e377
commit
2b66f4319f
17 changed files with 478 additions and 131 deletions
|
@ -31,6 +31,12 @@ And as described in the couchdb official website:
|
||||||
|
|
||||||
![Screenshot of CouchDB](./doc/screenshots/Apache_CouchDB_v2.1.1_Fauxton_Console.png)
|
![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
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <https://couchdb.apache.org/>
|
* Official app website: <https://couchdb.apache.org/>
|
||||||
|
|
|
@ -29,6 +29,12 @@ Comme le présente wikipédia:
|
||||||
|
|
||||||
![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
|
||||||
|
|
||||||
|
## 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
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l’app : <https://couchdb.apache.org/>
|
* Site officiel de l’app : <https://couchdb.apache.org/>
|
||||||
|
|
23
check_process
Normal file
23
check_process
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
;; 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
|
|
@ -1,4 +1,3 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:__PORT__/;
|
proxy_pass http://127.0.0.1:__PORT__/;
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
## Configuration
|
|
||||||
|
|
||||||
You can do most configuration of CouchDB from fauxton, the web interface, accessible at the domain you specified: `https://__DOMAIN____PATH__/_utils/index.html`
|
|
3
doc/DISCLAIMER.md
Normal file
3
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## 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`
|
|
@ -1,3 +1,3 @@
|
||||||
## Configuration
|
## 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____PATH__/_utils/index.html`
|
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`
|
54
manifest.json
Normal file
54
manifest.json
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,70 +0,0 @@
|
||||||
#: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"
|
|
||||||
multi_instance = false
|
|
||||||
|
|
||||||
ldap = "not_relevant"
|
|
||||||
|
|
||||||
sso = "not_relevant"
|
|
||||||
|
|
||||||
disk = "20M"
|
|
||||||
ram.build = "150M"
|
|
||||||
ram.runtime = "60M"
|
|
||||||
|
|
||||||
[install]
|
|
||||||
[install.domain]
|
|
||||||
type = "domain"
|
|
||||||
|
|
||||||
[install.path]
|
|
||||||
type = "path"
|
|
||||||
default = "/couch"
|
|
||||||
|
|
||||||
[install.init_main_permission]
|
|
||||||
type = "group"
|
|
||||||
default = "visitors"
|
|
||||||
|
|
||||||
[install.password]
|
|
||||||
type = "password"
|
|
||||||
|
|
||||||
[resources]
|
|
||||||
[resources.system_user]
|
|
||||||
|
|
||||||
[resources.install_dir]
|
|
||||||
dir = "/opt/couchdb"
|
|
||||||
|
|
||||||
[resources.data_dir]
|
|
||||||
|
|
||||||
[resources.permissions]
|
|
||||||
main.url = "/"
|
|
||||||
|
|
||||||
[resources.ports]
|
|
||||||
main.default = 5984
|
|
||||||
|
|
||||||
[resources.apt]
|
|
||||||
packages = ["gnupg", "ca-certificates"]
|
|
||||||
|
|
||||||
# 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"]
|
|
|
@ -4,6 +4,9 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# dependencies used by the app (must be on a single line)
|
||||||
|
pkg_dependencies="gnupg ca-certificates"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,6 +10,27 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -19,13 +40,13 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$data_dir" --is_big
|
ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -9,6 +9,62 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -16,7 +72,38 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
109
scripts/install
109
scripts/install
|
@ -9,6 +9,69 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -24,22 +87,19 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing CouchDB..." --weight=60
|
ynh_script_progression --message="Installing CouchDB..." --weight=60
|
||||||
|
|
||||||
echo "\
|
COUCHDB_PASSWORD=$password
|
||||||
couchdb couchdb/mode select standalone
|
echo "couchdb couchdb/mode select standalone
|
||||||
couchdb couchdb/mode seen true
|
couchdb couchdb/mode seen true
|
||||||
couchdb couchdb/bindaddress string 127.0.0.1
|
couchdb couchdb/bindaddress string 127.0.0.1
|
||||||
couchdb couchdb/bindaddress seen true
|
couchdb couchdb/bindaddress seen true
|
||||||
couchdb couchdb/cookie string $password
|
couchdb couchdb/cookie string ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass password $password
|
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass seen true
|
couchdb couchdb/adminpass seen true
|
||||||
couchdb couchdb/adminpass_again password $password
|
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies \
|
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"
|
||||||
--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
|
# ADD A CONFIGURATION
|
||||||
|
@ -47,11 +107,11 @@ ynh_install_extra_app_dependencies \
|
||||||
ynh_script_progression --message="Adding a configuration file..." --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="$install_dir/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 "$install_dir"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R "$app:$app" "$install_dir"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -78,6 +138,29 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=3
|
||||||
# Create a dedicated Fail2Ban config
|
# 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 <HOST>" --max_retry=5
|
ynh_add_fail2ban_config --logpath="/var/log/couchdb/couchdb.log" --failregex="[warning] .*couch_httpd_auth: Authentication failed for user .+ from <HOST>" --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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,12 +9,23 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=5
|
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# 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
|
||||||
|
@ -23,15 +34,67 @@ then
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
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
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_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
|
||||||
|
|
||||||
# Remove the dedicated Fail2Ban config
|
# Remove the dedicated Fail2Ban config
|
||||||
ynh_remove_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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,6 +10,38 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -17,16 +49,16 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=10
|
ynh_script_progression --message="Restoring the app main directory..." --weight=10
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $data_dir
|
mkdir -p $datadir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE FAIL2BAN CONFIGURATION
|
# RESTORE FAIL2BAN CONFIGURATION
|
||||||
|
@ -39,6 +71,14 @@ ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# 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
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,30 +91,27 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling couchdb..." --weight=40
|
ynh_script_progression --message="Reinstalling couchdb..." --weight=40
|
||||||
|
|
||||||
echo "\
|
COUCHDB_PASSWORD=$password
|
||||||
couchdb couchdb/mode select standalone
|
echo "couchdb couchdb/mode select standalone
|
||||||
couchdb couchdb/mode seen true
|
couchdb couchdb/mode seen true
|
||||||
couchdb couchdb/bindaddress string 127.0.0.1
|
couchdb couchdb/bindaddress string 127.0.0.1
|
||||||
couchdb couchdb/bindaddress seen true
|
couchdb couchdb/bindaddress seen true
|
||||||
couchdb couchdb/cookie string $password
|
couchdb couchdb/cookie string ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass password $password
|
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass seen true
|
couchdb couchdb/adminpass seen true
|
||||||
couchdb couchdb/adminpass_again password $password
|
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies \
|
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"
|
||||||
--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 "$install_dir"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:$app "$install_dir"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
chmod 750 "$data_dir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:www-data "$data_dir"
|
chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
|
|
@ -9,8 +9,47 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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)
|
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
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -29,22 +68,19 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading CouchDB..." --weight=50
|
ynh_script_progression --message="Upgrading CouchDB..." --weight=50
|
||||||
|
|
||||||
echo "\
|
COUCHDB_PASSWORD=$password
|
||||||
couchdb couchdb/mode select standalone
|
echo "couchdb couchdb/mode select standalone
|
||||||
couchdb couchdb/mode seen true
|
couchdb couchdb/mode seen true
|
||||||
couchdb couchdb/bindaddress string 127.0.0.1
|
couchdb couchdb/bindaddress string 127.0.0.1
|
||||||
couchdb couchdb/bindaddress seen true
|
couchdb couchdb/bindaddress seen true
|
||||||
couchdb couchdb/cookie string $password
|
couchdb couchdb/cookie string ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass password $password
|
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass seen true
|
couchdb couchdb/adminpass seen true
|
||||||
couchdb couchdb/adminpass_again password $password
|
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
|
||||||
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
|
||||||
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies \
|
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"
|
||||||
--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
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -52,11 +88,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/couch_ynh.ini" --destination="$install_dir/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 "$install_dir"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R "$app:$app" "$install_dir"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -83,6 +119,13 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=3
|
||||||
# Create a dedicated Fail2Ban config
|
# 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 <HOST>" --max_retry=5
|
ynh_add_fail2ban_config --logpath="/var/log/couchdb/couchdb.log" --failregex="[warning] .*couch_httpd_auth: Authentication failed for user .+ from <HOST>" --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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#: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"
|
|
Loading…
Reference in a new issue