mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Merge pull request #157 from YunoHost-Apps/testing
Apply last example_ynh
This commit is contained in:
commit
4bece11c12
10 changed files with 263 additions and 217 deletions
|
@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
WeKan ® is an completely Open Source and Free software collaborative kanban board application with MIT license.
|
WeKan ® is an completely Open Source and Free software collaborative kanban board application with MIT license.
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 6.28~ynh1
|
**Shipped version:** 6.28~ynh2
|
||||||
|
|
||||||
**Demo:** https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h
|
**Demo:** https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h
|
||||||
|
|
||||||
|
|
26
README_fr.md
26
README_fr.md
|
@ -15,10 +15,10 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
|
|
||||||
## Vue d'ensemble
|
## Vue d'ensemble
|
||||||
|
|
||||||
WeKan ® is an completely Open Source and Free software collaborative kanban board application with MIT license.
|
WeKan ® est une application de tableau kanban collaborative entièrement libre et open source avec une licence MIT.
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 6.28~ynh1
|
**Version incluse :** 6.28~ynh2
|
||||||
|
|
||||||
**Démo :** https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h
|
**Démo :** https://demo.sandstorm.io/appdemo/m86q05rdvj14yvn78ghaxynqz7u2svw6rnttptxx49g1785cdv1h
|
||||||
|
|
||||||
|
@ -28,22 +28,22 @@ WeKan ® is an completely Open Source and Free software collaborative kanban boa
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
* There is currently **no SSO integration** though it might be integrated at some point in the app, now that it's supported in Meteor/Wekan. In the meantime, users can create accounts (in fact, they can create infinite number of accounts) manually, and need to login manually specifically in Wekan.
|
* Il n'y a actuellement **pas d'intégration SSO**, bien qu'elle puisse être intégrée à un moment donné dans l'application, maintenant qu'elle est supportée par Meteor/Wekan. En attendant, les utilisateurs peuvent créer des comptes (en fait, ils peuvent créer un nombre infini de comptes) manuellement, et doivent se connecter manuellement spécifiquement dans Wekan.
|
||||||
* This app **only works on x86, 64bits architecture**! In particular, it won't work on 32 bit machines or ARM. See the discussion [here](https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
|
* Cette application **ne fonctionne que sur une architecture x86, 64bits** ! En particulier, elle ne fonctionnera pas sur les machines 32 bits ou ARM. Voir la discussion [ici] (https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
|
||||||
* YunoHost users with more than one email address can't login to wekan using ldap. For example first YunoHost user has severals email addresses: root@domain; admin@domain; webmaster@domain; postmaster@domain, etc... Workaround: remove all mail aliases of the user you want to connect, connect one time on wekan, recreate the aliases of the YunoHost user.
|
* Les utilisateurs de YunoHost ayant plus d'une adresse e-mail ne peuvent pas se connecter à wekan en utilisant ldap. Par exemple, le premier utilisateur de YunoHost a plusieurs adresses e-mail : root@domain ; admin@domain ; webmaster@domain ; postmaster@domain, etc.... Solution : supprimez tous les alias de messagerie de l'utilisateur que vous voulez connecter, connectez-vous une fois sur wekan, recréez les alias de l'utilisateur YunoHost.
|
||||||
|
|
||||||
## Configuration:
|
## Configuration :
|
||||||
As LDAP authentification is enabled by default, Wekan admins correspond to the permission `Wekan Admin`. The user you choose during installation is member of this group.
|
L'authentification LDAP étant activée par défaut, les admins de Wekan correspondent à la permission `Wekan Admin`. L'utilisateur que vous choisissez lors de l'installation est membre de ce groupe.
|
||||||
To add an admin account, you can:
|
Pour ajouter un compte admin, vous pouvez :
|
||||||
|
|
||||||
- [with the webadmin] go to Users > Groups and permissions > Add the user to the permission `Wekan Admin`
|
- [avec le webadmin] allez dans Utilisateurs > Groupes et permissions > Ajouter l'utilisateur à la permission `Wekan Admin`.
|
||||||
- [or with the command line] `yunohost user permission update wekan.admin -a the_user_to_add`
|
- [ou avec la ligne de commande] `yunohost user permission update wekan.admin -a the_user_to_add`.
|
||||||
|
|
||||||
All others YunhoHost user can access with LDAP authentication.
|
Tous les autres utilisateurs de YunhoHost peuvent accéder avec l'authentification LDAP.
|
||||||
|
|
||||||
If you have disable ldap authentication, first registered user will be admin, and next ones normal users. If you want other admins too, you can change their permission to admin at Wekan Admin Panel.
|
Si vous avez désactivé l'authentification LDAP, le premier utilisateur enregistré sera l'administrateur, et les suivants seront des utilisateurs normaux. Si vous voulez d'autres administrateurs, vous pouvez changer leur permission à admin dans le panneau d'administration de Wekan.
|
||||||
|
|
||||||
**Private/Public mode:** In private mode, only authorized YunoHost members can access to the Wekan.
|
**Mode privé/public:** En mode privé, seuls les membres autorisés de YunoHost peuvent accéder au Wekan.
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,38 @@
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
# 3.79~ynh2
|
||||||
|
#upgrade=1 from_commit=2843d504bcdb0402939f87ebeeda3417de02a9e4
|
||||||
|
# 3.95~ynh1
|
||||||
|
#upgrade=1 from_commit=46f4b540cb99090a3fe1d35828094dbbfb34b692
|
||||||
|
# 3.95~ynh1
|
||||||
|
#upgrade=1 from_commit=3cd252289f4fd138879872658762f4c6ae415cc4
|
||||||
|
# 4.09~ynh1
|
||||||
|
#upgrade=1 from_commit=c2b4715e8591031f3054cedb1220e7619607bb36
|
||||||
|
# 4.43~ynh1
|
||||||
|
#upgrade=1 from_commit=2cf63bd4d660eae4526221c1a68efede499e3ee6
|
||||||
|
# 4.64~ynh1
|
||||||
|
#upgrade=1 from_commit=32fe3a7c342e5f29d7a7534125151723f916de46
|
||||||
|
# 4.64~ynh2
|
||||||
|
#upgrade=1 from_commit=9e698d094c29fc6ab12ac60cd1d0e68b56bfc953
|
||||||
|
# 5.00~ynh1
|
||||||
|
#upgrade=1 from_commit=8655e8062d1bc6e90b01b98ca9a0dea15d60119e
|
||||||
|
# 5.17~ynh1
|
||||||
|
#upgrade=1 from_commit=8cdb28eff25b8b431635b87f92f96f8e216ad71f
|
||||||
# 5.35~ynh1
|
# 5.35~ynh1
|
||||||
upgrade=1 from_commit=2e9c8be6b87d5c4cd6693e7b3c0c05cfc7d1ac51
|
upgrade=1 from_commit=2e9c8be6b87d5c4cd6693e7b3c0c05cfc7d1ac51
|
||||||
# 5.93~ynh1
|
# 5.93~ynh1
|
||||||
upgrade=1 from_commit=493a70f7d0e79b3ee92d53976a0cd35fa944b428
|
upgrade=1 from_commit=493a70f7d0e79b3ee92d53976a0cd35fa944b428
|
||||||
# 6.27~ynh1
|
# 6.24~ynh1
|
||||||
upgrade=1 from_commit=b74bbb4b5c8e67753672ecb69501c4a41771d852
|
#upgrade=1 from_commit=9a686b180d38329a5b53dcc40c0501961a0144b5
|
||||||
|
# 6.26~ynh1
|
||||||
|
upgrade=1 from_commit=20ccbbbd80021d71692291bfc8de6d03d32f7a76
|
||||||
|
# 6.27.1~ynh1
|
||||||
|
upgrade=1 from_commit=9cac9713c99aabae61074ebdb2b88b1e927a1f1b
|
||||||
|
# 6.27.1~ynh2
|
||||||
|
upgrade=1 from_commit=1ed17a307bd6a2374a21d3488f17a099107d3984
|
||||||
|
# 6.28~ynh1
|
||||||
|
upgrade=1 from_commit=2c93251155dd3ce73bfa03090e914d407cc89d30
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
|
|
@ -12,5 +12,5 @@ location __PATH__/ {
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
#include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
WeKan ® est une application de tableau kanban collaborative entièrement libre et open source avec une licence MIT.
|
16
doc/DISCLAIMER_fr.md
Normal file
16
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
* Il n'y a actuellement **pas d'intégration SSO**, bien qu'elle puisse être intégrée à un moment donné dans l'application, maintenant qu'elle est supportée par Meteor/Wekan. En attendant, les utilisateurs peuvent créer des comptes (en fait, ils peuvent créer un nombre infini de comptes) manuellement, et doivent se connecter manuellement spécifiquement dans Wekan.
|
||||||
|
* Cette application **ne fonctionne que sur une architecture x86, 64bits** ! En particulier, elle ne fonctionnera pas sur les machines 32 bits ou ARM. Voir la discussion [ici] (https://github.com/YunoHost-Apps/wekan_ynh/issues/1#issuecomment-401612500).
|
||||||
|
* Les utilisateurs de YunoHost ayant plus d'une adresse e-mail ne peuvent pas se connecter à wekan en utilisant ldap. Par exemple, le premier utilisateur de YunoHost a plusieurs adresses e-mail : root@domain ; admin@domain ; webmaster@domain ; postmaster@domain, etc.... Solution : supprimez tous les alias de messagerie de l'utilisateur que vous voulez connecter, connectez-vous une fois sur wekan, recréez les alias de l'utilisateur YunoHost.
|
||||||
|
|
||||||
|
## Configuration :
|
||||||
|
L'authentification LDAP étant activée par défaut, les admins de Wekan correspondent à la permission `Wekan Admin`. L'utilisateur que vous choisissez lors de l'installation est membre de ce groupe.
|
||||||
|
Pour ajouter un compte admin, vous pouvez :
|
||||||
|
|
||||||
|
- [avec le webadmin] allez dans Utilisateurs > Groupes et permissions > Ajouter l'utilisateur à la permission `Wekan Admin`.
|
||||||
|
- [ou avec la ligne de commande] `yunohost user permission update wekan.admin -a the_user_to_add`.
|
||||||
|
|
||||||
|
Tous les autres utilisateurs de YunhoHost peuvent accéder avec l'authentification LDAP.
|
||||||
|
|
||||||
|
Si vous avez désactivé l'authentification LDAP, le premier utilisateur enregistré sera l'administrateur, et les suivants seront des utilisateurs normaux. Si vous voulez d'autres administrateurs, vous pouvez changer leur permission à admin dans le panneau d'administration de Wekan.
|
||||||
|
|
||||||
|
**Mode privé/public:** En mode privé, seuls les membres autorisés de YunoHost peuvent accéder au Wekan.
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Trello-like kanban",
|
"en": "Trello-like kanban",
|
||||||
"fr": "Un kanban similaire à Trello"
|
"fr": "Un kanban similaire à Trello"
|
||||||
},
|
},
|
||||||
"version": "6.28~ynh1",
|
"version": "6.28~ynh2",
|
||||||
"url": "https://wekan.github.io",
|
"url": "https://wekan.github.io",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -74,9 +74,9 @@ ynh_remove_nginx_config
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
ynh_remove_mongo
|
ynh_remove_mongo
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -72,6 +72,7 @@ if ! ynh_permission_exists --permission="admin"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_secure_remove --file="/etc/apt/sources.list.d/mongodb-org-3.2.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/mongodb-org-3.2.list"
|
||||||
|
ynh_secure_remove --file="/etc/apt/sources.list.d/mongodb-org-4.4.list"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
|
|
@ -12,100 +12,100 @@ MONGO_CE_KEY="https://www.mongodb.org/static/pgp/server-5.0.asc"
|
||||||
# example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")"
|
# example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")"
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_exec [--user=user] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval]
|
# usage: ynh_mongo_exec [--user=user] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval]
|
||||||
# | arg: -u, --user= - The user name to connect as
|
# | arg: -u, --user= - The user name to connect as
|
||||||
# | arg: -p, --password= - The user password
|
# | arg: -p, --password= - The user password
|
||||||
# | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to
|
# | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to
|
||||||
# | arg: -d, --database= - The database to connect to
|
# | arg: -d, --database= - The database to connect to
|
||||||
# | arg: -h, --host= - The host to connect to
|
# | arg: -h, --host= - The host to connect to
|
||||||
# | arg: -P, --port= - The port to connect to
|
# | arg: -P, --port= - The port to connect to
|
||||||
# | arg: -c, --command= - The command to evaluate
|
# | arg: -c, --command= - The command to evaluate
|
||||||
# | arg: -e, --eval - Evaluate instead of execute the command.
|
# | arg: -e, --eval - Evaluate instead of execute the command.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_exec() {
|
ynh_mongo_exec() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=upadhPce
|
local legacy_args=upadhPce
|
||||||
local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval )
|
local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval )
|
||||||
local user
|
local user
|
||||||
local password
|
local password
|
||||||
local authenticationdatabase
|
local authenticationdatabase
|
||||||
local database
|
local database
|
||||||
local host
|
local host
|
||||||
local port
|
local port
|
||||||
local command
|
local command
|
||||||
local eval
|
local eval
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
user="${user:-}"
|
user="${user:-}"
|
||||||
password="${password:-}"
|
password="${password:-}"
|
||||||
authenticationdatabase="${authenticationdatabase:-}"
|
authenticationdatabase="${authenticationdatabase:-}"
|
||||||
database="${database:-}"
|
database="${database:-}"
|
||||||
host="${host:-}"
|
host="${host:-}"
|
||||||
port="${port:-}"
|
port="${port:-}"
|
||||||
eval=${eval:-0}
|
eval=${eval:-0}
|
||||||
|
|
||||||
# If user is provided
|
# If user is provided
|
||||||
if [ -n "$user" ]
|
if [ -n "$user" ]
|
||||||
then
|
then
|
||||||
user="--username=$user"
|
user="--username=$user"
|
||||||
|
|
||||||
# If password is provided
|
# If password is provided
|
||||||
if [ -n "$password" ]
|
if [ -n "$password" ]
|
||||||
then
|
then
|
||||||
password="--password=$password"
|
password="--password=$password"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If authenticationdatabase is provided
|
# If authenticationdatabase is provided
|
||||||
if [ -n "$authenticationdatabase" ]
|
if [ -n "$authenticationdatabase" ]
|
||||||
then
|
then
|
||||||
authenticationdatabase="--authenticationDatabase=$authenticationdatabase"
|
authenticationdatabase="--authenticationDatabase=$authenticationdatabase"
|
||||||
else
|
else
|
||||||
authenticationdatabase="--authenticationDatabase=admin"
|
authenticationdatabase="--authenticationDatabase=admin"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
password=""
|
password=""
|
||||||
authenticationdatabase=""
|
authenticationdatabase=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If host is provided
|
# If host is provided
|
||||||
if [ -n "$host" ]
|
if [ -n "$host" ]
|
||||||
then
|
then
|
||||||
host="--host=$host"
|
host="--host=$host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If port is provided
|
# If port is provided
|
||||||
if [ -n "$port" ]
|
if [ -n "$port" ]
|
||||||
then
|
then
|
||||||
port="--port=$port"
|
port="--port=$port"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If eval is not provided
|
# If eval is not provided
|
||||||
if [ $eval -eq 0 ]
|
if [ $eval -eq 0 ]
|
||||||
then
|
then
|
||||||
# If database is provided
|
# If database is provided
|
||||||
if [ -n "$database" ]
|
if [ -n "$database" ]
|
||||||
then
|
then
|
||||||
database="use $database"
|
database="use $database"
|
||||||
else
|
else
|
||||||
database=""
|
database=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mongosh --quiet --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port <<EOF
|
mongosh --quiet --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port <<EOF
|
||||||
$database
|
$database
|
||||||
${command}
|
${command}
|
||||||
quit()
|
quit()
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
# If database is provided
|
# If database is provided
|
||||||
if [ -n "$database" ]
|
if [ -n "$database" ]
|
||||||
then
|
then
|
||||||
database="$database"
|
database="$database"
|
||||||
else
|
else
|
||||||
database=""
|
database=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mongosh --quiet $database --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port --eval="$command"
|
mongosh --quiet $database --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port --eval="$command"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Drop a database
|
# Drop a database
|
||||||
|
@ -116,18 +116,18 @@ EOF
|
||||||
# consider using ynh_mongo_remove_db instead.
|
# consider using ynh_mongo_remove_db instead.
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_drop_db --database=database
|
# usage: ynh_mongo_drop_db --database=database
|
||||||
# | arg: -d, --database= - The database name to drop
|
# | arg: -d, --database= - The database name to drop
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_drop_db() {
|
ynh_mongo_drop_db() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=d
|
local legacy_args=d
|
||||||
local -A args_array=( [d]=database= )
|
local -A args_array=( [d]=database= )
|
||||||
local database
|
local database
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
ynh_mongo_exec --database="$database" --command='db.runCommand({dropDatabase: 1})'
|
ynh_mongo_exec --database="$database" --command='db.runCommand({dropDatabase: 1})'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Dump a database
|
# Dump a database
|
||||||
|
@ -135,19 +135,19 @@ ynh_mongo_drop_db() {
|
||||||
# example: ynh_mongo_dump_db --database=wekan > ./dump.bson
|
# example: ynh_mongo_dump_db --database=wekan > ./dump.bson
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_dump_db --database=database
|
# usage: ynh_mongo_dump_db --database=database
|
||||||
# | arg: -d, --database= - The database name to dump
|
# | arg: -d, --database= - The database name to dump
|
||||||
# | ret: the mongodump output
|
# | ret: the mongodump output
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_dump_db() {
|
ynh_mongo_dump_db() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=d
|
local legacy_args=d
|
||||||
local -A args_array=( [d]=database= )
|
local -A args_array=( [d]=database= )
|
||||||
local database
|
local database
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
mongodump --quiet --db="$database" --archive
|
mongodump --quiet --db="$database" --archive
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a user
|
# Create a user
|
||||||
|
@ -155,49 +155,49 @@ ynh_mongo_dump_db() {
|
||||||
# [internal]
|
# [internal]
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_create_user --db_user=user --db_pwd=pwd --db_name=name
|
# usage: ynh_mongo_create_user --db_user=user --db_pwd=pwd --db_name=name
|
||||||
# | arg: -u, --db_user= - The user name to create
|
# | arg: -u, --db_user= - The user name to create
|
||||||
# | arg: -p, --db_pwd= - The password to identify user by
|
# | arg: -p, --db_pwd= - The password to identify user by
|
||||||
# | arg: -n, --db_name= - Name of the database to grant privilegies
|
# | arg: -n, --db_name= - Name of the database to grant privilegies
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_create_user() {
|
ynh_mongo_create_user() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=unp
|
local legacy_args=unp
|
||||||
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
|
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
|
||||||
local db_user
|
local db_user
|
||||||
local db_name
|
local db_name
|
||||||
local db_pwd
|
local db_pwd
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
# Create the user and set the user as admin of the db
|
# Create the user and set the user as admin of the db
|
||||||
ynh_mongo_exec --database="$db_name" --command='db.createUser( { user: "'${db_user}'", pwd: "'${db_pwd}'", roles: [ { role: "readWrite", db: "'${db_name}'" } ] } );'
|
ynh_mongo_exec --database="$db_name" --command='db.createUser( { user: "'${db_user}'", pwd: "'${db_pwd}'", roles: [ { role: "readWrite", db: "'${db_name}'" } ] } );'
|
||||||
|
|
||||||
# Add clustermonitoring rights
|
# Add clustermonitoring rights
|
||||||
ynh_mongo_exec --database="$db_name" --command='db.grantRolesToUser("'${db_user}'",[{ role: "clusterMonitor", db: "admin" }]);'
|
ynh_mongo_exec --database="$db_name" --command='db.grantRolesToUser("'${db_user}'",[{ role: "clusterMonitor", db: "admin" }]);'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if a mongo database exists
|
# Check if a mongo database exists
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_database_exists --database=database
|
# usage: ynh_mongo_database_exists --database=database
|
||||||
# | arg: -d, --database= - The database for which to check existence
|
# | arg: -d, --database= - The database for which to check existence
|
||||||
# | exit: Return 1 if the database doesn't exist, 0 otherwise
|
# | exit: Return 1 if the database doesn't exist, 0 otherwise
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_database_exists() {
|
ynh_mongo_database_exists() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=d
|
local legacy_args=d
|
||||||
local -A args_array=([d]=database=)
|
local -A args_array=([d]=database=)
|
||||||
local database
|
local database
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
if [ $(ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("'${database}'")' --eval) -lt 0 ]
|
if [ $(ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("'${database}'")' --eval) -lt 0 ]
|
||||||
then
|
then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restore a database
|
# Restore a database
|
||||||
|
@ -205,18 +205,18 @@ ynh_mongo_database_exists() {
|
||||||
# example: ynh_mongo_restore_db --database=wekan < ./dump.bson
|
# example: ynh_mongo_restore_db --database=wekan < ./dump.bson
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_restore_db --database=database
|
# usage: ynh_mongo_restore_db --database=database
|
||||||
# | arg: -d, --database= - The database name to restore
|
# | arg: -d, --database= - The database name to restore
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_restore_db() {
|
ynh_mongo_restore_db() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=d
|
local legacy_args=d
|
||||||
local -A args_array=( [d]=database= )
|
local -A args_array=( [d]=database= )
|
||||||
local database
|
local database
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
mongorestore --quiet --db="$database" --archive
|
mongorestore --quiet --db="$database" --archive
|
||||||
}
|
}
|
||||||
|
|
||||||
# Drop a user
|
# Drop a user
|
||||||
|
@ -224,78 +224,78 @@ ynh_mongo_restore_db() {
|
||||||
# [internal]
|
# [internal]
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_drop_user --db_user=user --db_name=name
|
# usage: ynh_mongo_drop_user --db_user=user --db_name=name
|
||||||
# | arg: -u, --db_user= - The user to drop
|
# | arg: -u, --db_user= - The user to drop
|
||||||
# | arg: -n, --db_name= - Name of the database
|
# | arg: -n, --db_name= - Name of the database
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_drop_user() {
|
ynh_mongo_drop_user() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=un
|
local legacy_args=un
|
||||||
local -A args_array=( [u]=db_user= [n]=db_name= )
|
local -A args_array=( [u]=db_user= [n]=db_name= )
|
||||||
local db_user
|
local db_user
|
||||||
local db_name
|
local db_name
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
ynh_mongo_exec --database="$db_name" --command='db.dropUser("'$db_user'", {w: "majority", wtimeout: 5000})'
|
ynh_mongo_exec --database="$db_name" --command='db.dropUser("'$db_user'", {w: "majority", wtimeout: 5000})'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a database, an user and its password. Then store the password in the app's config
|
# Create a database, an user and its password. Then store the password in the app's config
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_setup_db --db_user=user --db_name=name [--db_pwd=pwd]
|
# usage: ynh_mongo_setup_db --db_user=user --db_name=name [--db_pwd=pwd]
|
||||||
# | arg: -u, --db_user= - Owner of the database
|
# | arg: -u, --db_user= - Owner of the database
|
||||||
# | arg: -n, --db_name= - Name of the database
|
# | arg: -n, --db_name= - Name of the database
|
||||||
# | arg: -p, --db_pwd= - Password of the database. If not provided, a password will be generated
|
# | arg: -p, --db_pwd= - Password of the database. If not provided, a password will be generated
|
||||||
#
|
#
|
||||||
# After executing this helper, the password of the created database will be available in $db_pwd
|
# After executing this helper, the password of the created database will be available in $db_pwd
|
||||||
# It will also be stored as "mongopwd" into the app settings.
|
# It will also be stored as "mongopwd" into the app settings.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_setup_db() {
|
ynh_mongo_setup_db() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=unp
|
local legacy_args=unp
|
||||||
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
|
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
|
||||||
local db_user
|
local db_user
|
||||||
local db_name
|
local db_name
|
||||||
db_pwd=""
|
db_pwd=""
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
local new_db_pwd=$(ynh_string_random) # Generate a random password
|
local new_db_pwd=$(ynh_string_random) # Generate a random password
|
||||||
# If $db_pwd is not provided, use new_db_pwd instead for db_pwd
|
# If $db_pwd is not provided, use new_db_pwd instead for db_pwd
|
||||||
db_pwd="${db_pwd:-$new_db_pwd}"
|
db_pwd="${db_pwd:-$new_db_pwd}"
|
||||||
|
|
||||||
# Create the user and grant access to the database
|
# Create the user and grant access to the database
|
||||||
ynh_mongo_create_user --db_user="$db_user" --db_pwd="$db_pwd" --db_name="$db_name"
|
ynh_mongo_create_user --db_user="$db_user" --db_pwd="$db_pwd" --db_name="$db_name"
|
||||||
|
|
||||||
# Store the password in the app's config
|
# Store the password in the app's config
|
||||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove a database if it exists, and the associated user
|
# Remove a database if it exists, and the associated user
|
||||||
#
|
#
|
||||||
# usage: ynh_mongo_remove_db --db_user=user --db_name=name
|
# usage: ynh_mongo_remove_db --db_user=user --db_name=name
|
||||||
# | arg: -u, --db_user= - Owner of the database
|
# | arg: -u, --db_user= - Owner of the database
|
||||||
# | arg: -n, --db_name= - Name of the database
|
# | arg: -n, --db_name= - Name of the database
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_mongo_remove_db() {
|
ynh_mongo_remove_db() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=un
|
local legacy_args=un
|
||||||
local -A args_array=( [u]=db_user= [n]=db_name= )
|
local -A args_array=( [u]=db_user= [n]=db_name= )
|
||||||
local db_user
|
local db_user
|
||||||
local db_name
|
local db_name
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
if ynh_mongo_database_exists --database=$db_name; then # Check if the database exists
|
if ynh_mongo_database_exists --database=$db_name; then # Check if the database exists
|
||||||
ynh_mongo_drop_db --database=$db_name # Remove the database
|
ynh_mongo_drop_db --database=$db_name # Remove the database
|
||||||
else
|
else
|
||||||
ynh_print_warn --message="Database $db_name not found"
|
ynh_print_warn --message="Database $db_name not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove mongo user if it exists
|
# Remove mongo user if it exists
|
||||||
ynh_mongo_drop_user --db_user=$db_user --db_name=$db_name
|
ynh_mongo_drop_user --db_user=$db_user --db_name=$db_name
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install MongoDB and integrate MongoDB service in YunoHost
|
# Install MongoDB and integrate MongoDB service in YunoHost
|
||||||
|
@ -304,16 +304,17 @@ ynh_mongo_remove_db() {
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_install_mongo() {
|
ynh_install_mongo() {
|
||||||
ynh_print_info --message="Installing MongoDB Community Edition..."
|
ynh_print_info --message="Installing MongoDB Community Edition..."
|
||||||
ynh_install_extra_app_dependencies --repo="$MONGO_CE_REPO" --package="$MONGO_CE_DEPENDENCIES" --key="$MONGO_CE_KEY"
|
ynh_install_extra_app_dependencies --repo="$MONGO_CE_REPO" --package="$MONGO_CE_DEPENDENCIES" --key="$MONGO_CE_KEY"
|
||||||
mongodb_servicename=$MONGO_CE_SERVICENAME
|
mongodb_servicename=$MONGO_CE_SERVICENAME
|
||||||
|
|
||||||
# Make sure MongoDB is started and enabled
|
# Make sure MongoDB is started and enabled
|
||||||
systemctl is-enabled $mongodb_servicename -q || systemctl enable $mongodb_servicename --quiet
|
systemctl enable $mongodb_servicename --quiet
|
||||||
systemctl is-active $mongodb_servicename -q || ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
|
systemctl daemon-reload --quiet
|
||||||
|
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
|
||||||
# Integrate MongoDB service in YunoHost
|
|
||||||
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
|
# Integrate MongoDB service in YunoHost
|
||||||
|
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove MongoDB
|
# Remove MongoDB
|
||||||
|
@ -324,13 +325,14 @@ ynh_install_mongo() {
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
ynh_remove_mongo() {
|
ynh_remove_mongo() {
|
||||||
# Only remove the mongodb service if it is not installed.
|
# Only remove the mongodb service if it is not installed.
|
||||||
if ! ynh_package_is_installed --package="mongodb*"
|
if ! ynh_package_is_installed --package="mongodb*"
|
||||||
then
|
then
|
||||||
ynh_print_info --message="Removing MongoDB service..."
|
ynh_print_info --message="Removing MongoDB service..."
|
||||||
mongodb_servicename=$MONGO_CE_SERVICENAME
|
mongodb_servicename=$MONGO_CE_SERVICENAME
|
||||||
# Remove the mongodb service
|
# Remove the mongodb service
|
||||||
yunohost service remove $mongodb_servicename
|
yunohost service remove $mongodb_servicename
|
||||||
# ynh_secure_remove --file=$MONGO_ROOT_PWD_FILE
|
ynh_secure_remove --file="/var/lib/mongodb"
|
||||||
fi
|
ynh_secure_remove --file="/var/log/mongodb"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue