mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
More fixes
This commit is contained in:
parent
dfa72bfa00
commit
5774dfafcb
6 changed files with 79 additions and 61 deletions
|
@ -348,6 +348,7 @@ ynh_remove_mongo() {
|
|||
mongodb_servicename=$MONGO_CE_SERVICENAME
|
||||
# Remove the mongodb service
|
||||
yunohost service remove $mongodb_servicename
|
||||
# ynh_secure_remove --file=$MONGO_ROOT_PWD_FILE
|
||||
ynh_secure_remove --file="/var/lib/mongodb"
|
||||
ynh_secure_remove --file="/var/log/mongodb"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -87,7 +87,7 @@ ynh_exec_warn_less ynh_install_mongo
|
|||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MONGODB DATABASE
|
||||
|
@ -122,6 +122,21 @@ ynh_add_nginx_config
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CONFIGURE MONGOD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file=$MONGO_CE_CONFIG
|
||||
|
||||
ynh_exec_warn_less systemctl enable $mongodb_servicename --quiet
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart
|
||||
|
||||
sleep 10
|
||||
|
||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
||||
|
||||
#==============================================
|
||||
# INSTALL ROCKETCHAT
|
||||
#==============================================
|
||||
|
@ -140,19 +155,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE MONGOD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=1
|
||||
|
||||
sed -i "s/^# engine:/ engine: wiredTiger/" $MONGO_CE_CONFIG
|
||||
sed -i "s/^#replication:/replication:\n replSetName: rs01/" $MONGO_CE_CONFIG
|
||||
|
||||
ynh_exec_warn_less systemctl enable $mongodb_servicename --quiet
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart
|
||||
|
||||
sleep 10
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -168,7 +170,7 @@ ynh_use_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Team collaboration communication platform" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Team collaboration communication platform"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
nh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
|
@ -42,7 +42,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
ynh_remove_systemd_config --service=$mongodb_servicename
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
|
@ -57,6 +56,15 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing the MongoDB database..."
|
||||
|
||||
ynh_mongo_exec --command="printjson(rs.remove(localhost))" --eval
|
||||
ynh_replace_string --match_string="engine: wiredTiger" --replace_string="# engine:" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="replication:" --replace_string="#replication:" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string=" replSetName: rs01" --replace_string="" --target_file=$MONGO_CE_CONFIG
|
||||
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart
|
||||
|
||||
sleep 10
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
|
@ -86,9 +94,9 @@ ynh_remove_nginx_config
|
|||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_mongo
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_mongo
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -38,7 +38,8 @@ db_user=$db_name
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -48,7 +49,7 @@ test ! -d $final_path || ynh_die --message="There is already a directory: $final
|
|||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
|
@ -94,14 +95,16 @@ ynh_mongo_restore_db --database="$db_name" < ./dump.bson
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=3
|
||||
|
||||
sed -i "s/^# engine:/ engine: wiredTiger/" $MONGO_CE_CONFIG
|
||||
sed -i "s/^#replication:/replication:\n replSetName: rs01/" $MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file=$MONGO_CE_CONFIG
|
||||
|
||||
ynh_exec_warn_less systemctl enable $mongodb_servicename --quiet
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart
|
||||
|
||||
sleep 10
|
||||
|
||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -122,7 +125,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Team collaboration communication platform" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Team collaboration communication platform"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -119,6 +119,21 @@ ynh_add_nginx_config
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# CONFIGURE MONGOD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="# engine:" --replace_string=" engine: wiredTiger" --target_file=$MONGO_CE_CONFIG
|
||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs01" --target_file=$MONGO_CE_CONFIG
|
||||
|
||||
ynh_exec_warn_less systemctl enable $mongodb_servicename --quiet
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart
|
||||
|
||||
sleep 10
|
||||
|
||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
||||
|
||||
#==============================================
|
||||
# INSTALL ROCKETCHAT
|
||||
#==============================================
|
||||
|
@ -137,19 +152,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE MONGOD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring mongod..." --weight=1
|
||||
|
||||
sed -i "s/^# engine:/ engine: wiredTiger/" $MONGO_CE_CONFIG
|
||||
sed -i "s/^#replication:/replication:\n replSetName: rs01/" $MONGO_CE_CONFIG
|
||||
|
||||
ynh_exec_warn_less systemctl enable $mongodb_servicename --quiet
|
||||
ynh_systemd_action --service_name=$mongodb_servicename --action=restart
|
||||
|
||||
sleep 10
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -165,7 +167,7 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Team collaboration communication platform" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Team collaboration communication platform"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
Loading…
Reference in a new issue