From 3e96f22ace82956f523e0dda958b9842a715dfb9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 25 Nov 2021 12:29:03 +0100 Subject: [PATCH] Fix --- conf/config.yaml.default | 6 ++-- scripts/backup | 5 ++++ scripts/install | 14 ++++++++++ scripts/remove | 60 ++++++---------------------------------- 4 files changed, 31 insertions(+), 54 deletions(-) diff --git a/conf/config.yaml.default b/conf/config.yaml.default index 98387cc..b7ddd1d 100644 --- a/conf/config.yaml.default +++ b/conf/config.yaml.default @@ -42,7 +42,7 @@ sync: max_bulk_sync_records: 32 plugins: - plugin_location: '/var/www/turtl/server/plugins' + plugin_location: '__FINALPATH__/example-plugins' # each key here corresponds to a folder name in the plugins folder, so `email` # below would be a plugin at /var/www/turtl/server/plugins/email (see the # example-plugins/ folder for an email plugin you can use) @@ -54,7 +54,7 @@ plugins: uploads: # if set to a path, files will be uploaded to the local filesystem instead of # S3. otherwise, set to false - local: '/var/www/turtl/server/public/uploads' + local: '__DATADIR__' # if true, downloading local files will be proxied through the turtl server. # this avoids needing to set up any CORS config in your favorite webserver, # but may slightly affect performance on high-demand servers. @@ -64,7 +64,7 @@ uploads: url: 'http://api.turtl.dev/uploads' s3: - token: 'IHADAPETSNAKEBUTHEDIEDNOOOOO' + token: '' secret: '' bucket: '' endpoint: 'https://s3.amazonaws.com' diff --git a/scripts/backup b/scripts/backup index 689a744..a3c46e9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -43,6 +43,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index b28e6b5..4b4c671 100755 --- a/scripts/install +++ b/scripts/install @@ -119,6 +119,20 @@ pushd $final_path ynh_exec_as $app env $ynh_node_load_PATH npm install --unsafe-perm 2>/dev/null popd +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." --weight=2 + +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # ADD A CONFIGURATION #================================================= diff --git a/scripts/remove b/scripts/remove index 3cf25d5..0012aea 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -38,7 +38,7 @@ fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -46,7 +46,7 @@ ynh_remove_systemd_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 # Remove the app-specific logrotate config ynh_remove_logrotate @@ -62,7 +62,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=3 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -70,7 +70,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -82,66 +82,24 @@ ynh_secure_remove --file="$final_path" # Remove the data directory if --purge option is used if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then - ynh_script_progression --message="Removing app data directory..." --time --weight=1 + ynh_script_progression --message="Removing app data directory..." --weight=1 ynh_secure_remove --file="$datadir" fi #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --time --weight=1 - -# Remove the dedicated PHP-FPM config -ynh_remove_fpm_config - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --time --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Removing Fail2ban configuration..." --time --weight=1 - -# Remove the dedicated Fail2Ban config -ynh_remove_fail2ban_config - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --time --weight=1 - -# Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" - -# Remove a directory securely -ynh_secure_remove --file="/etc/$app" - -# Remove the log files -ynh_secure_remove --file="/var/log/$app" - #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -150,4 +108,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last