1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/overleaf_ynh.git synced 2024-09-03 19:56:27 +02:00

Merge pull request #28 from YunoHost-Apps/mongo

Mongo
This commit is contained in:
Thomas 2024-05-16 13:41:36 +02:00 committed by GitHub
commit fe4fa4cdd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 212 additions and 206 deletions

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
nodejs_version=18.20.2 nodejs_version="18.20.2"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
@ -14,7 +14,7 @@ nodejs_version=18.20.2
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
readonly YNH_DEFAULT_MONGO_VERSION=5.0 readonly YNH_DEFAULT_MONGO_VERSION=6.0
# Declare the actual MongoDB version to use: 4.4; 5.0; 6.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. # 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} YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
@ -103,7 +103,7 @@ ynh_mongo_exec() {
database="" database=""
fi fi
mongo --quiet $user $password $authenticationdatabase $host $port <<EOF mongosh --quiet --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port <<EOF
$database $database
${command} ${command}
quit() quit()
@ -117,7 +117,7 @@ EOF
database="" database=""
fi fi
mongo --quiet $database $user $password $authenticationdatabase $host $port --eval="$command" mongosh --quiet $database --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port --eval="$command"
fi fi
} }
@ -326,19 +326,23 @@ ynh_install_mongo() {
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
mongo_version="${mongo_version:-$YNH_MONGO_VERSION}" mongo_version="${mongo_version:-$YNH_MONGO_VERSION}"
debian=$(lsb_release --codename --short)
ynh_print_info --message="Installing MongoDB Community Edition..." ynh_print_info --message="Installing MongoDB Community Edition..."
local mongo_debian_release=bullseye #$(ynh_get_debian_release) local mongo_debian_release=$(ynh_get_debian_release)
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then if [ "$mongo_debian_release" == buster ] ; then
ynh_print_warn --message="Installing Mongo 4.4 as $mongo_version is not compatible with your CPU (see https://docs.mongodb.com/manual/administration/production-notes/#x86_64)." ubuntu_version="bionic"
mongo_version="4.4" elif [ "$mongo_debian_release" == bullseye ] ; then
fi ubuntu_version="focal"
if [[ "$mongo_version" == "4.4" && "$mongo_debian_release" != "buster" ]]; then elif [ "$mongo_debian_release" == bookworm ] ; then
ynh_print_warn --message="Switched to Buster install as Mongo 4.4 is not compatible with $mongo_debian_release." ubuntu_version="jammy"
mongo_debian_release=buster
fi 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-server mongodb-org-shell mongodb-database-tools" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc" ynh_install_extra_app_dependencies \
--repo="deb https://repo.mongodb.org/apt/ubuntu $ubuntu_version/mongodb-org/$mongo_version multiverse" \
--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 mongodb_servicename=mongod
# Make sure MongoDB is started and enabled # Make sure MongoDB is started and enabled
@ -374,6 +378,7 @@ ynh_remove_mongo() {
fi fi
} }
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -3,3 +3,4 @@ test_format = 1.0
[default] [default]
test_upgrade_from.c5e7ec1.name = "Overleaf 4.x" test_upgrade_from.c5e7ec1.name = "Overleaf 4.x"
test_upgrade_from.405228e.name = "2024-04-09"