mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Fixing mongodb service name
This commit is contained in:
parent
2875a93925
commit
7f5ecfb75b
5 changed files with 16 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
[Unit]
|
||||
Description=Wekan, task board
|
||||
Wants=mongodb.service
|
||||
After=network.target
|
||||
Wants=__MOGODB_SERVICENAME__.service
|
||||
After=network.target __MOGODB_SERVICENAME__.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
# dependencies used by the app
|
||||
pkg_dependencies="mongodb mongodb-server mongo-tools"
|
||||
pkg_dependencies_buster="mongodb-org mongodb-org-server mongodb-org-tools"
|
||||
mongodb_stretch="mongodb"
|
||||
mongodb_buster="mongod"
|
||||
nodejsversion=12.15.0
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -81,8 +81,10 @@ ynh_use_nodejs
|
|||
|
||||
if [ "$(lsb_release --codename --short)" = "buster" ]; then
|
||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" --package="$pkg_dependencies_buster" --key="https://www.mongodb.org/static/pgp/server-4.2.asc"
|
||||
mongodb_servicename=$mongodb_buster
|
||||
else
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
mongodb_servicename=$mongodb_stretch
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -91,8 +93,8 @@ fi
|
|||
ynh_print_info --message="Creating a MongoDB database..."
|
||||
|
||||
# Start mongodb
|
||||
systemctl enable mongodb
|
||||
systemctl start mongodb
|
||||
systemctl enable $mongodb_servicename
|
||||
systemctl start $mongodb_servicename
|
||||
|
||||
# Registering db name
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -132,6 +134,7 @@ ynh_print_info --message="Configuring a systemd service..."
|
|||
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__MOGODB_SERVICENAME__" --replace_string="$mongodb_servicename" --target_file="../conf/systemd.service"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -89,8 +89,10 @@ ynh_use_nodejs
|
|||
|
||||
if [ "$(lsb_release --codename --short)" = "buster" ]; then
|
||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" --package="$pkg_dependencies_buster" --key="https://www.mongodb.org/static/pgp/server-4.2.asc"
|
||||
mongodb_servicename=$mongodb_buster
|
||||
else
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
mongodb_servicename=$mongodb_stretch
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -99,8 +101,8 @@ fi
|
|||
ynh_print_info --message="Restoring the MongoDB database..."
|
||||
|
||||
# Start mongodb
|
||||
systemctl enable mongodb
|
||||
systemctl start mongodb
|
||||
systemctl enable $mongodb_servicename
|
||||
systemctl start $mongodb_servicename
|
||||
mongorestore --db $db_name ./dump/$db_name
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -166,8 +166,10 @@ ynh_use_nodejs
|
|||
|
||||
if [ "$(lsb_release --codename --short)" = "buster" ]; then
|
||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" --package="$pkg_dependencies_buster" --key="https://www.mongodb.org/static/pgp/server-4.2.asc"
|
||||
mongodb_servicename=$mongodb_buster
|
||||
else
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
mongodb_servicename=$mongodb_stretch
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -201,6 +203,7 @@ ynh_print_info --message="Upgrading systemd configuration..."
|
|||
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__MOGODB_SERVICENAME__" --replace_string="$mongodb_servicename" --target_file="../conf/systemd.service"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue