From 30fb8bb387edfdafb2038d69accb16819fea8e35 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:34:35 +0100 Subject: [PATCH] Update restore --- scripts/restore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/restore b/scripts/restore index 0db3f83..6d3402c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,6 +30,22 @@ db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name +#================================================= +# SPECIFIC SETUP +#================================================= +# CONFIGURE MONGOD +#================================================= +ynh_script_progression --message="Configuring MongoDB..." --weight=10 + +ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file="/etc/mongod.conf" + +ynh_exec_warn_less systemctl enable mongod --quiet +ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections" + +if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then + ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +fi + #================================================= # STANDARD RESTORATION STEPS #=================================================