1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/facilmap_ynh.git synced 2024-09-03 18:36:07 +02:00
This commit is contained in:
ericgaspar 2021-06-26 21:32:15 +02:00
parent 8f16a0cd66
commit 32354a8314
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 32 additions and 38 deletions

View file

@ -91,8 +91,9 @@ ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
#=================================================

View file

@ -51,13 +51,6 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -67,13 +60,15 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
# Restore permissions on app files
chown -R root:root $final_path
mkdir -p "$final_path/lib/node_modules/facilmap-server/cache"
chown -R facilmap:facilmap "$final_path/lib/node_modules/facilmap-server/cache"
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -85,11 +80,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=10
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# REINSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=30
ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
@ -98,8 +88,8 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
facilmap_create_db
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================

View file

@ -73,6 +73,14 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
# ynh_setup_source --dest_dir="$final_path"
#fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -88,29 +96,21 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# UPGRADE NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=40
ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
facilmap_create_user
#=================================================
# SPECIFIC UPGRADE
#=================================================
# BUILD NODE DEPENDENCIES
#=================================================
ynh_script_progression --message="Building node dependencies..." --weight=70
ynh_script_progression --message="Building node dependencies..." --weight=20
chown -R $app $final_path
pushd "$final_path"
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --prefix "$final_path" -g facilmap-server@"$facilmap_version"
popd
facilmap_install_app
#=================================================
# SETUP SYSTEMD
@ -118,14 +118,15 @@ facilmap_install_app
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
ynh_add_systemd_config
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating config files..." --weight=2
facilmap_add_config
mkdir -p "$final_path/etc"
ynh_add_config --template="../conf/config.env" --destination="$final_path/etc/facilmap.env"
#=================================================
# GENERIC FINALIZATION
@ -135,7 +136,9 @@ facilmap_add_config
ynh_script_progression --message="Setting files permissions..." --weight=1
# Set permissions on app files
facilmap_set_permissions
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SETUP LOGROTATE