mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
Update _common.sh
This commit is contained in:
parent
51d81dc311
commit
4ea137b286
1 changed files with 21 additions and 9 deletions
|
@ -20,7 +20,7 @@ pkg_dependencies="apt-transport-https build-essential gzip curl fontconfig graph
|
|||
#=================================================
|
||||
|
||||
readonly YNH_DEFAULT_MONGO_VERSION=4.4
|
||||
# Declare the actual MongoDB version to use: 4.4 ; 5.0
|
||||
# Declare the actual MongoDB version to use: 4.4 ; 5.0 ; 6.0
|
||||
# A packager willing to use another version of MongoDB can override the variable into its _common.sh.
|
||||
YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
|
||||
|
||||
|
@ -331,14 +331,26 @@ ynh_install_mongo() {
|
|||
ynh_handle_getopts_args "$@"
|
||||
mongo_version="${mongo_version:-$YNH_MONGO_VERSION}"
|
||||
|
||||
ynh_print_info --message="Installing MongoDB Community Edition..."
|
||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/$mongo_version main" --package="mongodb-org mongodb-org-server mongodb-org-tools mongodb-mongosh" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
|
||||
ynh_print_info --message="Installing MongoDB Community Edition ..."
|
||||
# Install the version that works with the host cpu (see https://docs.mongodb.com/manual/administration/production-notes/#x86_64)
|
||||
local mongo_debian_release=$(ynh_get_debian_release)
|
||||
|
||||
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then
|
||||
ynh_print_error --message="The version of Mongo you're trying to install may not be compatible with your cpu (Missing avx instruction set)."
|
||||
fi
|
||||
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" == "4.4" ]]; then
|
||||
ynh_print_warn --message="Installing Mongo for Buster due to incompatible cpu."
|
||||
mongo_debian_release=buster
|
||||
fi
|
||||
|
||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/mongodb-org/$mongo_version main" --package="mongodb-org mongodb-org-server mongodb-org-tools mongodb-mongosh" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
|
||||
mongodb_servicename=mongod
|
||||
|
||||
# Make sure MongoDB is started and enabled
|
||||
systemctl enable $mongodb_servicename --quiet
|
||||
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"
|
||||
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="systemd" --length=100 --timeout=60
|
||||
|
||||
# Integrate MongoDB service in YunoHost
|
||||
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
|
||||
|
|
Loading…
Add table
Reference in a new issue