mirror of
https://github.com/YunoHost-Apps/noalyss_ynh.git
synced 2024-09-03 19:46:20 +02:00
commit
720b480245
14 changed files with 269 additions and 92 deletions
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
||||||
|
|
||||||
# Noalyss for YunoHost
|
# Noalyss for YunoHost
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/noalyss.svg)](https://dash.yunohost.org/appci/app/noalyss) ![Working status](https://ci-apps.yunohost.org/ci/badges/noalyss.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/noalyss.maintain.svg)
|
[![Integration level](https://dash.yunohost.org/integration/noalyss.svg)](https://dash.yunohost.org/appci/app/noalyss) ![Working status](https://ci-apps.yunohost.org/ci/badges/noalyss.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/noalyss.maintain.svg)
|
||||||
[![Install Noalyss with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=noalyss)
|
[![Install Noalyss with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=noalyss)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
@ -15,10 +15,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Noalyss est un serveur de comptabilité destiné à être hébergé sur Internet afin de contenir la comptabilité d’un nombre illimité de sociétés et d’utilisateurs ne se connaissant pas. Chaque société a ses propres dossiers comptables , ses propres utilisateurs, et ne peut pas interférer avec la comptabilité des autres, à moins d’y être expressément autorisé.
|
Noalyss is an accounting server intended to be hosted on the Internet in order to contain the accounting of an unlimited number of companies and users who do not know each other. Each company has its own accounting files, its own users, and cannot interfere with the accounting of others, unless expressly authorized to do so.
|
||||||
|
|
||||||
**Shipped version:** 9.0.2.5~ynh3
|
|
||||||
|
|
||||||
|
**Shipped version:** 9.0.2.5~ynh4
|
||||||
|
|
||||||
**Demo:** http://demo.noalyss.eu/index.php
|
**Demo:** http://demo.noalyss.eu/index.php
|
||||||
|
|
||||||
|
|
21
README_fr.md
21
README_fr.md
|
@ -5,26 +5,25 @@ It shall NOT be edited by hand.
|
||||||
|
|
||||||
# Noalyss pour YunoHost
|
# Noalyss pour YunoHost
|
||||||
|
|
||||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/noalyss.svg)](https://dash.yunohost.org/appci/app/noalyss) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/noalyss.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/noalyss.maintain.svg)
|
[![Niveau d’intégration](https://dash.yunohost.org/integration/noalyss.svg)](https://dash.yunohost.org/appci/app/noalyss) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/noalyss.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/noalyss.maintain.svg)
|
||||||
[![Installer Noalyss avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=noalyss)
|
[![Installer Noalyss avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=noalyss)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
|
|
||||||
> *Ce package vous permet d'installer Noalyss rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d’installer Noalyss 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.*
|
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
|
||||||
|
|
||||||
Noalyss est un serveur de comptabilité destiné à être hébergé sur Internet afin de contenir la comptabilité d’un nombre illimité de sociétés et d’utilisateurs ne se connaissant pas. Chaque société a ses propres dossiers comptables , ses propres utilisateurs, et ne peut pas interférer avec la comptabilité des autres, à moins d’y être expressément autorisé.
|
Noalyss est un serveur de comptabilité destiné à être hébergé sur Internet afin de contenir la comptabilité d’un nombre illimité de sociétés et d’utilisateurs ne se connaissant pas. Chaque société a ses propres dossiers comptables , ses propres utilisateurs, et ne peut pas interférer avec la comptabilité des autres, à moins d’y être expressément autorisé.
|
||||||
|
|
||||||
**Version incluse :** 9.0.2.5~ynh3
|
**Version incluse :** 9.0.2.5~ynh4
|
||||||
|
|
||||||
|
|
||||||
**Démo :** http://demo.noalyss.eu/index.php
|
**Démo :** http://demo.noalyss.eu/index.php
|
||||||
|
|
||||||
## Captures d'écran
|
## Captures d’écran
|
||||||
|
|
||||||
![Capture d'écran de Noalyss](./doc/screenshots/Sélection_099_0.png)
|
![Capture d’écran de Noalyss](./doc/screenshots/Sélection_099_0.png)
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
|
@ -34,8 +33,8 @@ Noalyss est un serveur de comptabilité destiné à être hébergé sur Internet
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : <http://noalyss.eu>
|
* Site officiel de l’app : <http://noalyss.eu>
|
||||||
* Documentation officielle de l'admin : <https://wiki.noalyss.eu/doku.php>
|
* Documentation officielle de l’admin : <https://wiki.noalyss.eu/doku.php>
|
||||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_noalyss>
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_noalyss>
|
||||||
* Signaler un bug : <https://github.com/YunoHost-Apps/noalyss_ynh/issues>
|
* Signaler un bug : <https://github.com/YunoHost-Apps/noalyss_ynh/issues>
|
||||||
|
|
||||||
|
@ -51,4 +50,4 @@ ou
|
||||||
sudo yunohost app upgrade noalyss -u https://github.com/YunoHost-Apps/noalyss_ynh/tree/testing --debug
|
sudo yunohost app upgrade noalyss -u https://github.com/YunoHost-Apps/noalyss_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
|
@ -5,7 +5,7 @@
|
||||||
admin="john"
|
admin="john"
|
||||||
language="fr"
|
language="fr"
|
||||||
is_public=1
|
is_public=1
|
||||||
password="strongpassword"
|
password="someSuperStrongPassword1234"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -24,5 +24,5 @@ Notification=none
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=620065d7dcf5584b22222a7f32505575c460c2c9
|
; commit=620065d7dcf5584b22222a7f32505575c460c2c9
|
||||||
name=Merge pull request #31 from YunoHost-Apps/testing
|
name=Merge pull request #31 from YunoHost-Apps/testing
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=someSuperStrongPassword1234&port=666&
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,15 @@ define ("LOCALE",1);
|
||||||
define ("domaine","");
|
define ("domaine","");
|
||||||
define ("MULTI",1);
|
define ("MULTI",1);
|
||||||
define ("dbname","");
|
define ("dbname","");
|
||||||
// Uncomment to DEBUG
|
|
||||||
define ("DEBUG",TRUE);
|
/*
|
||||||
|
* DEBUGNOALYSS let you see more information when you develop.
|
||||||
|
* 0 = for production
|
||||||
|
* 1 = display all errors
|
||||||
|
* 2 = display all errors + more information
|
||||||
|
*/
|
||||||
|
|
||||||
|
define ("DEBUGNOALYSS",0);
|
||||||
// Uncomment to log your input
|
// Uncomment to log your input
|
||||||
// define ("LOGINPUT",TRUE);
|
// define ("LOGINPUT",TRUE);
|
||||||
// Uncomment if you want to activate the possibility to reinitialize
|
// Uncomment if you want to activate the possibility to reinitialize
|
||||||
|
@ -74,3 +81,8 @@ define ("DEBUG",TRUE);
|
||||||
// define ('SESSION_KEY','abcde');
|
// define ('SESSION_KEY','abcde');
|
||||||
// Max size is defined by default to 2MB, it could be also needed to modify PHP Ini file
|
// Max size is defined by default to 2MB, it could be also needed to modify PHP Ini file
|
||||||
// define ("MAX_FILE_SIZE",2097152);
|
// define ("MAX_FILE_SIZE",2097152);
|
||||||
|
// Create your own SESSION_KEY
|
||||||
|
// define ("SESSION_KEY","irazap492pq11");
|
||||||
|
//
|
||||||
|
// Audit everything
|
||||||
|
// define ("AUDIT_ENABLE",true);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Noalyss est un serveur de comptabilité destiné à être hébergé sur Internet afin de contenir la comptabilité d’un nombre illimité de sociétés et d’utilisateurs ne se connaissant pas. Chaque société a ses propres dossiers comptables , ses propres utilisateurs, et ne peut pas interférer avec la comptabilité des autres, à moins d’y être expressément autorisé.
|
Noalyss is an accounting server intended to be hosted on the Internet in order to contain the accounting of an unlimited number of companies and users who do not know each other. Each company has its own accounting files, its own users, and cannot interfere with the accounting of others, unless expressly authorized to do so.
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Noalyss est un serveur de comptabilité destiné à être hébergé sur Internet afin de contenir la comptabilité d’un nombre illimité de sociétés et d’utilisateurs ne se connaissant pas. Chaque société a ses propres dossiers comptables , ses propres utilisateurs, et ne peut pas interférer avec la comptabilité des autres, à moins d’y être expressément autorisé.
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Accounting free software (Belgian and French accounting)",
|
"en": "Accounting free software (Belgian and French accounting)",
|
||||||
"fr": "Logiciel libre de comptabilité (comptabilité Belge et Française)"
|
"fr": "Logiciel libre de comptabilité (comptabilité Belge et Française)"
|
||||||
},
|
},
|
||||||
"version": "9.0.2.5~ynh3",
|
"version": "9.0.2.5~ynh4",
|
||||||
"url": "http://noalyss.eu",
|
"url": "http://noalyss.eu",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
|
|
||||||
YNH_PHP_VERSION="8.0"
|
YNH_PHP_VERSION="8.0"
|
||||||
|
|
||||||
pkg_dependencies="postgresql apt-transport-https libgd-dev php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php-php-gettext"
|
php_dependencies="php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php-php-gettext"
|
||||||
|
|
||||||
|
pkg_dependencies="postgresql apt-transport-https libgd-dev $php_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON HELPERS
|
# COMMON HELPERS
|
||||||
|
@ -71,3 +73,138 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
# Send the email to the recipients
|
# Send the email to the recipients
|
||||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### List all existing PostgreSQL databases associated with a given user
|
||||||
|
#
|
||||||
|
# [internal]
|
||||||
|
#
|
||||||
|
# usage: ynh_psql_list_user_dbs db_user
|
||||||
|
# | arg: db_user - the PostgreSQL role/user of which to list all owned databases
|
||||||
|
ynh_psql_list_user_dbs() {
|
||||||
|
local db_user=$1
|
||||||
|
|
||||||
|
if ynh_psql_user_exists --user=$db_user; then # Check that the db_user exists
|
||||||
|
local sql="COPY (SELECT datname FROM pg_database JOIN pg_authid ON pg_database.datdba = pg_authid.oid WHERE rolname = '${db_user}') TO STDOUT"
|
||||||
|
local dbs_list=$(ynh_psql_execute_as_root --sql="$sql") # Fetch database(s) associated to role $db_user as a string using space as delimiter (ex: "db1 db2 db3 db4")
|
||||||
|
echo "$dbs_list"
|
||||||
|
else
|
||||||
|
ynh_print_err --message="User \'$db_user\' does not exist"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#### Remove all existing PostgreSQL databases associated with a given user
|
||||||
|
#
|
||||||
|
# usage: ynh_psql_remove_all_user_dbs --db_user=db_user
|
||||||
|
# | arg: -u, --db_user= - the PostgreSQL role/user of which to remove all owned databases
|
||||||
|
#
|
||||||
|
# This can be useful to prepare the removal of a given user.
|
||||||
|
ynh_psql_remove_all_user_dbs() {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=u
|
||||||
|
local -A args_array=([u]=db_user=)
|
||||||
|
local db_user
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
local dbs_to_drop=$(ynh_psql_list_user_dbs $db_user)
|
||||||
|
if [ -n "$dbs_to_drop" ]; then # Check that the list of database(s) is not empty
|
||||||
|
|
||||||
|
local db_name
|
||||||
|
for db_name in $dbs_to_drop # Iterate through the list of database(s) to remove. Note: this would fail in case databases names would contain space character or characters such as "*". IFS parsing method would then be required.
|
||||||
|
do
|
||||||
|
if ynh_psql_database_exists --database=$db_name; then # Check if the database exists
|
||||||
|
ynh_psql_drop_db $db_name # Remove the database
|
||||||
|
ynh_print_info --message="Removed database $db_name associated to role $db_user"
|
||||||
|
else
|
||||||
|
ynh_print_warn --message="Database $db_name not found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ynh_print_warn --message="No associated database to role $db_user was found"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Dump all existing PostgreSQL databases associated with a given user
|
||||||
|
#
|
||||||
|
# usage: ynh_psql_dump_all_user_dbs --db_user=db_user [--app=app]
|
||||||
|
# | arg: -u, --db_user= - the PostgreSQL role/user of which to remove all owned databases
|
||||||
|
# | arg: -a, --app= - the application id to tag the dump with
|
||||||
|
# Requires YunoHost version 3.5.0 or higher.
|
||||||
|
ynh_psql_dump_all_user_dbs() {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=ua
|
||||||
|
local -A args_array=([u]=db_user= [a]=app=)
|
||||||
|
local db_user
|
||||||
|
local app
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
app="${app:-}"
|
||||||
|
|
||||||
|
local dbs_to_dump=$(ynh_psql_list_user_dbs $db_user)
|
||||||
|
if [ -n "$dbs_to_dump" ]; then # Check that the list of database(s) is not empty
|
||||||
|
|
||||||
|
local db_name
|
||||||
|
for db_name in $dbs_to_dump # Iterate through the list of database(s) to dump. Note: this would fail in case databases names would contain space character or characters such as "*". IFS parsing method would then be required.
|
||||||
|
do
|
||||||
|
if ynh_psql_database_exists --database=$db_name; then # Check if the database exists
|
||||||
|
ynh_psql_dump_db $db_name > "$app-$db_name-dump.sql" # Dump the database to a filename format of app-db_name-dump.sql, or of db_name-dump.sql if app parameter was not supplied
|
||||||
|
ynh_print_info --message="Dumped database $db_name associated to role $db_user"
|
||||||
|
else
|
||||||
|
ynh_print_warn --message="Database $db_name not found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ynh_print_warn --message="No associated database to role $db_user was found"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restore all dumped PostgreSQL databases for the given app
|
||||||
|
#
|
||||||
|
# usage: ynh_psql_restore_all_app_dbs_dumps --db_user=db_user [--db_user_pwd=db_user_pwd]
|
||||||
|
# | arg: -u, --db_user= - the PostgreSQL role/user which will own the restored databases. If not existing, it will be created.
|
||||||
|
# | arg: -p, --db_user_pwd= - the password associated to the PostgreSQL role/user which will own the databases. If not existing, it will be generated and saved to the app's config file.
|
||||||
|
#
|
||||||
|
# SQL dump files to restore must be named according to this format "app_id-db_name-dump.sql" and be located in the app folder
|
||||||
|
# The filename format requirement is made so to match the files dumped with ynh_psql_dump_all_user_dbs --user=user --app=app (with both parameters specified).
|
||||||
|
#
|
||||||
|
# Requires YunoHost version 2.7.13 or higher.
|
||||||
|
ynh_psql_restore_all_app_dbs_dumps(){
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=up
|
||||||
|
local -A args_array=([u]=db_user= [p]=db_user_pwd=)
|
||||||
|
local db_user
|
||||||
|
local db_user_pwd
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
if [ -z "$app" ]; then
|
||||||
|
ynh_die --message="No global app_ID variable defined in the script"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_psql_test_if_first_run # Make sure PSQL is installed
|
||||||
|
|
||||||
|
local filename
|
||||||
|
for filename in *-dump.sql # Loop among all files ending with "-dump.sql" in the current folder
|
||||||
|
do
|
||||||
|
local db_name
|
||||||
|
db_name="${filename#${app}-}" # Remove "$app-" prefix from filename string to parse db_name. Will do nothing if there is no match.
|
||||||
|
db_name="${db_name%-dump.sql}" # Remove "-dump.sql" suffix from filename string to parse db_name. Will do nothing if there is no match.
|
||||||
|
db_name=$(ynh_sanitize_dbid --db_name="$db_name")
|
||||||
|
|
||||||
|
if [[ "${filename#${app}-}" = "$filename" || -z "$db_name" ]] ; then # Check whether app_ID is included in filename OR $db_name is empty
|
||||||
|
ynh_print_warn --message="File ignored: $filename. Filename not matching expected format (appID-db_name-dump.sql)"
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
db_user_pwd="${db_user_pwd:-}"
|
||||||
|
if [ -z "$db_user_pwd" ]; then
|
||||||
|
db_user_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) # Try to retrieve db_user_pwd from the app's settings. It may prove empty during the first loop, but will get populated before the second loop by ynh_psql_setup_db() below.
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_user_pwd # Check that the db_user exists or create it generating a random password and then create an empty database named $db_name.
|
||||||
|
ynh_psql_execute_file_as_root --file="./${filename}" --database=$db_name # Restore the dabatase from the corresponding dump file
|
||||||
|
|
||||||
|
ynh_print_info --message="Restored database $db_name, owned by PostgreSQL user $db_user"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -55,7 +55,7 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_all_user_dbs --db_user=$db_user --app=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -30,8 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||||
db_user=$db_name
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,7 +26,6 @@ admin=$YNH_APP_ARG_ADMIN
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
phpversion=$YNH_PHP_VERSION
|
phpversion=$YNH_PHP_VERSION
|
||||||
timezone="$(cat /etc/timezone)"
|
timezone="$(cat /etc/timezone)"
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -64,11 +63,18 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
db_user=$db_name
|
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run # Make sure PSQL is installed
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
ynh_psql_setup_db --db_user=$db_user --db_name="${db_user}_tmp" # This helper will create db_user, generate db_user_pwd. But it will also create a database Noalyss does not need, hence the "tmp" flag
|
||||||
|
ynh_psql_drop_db "${db_user}_tmp" # Remove the useless database just created with the "tmp" flag.
|
||||||
|
|
||||||
|
# Give permission to db_user to create databases, as with version 9025 at least, standard Noalyss operation (can be tweaked with shared server install process - with potentially less features?) will require to create several databases: one admin database (account_repository), one database per accounting template (two are populated at install by default: mod1, mod2, etc.), one per accounting folder that will be created while using the app, etc.
|
||||||
|
if [ -n "$db_user" ]; then
|
||||||
|
sql="ALTER USER $db_user CREATEDB"
|
||||||
|
ynh_psql_execute_as_root --sql="$sql"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -81,7 +87,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
@ -91,14 +97,6 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -107,6 +105,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low
|
ynh_add_fpm_config --usage=low --footprint=low
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
# =================================================
|
# =================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
# =================================================
|
# =================================================
|
||||||
|
@ -117,7 +123,8 @@ ynh_add_config --template="../conf/noalyss.conf" --destination="$final_path/incl
|
||||||
chmod 650 "$final_path/include/config.inc.php"
|
chmod 650 "$final_path/include/config.inc.php"
|
||||||
chown $app: "$final_path/include/config.inc.php"
|
chown $app: "$final_path/include/config.inc.php"
|
||||||
|
|
||||||
ynh_secure_remove --file="/var/www/noalyss/html/install.php"
|
# Keep an archive of Noalyss' install.php script for it to be reachable by YNH restore script since the original file is deleted at the end of the install process (this archive is currently left unused, but it could be useful for future potential implementation such as scripting the admin admin user change - cf. annotations in Noalyss' /inlude/config.inc.php for use case).
|
||||||
|
cp "$final_path/html/install.php" "$final_path/html/install.php.archive"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
@ -148,20 +155,33 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Sending a readme for the admin..."
|
ynh_script_progression --message="Sending a readme to the admin email address. Please check it to complete the installation process."
|
||||||
|
|
||||||
message="Noalyss was successfully installed :)
|
message="Noalyss installation is *almost* complete :)
|
||||||
|
|
||||||
Please open your $app domain: https://$domain$path_url
|
To conclude, please open the admin configuration page of your ${app^} domain: https://$domain$path_url/install.php
|
||||||
|
You will have to:
|
||||||
|
1. Select the language you want and click on \"Continuer\" (FR) / \"Continue\" (EN).
|
||||||
|
2. Scroll the page down and click on the button \"Commencer la mise à jour ou l'installation ?\" (FR) / \"Start the update or the installation ?\" (EN)
|
||||||
|
3. Scroll to the bottom of the page and click on the button \"Essai effacement install.php et se connecter à NOALYSS\" (FR) / \"Try erasing install.php and log into NOALYSS\" (EN)
|
||||||
|
|
||||||
Complete the registration process from the setup page displayed.
|
Once done, you will be able to log into Noalyss with your credentials:
|
||||||
Details for PostgreSQL database to be enterted while registration process:
|
-------------------------------------------
|
||||||
|
${app^}'s domain: https://$domain$path_url
|
||||||
|
${app^}'s admin user: $admin
|
||||||
|
${app^}'s admin password: $password
|
||||||
|
-------------------------------------------
|
||||||
|
Link to Noalyss' user documentation: https://www.noalyss.eu/?page_id=1031
|
||||||
|
|
||||||
Database login: $app
|
|
||||||
Database name: $app
|
|
||||||
Database password: $db_pwd
|
|
||||||
|
|
||||||
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/noalysse_ynh/issues"
|
Please find also for reference the credential for the dedicated PostgreSQL database user:
|
||||||
|
-------------------------------------------
|
||||||
|
Database's dedicated user: $app
|
||||||
|
Database's dedicated user's password: $db_pwd
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/noalysse_ynh/issues
|
||||||
|
Or post a message in the forum: https://forum.yunohost.org/t/noalyss-beligum-and-french-accounting/7356"
|
||||||
|
|
||||||
ynh_send_readme_to_admin "$message"
|
ynh_send_readme_to_admin "$message"
|
||||||
|
|
||||||
|
|
|
@ -17,17 +17,24 @@ ynh_script_progression --message="Loading installation settings..."
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||||
db_user=$db_name
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
# REMOVE THE POSTGRESQL DATABASE(S) & ROLE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database"
|
ynh_script_progression --message="Removing all associated PostgreSQL database(s) and role"
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove all existing databases associated with the app's dedicated user a database if it exists
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_psql_remove_all_user_dbs --db_user=$db_user;
|
||||||
|
|
||||||
|
# Remove dedicated PostgreSQL role
|
||||||
|
if ynh_psql_user_exists --user=$db_user; then
|
||||||
|
ynh_psql_drop_user $db_user
|
||||||
|
ynh_print_info --message="Removed PostgreSQL role $db_user"
|
||||||
|
else
|
||||||
|
ynh_print_warn --message="User $db_user not found"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
|
|
|
@ -26,29 +26,23 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||||
db_user=$db_name
|
db_user_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path || ynh_die "There is already a directory: $final_path "
|
test ! -d $final_path \
|
||||||
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
@ -56,7 +50,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression --message="Restoring the app main directory..." --weight=3
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
@ -69,7 +63,7 @@ chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=4
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -77,19 +71,30 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring PHP-FPM configuration..."
|
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=2
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_restore_all_app_dbs_dumps --db_user=$db_user --db_user_pwd=$db_user_pwd
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|
||||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
|
||||||
|
|
||||||
|
# Give permission to db_user to create databases, as with version 9025 at least, standard Noalyss operation (can be tweaked with shared server install process - with potentially less features?) will require to create several databases: one admin database (account_repository), one database per accounting template (two are populated at install by default: mod1, mod2, etc.), one per accounting folder that will be created while using the app, etc.
|
||||||
|
if [ -n "$db_user" ]; then
|
||||||
|
sql="ALTER USER $db_user CREATEDB"
|
||||||
|
ynh_psql_execute_as_root --sql="$sql"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -19,9 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
db_user=$db_name
|
|
||||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -49,10 +47,10 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
# If db_user doesn't exist, create it
|
||||||
if [ -z "$db_name" ]; then
|
if [ -z "$db_user" ]; then
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_user=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
|
@ -92,14 +90,6 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -115,6 +105,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low
|
ynh_add_fpm_config --usage=low --footprint=low
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue