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.
69 lines
2.2 KiB
Bash
69 lines
2.2 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
#=================================================
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
|
|
|
#=================================================
|
|
# BACKUP THE APP MAIN DIR
|
|
#=================================================
|
|
|
|
ynh_backup --src_path="$install_dir"
|
|
|
|
#=================================================
|
|
# BACKUP THE NGINX CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.d"
|
|
|
|
#=================================================
|
|
# BACKUP THE PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
|
|
if [ $phpversion != "none" ]
|
|
then
|
|
ynh_backup --src_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf"
|
|
fi
|
|
|
|
#=================================================
|
|
# BACKUP THE NodeJS CONFIGURATION
|
|
#=================================================
|
|
|
|
if [ $nodeversion != "none" ]
|
|
then
|
|
ynh_backup --src_path="/etc/systemd/system/${app}-nodejs.service"
|
|
ynh_backup --src_path="/etc/systemd/system/${app}-nodejs-watcher.service"
|
|
ynh_backup --src_path="/etc/systemd/system/${app}-nodejs-watcher.path"
|
|
fi
|
|
|
|
#=================================================
|
|
# BACKUP THE MYSQL DATABASE
|
|
#=================================================
|
|
|
|
if [ $database != "none" ]
|
|
then
|
|
ynh_print_info --message="Backing up the database..."
|
|
|
|
if [ $database == "mysql" ]; then
|
|
ynh_mysql_dump_db --database="$db_name" > db.sql*
|
|
elif [ $database == "postgresql" ]; then
|
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
|
fi
|
|
fi
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|