1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mongo-express_ynh.git synced 2024-09-03 19:46:04 +02:00

Merge branch 'dev' into ci-auto-update-1.0.2

This commit is contained in:
Gérard Collin 2024-01-21 13:47:30 +01:00
commit 2a8c877050
6 changed files with 31 additions and 11 deletions

View file

@ -2,4 +2,5 @@ ME_CONFIG_SITE_BASEURL=__PATH__
ME_CONFIG_BASICAUTH=false
ME_CONFIG_BASICAUTH_USERNAME=
ME_CONFIG_MONGODB_ENABLE_ADMIN=true
ME_CONFIG_SITE_SESSIONSECRET=SomeSecret6533
PORT=__PORT__

View file

@ -39,7 +39,7 @@ ram.runtime = "50M"
[install.init_main_permission]
type = "group"
default = false
default = "visitors"
[install.mongo_version]
ask.en = "Select the major version of Mongo to install or 'None' if already installed"

View file

@ -13,6 +13,11 @@ nodejs_version=16
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
_install_yarn () {
ynh_exec_as "$app" "$ynh_node_load_PATH" npm install yarn
ynh_yarn="$install_dir/node_modules/.bin/yarn"
alias ynh_yarn="$ynh_yarn"
}
#=================================================
# FUTURE OFFICIAL HELPERS

View file

@ -13,10 +13,15 @@ source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=3
ynh_script_progression --message="Installing NodeJS & Yarn..." --weight=3
ynh_install_nodejs --nodejs_version="$nodejs_version"
pushd "$install_dir"
ynh_use_nodejs
_install_yarn
popd
# Install mongo server only if asked to
if [ "$mongo_version" != "None" ]; then
ynh_script_progression --message="Installing MongoDB..." --weight=3
@ -46,12 +51,13 @@ chown "$app:$app" "$install_dir/.env"
#=================================================
# BUILD NODEJS CODE
#=================================================
ynh_script_progression --message="Building NodeJS code and dependencies..." --weight=6
ynh_script_progression --message="Building NodeJS code ..." --weight=6
# Install Nodejs dependencies
# Build using Yarn
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_yarn" install
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build
popd
#=================================================

View file

@ -22,10 +22,15 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$a
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=3
ynh_script_progression --message="Installing NodeJS & Yarn" --weight=3
ynh_install_nodejs --nodejs_version="$nodejs_version"
pushd "$install_dir"
ynh_use_nodejs
_install_yarn
popd
# Install mongo server only if asked to
if [ "$mongo_version" != "None" ]; then
ynh_script_progression --message="Installing MongoDB..." --weight=3
@ -57,10 +62,11 @@ chown "$app:$app" "$install_dir/.env"
#=================================================
ynh_script_progression --message="Building NodeJS code and dependencies..." --weight=6
# Install Nodejs dependencies
# Build using Yarn
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_yarn" install
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build
popd
#=================================================

View file

@ -314,17 +314,19 @@ ynh_install_mongo() {
ynh_print_info --message="Installing MongoDB Community Edition ..."
local mongo_debian_release=$(ynh_get_debian_release)
local mongo_packages="mongodb-org-server mongodb-database-tools mongodb-org-shell"
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; 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)."
mongo_version="4.4"
fi
if [[ "$mongo_version" == "4.4" && "$mongo_debian_release" != "buster" ]]; then
ynh_print_warn --message="Switched to buster install as Mongo 4.4 is not compatible with $mongo_debian_release."
if [[ "$mongo_version" == "4.4" ]]; then
ynh_print_warn --message="Switching to buster package install for Mongo 4.4."
mongo_debian_release=buster
mongo_packages="mongodb-org-server mongodb-database-tools mongodb-mongosh-shared-openssl11"
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"
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/mongodb-org/$mongo_version main" --package="$mongo_packages" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
mongodb_servicename=mongod
# Make sure MongoDB is started and enabled