1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/plume_ynh.git synced 2024-09-03 20:15:54 +02:00

upgrade to 0.7.1~ynh1

This commit is contained in:
yalh76 2022-01-21 02:01:46 +01:00
parent 0a38c5c637
commit 6b2279292c
7 changed files with 66 additions and 61 deletions

View file

@ -22,6 +22,8 @@
upgrade=1 from_commit=457f1dd7719286f28755d9561133a8e176be63c7 upgrade=1 from_commit=457f1dd7719286f28755d9561133a8e176be63c7
# 0.6.0~ynh1 # 0.6.0~ynh1
upgrade=1 from_commit=0f9c1c6e3c151e94e5f53b1464aec732334209a3 upgrade=1 from_commit=0f9c1c6e3c151e94e5f53b1464aec732334209a3
# 0.6.0~ynh2
upgrade=1 from_commit=583e101b12a081c45bee50df9068e606b5983bb2
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
@ -38,3 +40,5 @@ Notification=none
name=0.5.0~ynh1 name=0.5.0~ynh1
; commit=0f9c1c6e3c151e94e5f53b1464aec732334209a3 ; commit=0f9c1c6e3c151e94e5f53b1464aec732334209a3
name=0.6.0~ynh1 name=0.6.0~ynh1
; commit=583e101b12a081c45bee50df9068e606b5983bb2
name=0.6.0~ynh2

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/YunoHost-Apps/plume_ynh/releases/download/0.6.0/plume-arm64-postgres.tar.gz SOURCE_URL=https://github.com/YunoHost-Apps/plume_ynh/releases/download/0.7.1/plume-arm64-postgres.tar.gz
SOURCE_SUM=c821052f0d7c6cbb2d4eeffd143fb36b3add30b57c4bfc442d6604bd43e2f1b2 SOURCE_SUM=872d074c492e43d391f0f932e921adc0916ed58bd6388aaa591c966ce962f8be
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -11,7 +11,6 @@ ExecStart=/bin/sh -c '__FINALPATH__/.cargo/bin/plume >> /var/log/__APP__/__APP__
TimeoutSec=30 TimeoutSec=30
Restart=always Restart=always
# Sandboxing options to harden security # Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these # Depending on specificities of your service/app, you may need to tweak these
# .. but this should be a good baseline # .. but this should be a good baseline

View file

@ -90,7 +90,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE

View file

@ -43,6 +43,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# REMOVE THE POSTGRESQL DATABASE # REMOVE THE POSTGRESQL DATABASE
#================================================= #=================================================
@ -51,24 +59,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
pushd $final_path/$app
sudo -u "$app" env PATH=$PATH cargo uninstall diesel_cli
popd
if [ -d "/usr/local/lib/rustlib" ]; then
sudo /usr/local/lib/rustlib/uninstall.sh
fi
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -86,12 +76,22 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." ynh_script_progression --message="Removing dependencies..."
# Remove the app-specific logrotate config # Remove metapackage and its dependencies
ynh_remove_logrotate ynh_remove_app_dependencies
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
pushd $final_path/$app
sudo -u "$app" env PATH=$PATH cargo uninstall diesel_cli
popd
if [ -d "/usr/local/lib/rustlib" ]; then
sudo /usr/local/lib/rustlib/uninstall.sh
fi
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE

View file

@ -39,7 +39,8 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -56,7 +57,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -104,6 +105,13 @@ ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
@ -118,13 +126,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -30,9 +30,34 @@ architecture=$YNH_ARCH
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped plume"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -65,37 +90,13 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $port ynh_exec_warn_less yunohost firewall disallow TCP $port
fi fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped plume"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -148,7 +149,7 @@ chown -R "$app":"$app" "/var/log/$app"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a config file..." ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="../conf/.env" --destination="$final_path/$app/.env" ynh_add_config --template="../conf/.env" --destination="$final_path/$app/.env"