1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/turtl_ynh.git synced 2024-09-03 20:26:35 +02:00
This commit is contained in:
ericgaspar 2021-11-25 12:29:03 +01:00
parent 6fb114b790
commit 3e96f22ace
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 31 additions and 54 deletions

View file

@ -42,7 +42,7 @@ sync:
max_bulk_sync_records: 32 max_bulk_sync_records: 32
plugins: 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` # 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 # below would be a plugin at /var/www/turtl/server/plugins/email (see the
# example-plugins/ folder for an email plugin you can use) # example-plugins/ folder for an email plugin you can use)
@ -54,7 +54,7 @@ plugins:
uploads: uploads:
# if set to a path, files will be uploaded to the local filesystem instead of # if set to a path, files will be uploaded to the local filesystem instead of
# S3. otherwise, set to false # 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. # 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, # this avoids needing to set up any CORS config in your favorite webserver,
# but may slightly affect performance on high-demand servers. # but may slightly affect performance on high-demand servers.
@ -64,7 +64,7 @@ uploads:
url: 'http://api.turtl.dev/uploads' url: 'http://api.turtl.dev/uploads'
s3: s3:
token: 'IHADAPETSNAKEBUTHEDIEDNOOOOO' token: ''
secret: '' secret: ''
bucket: '' bucket: ''
endpoint: 'https://s3.amazonaws.com' endpoint: 'https://s3.amazonaws.com'

View file

@ -43,6 +43,11 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -119,6 +119,20 @@ pushd $final_path
ynh_exec_as $app env $ynh_node_load_PATH npm install --unsafe-perm 2>/dev/null ynh_exec_as $app env $ynh_node_load_PATH npm install --unsafe-perm 2>/dev/null
popd 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 # ADD A CONFIGURATION
#================================================= #=================================================

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # 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 app=$YNH_APP_INSTANCE_NAME
@ -38,7 +38,7 @@ fi
#================================================= #=================================================
# STOP AND REMOVE SERVICE # 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 # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
@ -46,7 +46,7 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # 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 # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
@ -62,7 +62,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --time --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
@ -70,7 +70,7 @@ ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # 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 # Remove the app directory securely
ynh_secure_remove --file="$final_path" 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 # Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ] if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then 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" ynh_secure_remove --file="$datadir"
fi fi
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # 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 # Remove the dedicated NGINX config
ynh_remove_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 # GENERIC FINALIZATION
#================================================= #=================================================
# REMOVE DEDICATED USER # 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 # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app
@ -150,4 +108,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --time --last ynh_script_progression --message="Removal of $app completed" --last