diff --git a/scripts/install b/scripts/install index 6644b6b..35dc36f 100644 --- a/scripts/install +++ b/scripts/install @@ -52,19 +52,10 @@ ynh_setup_source --dest_dir="$install_dir" mkdir "/tmp/ufs" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" chown -R $app:$app "/tmp/ufs" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=3 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # SPECIFIC SETUP #================================================= @@ -82,6 +73,21 @@ if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep - ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval fi +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config + +# Create a dedicated systemd config +ynh_add_systemd_config + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate +yunohost service add $app --description="Team collaboration communication platform" + #============================================== # INSTALL ROCKETCHAT #============================================== @@ -92,31 +98,6 @@ pushd $install_dir/programs/server ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --unsafe-perm popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Team collaboration communication platform" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 64bf733..99d5c9a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -30,22 +30,22 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate +if [ -d "/tmp/ufs" ]; then + ynh_secure_remove --file="/tmp/ufs" +fi + +# Remove the dedicated NGINX config +ynh_remove_nginx_config + +# Remove metapackage and its dependencies +ynh_remove_nodejs + #================================================= # REMOVE THE MONGODB DATABASE #================================================= @@ -60,30 +60,6 @@ ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mo # Remove a database if it exists, along with the associated user ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=2 - -if [ -d "/tmp/ufs" ]; then - ynh_secure_remove --file="/tmp/ufs" -fi - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -# Remove the dedicated NGINX config -ynh_remove_nginx_config - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=4 - -# Remove metapackage and its dependencies -ynh_remove_nodejs ynh_remove_mongo #================================================= diff --git a/scripts/restore b/scripts/restore index 2500648..30680e7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 -db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) @@ -26,7 +25,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -41,13 +39,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=40 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE MONGODB DATABASE #================================================= @@ -77,21 +68,13 @@ fi #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Team collaboration communication platform" #================================================= @@ -101,13 +84,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=19 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="SERVER RUNNING" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index aff0c07..bfc0a40 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,7 +58,6 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -70,14 +69,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=7 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # SPECIFIC UPGRADE #================================================= @@ -110,24 +101,15 @@ popd #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 +# Create a dedicated NGINX config +ynh_add_nginx_config + # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Team collaboration communication platform" #=================================================