my_webapp_ynh/scripts/remove
Antoine Lima 9c6143df27
Add NodeJS server as an alternative to PHP
This adds:
- Two entries in the manifest:
    - A choice for the NodeJS version
    - A port (provisionned in any case due to ynh limitations, but this should not matter)
- Services and configs:
    - Systemctl configs to run the NodeJS server
    - A watcher service and path to restart NodeJS upon file update
    - A custom NGinx config because it is incompatible with the default one
- Docs:
    - More info in the description and admin

The install/remove/backup/restore have been adapted and tested.
The upgrade script is updated but not tested
The change_url script does not change

It is not possible to have both PHP and NodeJS to keep the scripts simple.
2024-03-10 14:43:30 +01:00

64 lines
2.1 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
if [ $database != "none" ]; then
ynh_script_progression --message="Removing the database..." --weight=2
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
# Remove a database if it exists, along with the associated user
if [ $database == "mysql" ]; then
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
elif [ $database == "postgresql" ]; then
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
fi
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_secure_remove --file="/etc/nginx/conf.d/$domain.d/$app.d"
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE NodeJS CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NodeJS configuration..."
yunohost service remove "${app}-nodejs"
ynh_remove_systemd_config --service="${app}-nodejs"
ynh_remove_systemd_config --service="${app}-nodejs-watcher"
ynh_secure_remove --file="/etc/systemd/system/${app}-nodejs-watcher.path"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last