1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pgadmin_ynh.git synced 2024-09-03 19:56:38 +02:00
pgadmin_ynh/scripts/upgrade
2019-06-07 22:08:36 +02:00

71 lines
2.3 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
# LOAD SETTINGS
ynh_script_progression --message="Loading installation settings..."
domain=$(ynh_app_setting_get --app $app --key domain)
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
admin=$(ynh_app_setting_get --app $app --key admin)
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
ynh_backup_before_upgrade # Backup the current version of the app
ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails
}
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# Install dependance
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $dependances
# Download, check integrity, uncompress and patch the source from app.src
ynh_script_progression --message="Upgrading source files..." --weight=6
install_source
# CONFIGURE PGADMIN
ynh_script_progression --message="Configuring application..."
config_pgadmin
# Config uwsgi
ynh_add_uwsgi_service 'pgadmin_user python_version'
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# Set permission after initialisation
ynh_script_progression --message="Protecting directory"
set_permission
# Configuration de logrotate
ynh_script_progression --message="Configuring log rotation..."
ynh_use_logrotate /var/log/pgadmin --nonappend
# reload uwsgi
ynh_script_progression --message="Restarting pgadmin services..." --weight=3
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
--line_match "WSGI app 0 (mountpoint='$path_url') ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/pgadmin.log"
ynh_script_progression --message="Upgrade of $app completed" --last