mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
v0.8.5 : add log file + various stuff
This commit is contained in:
parent
40a3650a4f
commit
a34be9599e
2 changed files with 41 additions and 6 deletions
|
@ -28,39 +28,60 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if data.data_dir -%}
|
{% if data.data_dir -%}
|
||||||
ynh_backup --src_path="$install_dir"
|
#=================================================
|
||||||
{% endif %}
|
# BACKUP THE DATA DIR
|
||||||
|
#=================================================
|
||||||
{% if data.data_dir -%}
|
|
||||||
{% if data.generator_mode == 'tutorial' -%}
|
{% if data.generator_mode == 'tutorial' -%}
|
||||||
|
### Only relevant if there is a "data_dir" resource for this app
|
||||||
# The --is_big parameters ensure this folder is not included in the backup by default (taking less space), except if BACKUP_CORE_ONLY=0 is passed before the backup command. You might want to document that for your users.
|
# The --is_big parameters ensure this folder is not included in the backup by default (taking less space), except if BACKUP_CORE_ONLY=0 is passed before the backup command. You might want to document that for your users.
|
||||||
|
# TODO : there should be an option for this
|
||||||
{% endif %}
|
{% endif %}
|
||||||
ynh_backup --src_path="$data_dir" --is_big
|
ynh_backup --src_path="$data_dir" # --is_big
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SYSTEM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# 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.conf"
|
||||||
|
|
||||||
{% if data.main_technology == "php" -%}
|
{% if data.main_technology == "php" -%}
|
||||||
|
# Backup the PHP-FPM configuration
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if data.use_fail2ban -%}
|
{% if data.use_fail2ban -%}
|
||||||
|
# Backup the Fail2Ban config
|
||||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if data.use_logrotate -%}
|
{% if data.use_logrotate -%}
|
||||||
|
# Backup the logrotate configuration
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if data.main_technology not in ["php", "none"] -%}
|
{% if data.main_technology not in ["php", "none"] -%}
|
||||||
|
# Backup the systemd service unit
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
{% if data.use_cron -%}
|
{% if data.use_cron -%}
|
||||||
|
# Backup the cron configuration
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if data.generator_mode == 'tutorial' -%}
|
||||||
|
### For apps with huge logs, you might want to pass --is_big,
|
||||||
|
### and in restore script, mkdir and pass --not_mandatory to ynh_restore_file.
|
||||||
|
{% endif %}
|
||||||
|
ynh_backup --src_path="/var/log/$app/" # TODO : add an option to specify log file
|
||||||
|
|
||||||
{% if data.database != 'false' -%}
|
{% if data.database != 'false' -%}
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATABASE
|
# BACKUP THE DATABASE
|
||||||
|
|
|
@ -91,11 +91,25 @@ ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Other various files...
|
#=================================================
|
||||||
|
# RESTORE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
{% if data.use_cron -%}
|
{% if data.use_cron -%}
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if data.generator_mode == 'tutorial' -%}
|
||||||
|
### For apps with huge logs, you might want to not backup logs every time:
|
||||||
|
### The mkdir call is just here in case the log directory was not backed up.
|
||||||
|
### mkdir -p "/var/log/$app"
|
||||||
|
### chown $app:www-data "/var/log/$app"
|
||||||
|
### ynh_restore_file --src_path="/var/log/$app/" --not_mandatory
|
||||||
|
###
|
||||||
|
### For other apps, the simple way is better:
|
||||||
|
{% endif %}
|
||||||
|
ynh_restore_file --origin_path="/var/log/$app/" # TODO : add custom log file option
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue