1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/prometheus_ynh.git synced 2024-09-03 20:16:01 +02:00
prometheus_ynh/scripts/upgrade

69 lines
2.3 KiB
Text
Raw Normal View History

2021-05-18 18:17:45 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="prometheus.yml"
2021-05-18 18:17:45 +02:00
fi
2024-01-03 22:02:22 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-05-18 18:17:45 +02:00
#=================================================
2024-01-03 22:02:22 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
2021-05-18 18:17:45 +02:00
#=================================================
2024-01-03 22:02:22 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
2021-05-18 18:17:45 +02:00
ynh_add_nginx_config
ynh_add_systemd_config
2024-01-03 22:02:22 +01:00
yunohost service add $app --description="Prometheus daemon" --log="systemd"
2021-05-18 18:17:45 +02:00
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
2024-01-03 22:02:22 +01:00
ynh_use_logrotate --non-append --logfile="$install_dir/.data/logs"
2021-05-18 18:17:45 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-01-03 22:02:22 +01:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2021-05-18 18:17:45 +02:00
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Prometheus daemon" --timeout=30
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last