1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
This commit is contained in:
ericgaspar 2022-01-11 11:09:56 +01:00
parent 22868453a4
commit 81169c4e1e
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 73 additions and 16 deletions

View file

@ -3,35 +3,76 @@
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ../settings/scripts/_common.sh
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
# Copy the app source files
ynh_backup "$final_path"
ynh_backup --src_path="$final_path"
# Copy the data files
ynh_backup "$DATADIR"
#=================================================
# BACKUP THE DATA DIR
#=================================================
# Copy the conf files
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_backup "/etc/systemd/system/${app}.service"
ynh_backup --src_path="$DATADIR"
# Backup logs
ynh_backup "/var/log/$app"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
# Dump the database
ynh_mysql_dump_db "$dbname" > ./db.sql
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/log/$app"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -65,9 +65,19 @@ ynh_setup_source $final_path $architecture
# Configure gogs with app.ini file
config_gogs
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Configure init script
ynh_add_systemd_config
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Modify Nginx configuration file and copy it to Nginx conf directory
config_nginx
@ -89,3 +99,9 @@ ynh_use_logrotate "/var/log/$app"
# Reload services
#ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last