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

Merge pull request #80 from YunoHost-Apps/upgrade

Upgrade to 0.7.1~ynh1
This commit is contained in:
yalh76 2022-01-22 15:44:39 +01:00 committed by GitHub
commit 911c242215
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 73 additions and 68 deletions

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Federated blogging engine, based on ActivityPub. It uses the Rocket framework, and Diesel to interact with the database.
**Shipped version:** 0.6.0~ynh3
**Shipped version:** 0.7.1~ynh1
**Demo:** https://joinplu.me/#instances

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Federated blogging engine, based on ActivityPub. It uses the Rocket framework, and Diesel to interact with the database.
**Version incluse :** 0.6.0~ynh3
**Version incluse :** 0.7.1~ynh1
**Démo :** https://joinplu.me/#instances

View file

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

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.6.0/plume-postgres.tar.gz
SOURCE_SUM=faca15f1b036929fd9c0a5cff29dbf12eb559500ee25052ba716138c5b93e63f
SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.7.1/plume-postgres.tar.gz
SOURCE_SUM=be694c3a42fc82c724dcc00c11084b9681dfcd8eb2262102c31a9080d1ce66b3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false

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_SUM=c821052f0d7c6cbb2d4eeffd143fb36b3add30b57c4bfc442d6604bd43e2f1b2
SOURCE_URL=https://github.com/YunoHost-Apps/plume_ynh/releases/download/0.7.1/plume-arm64-postgres.tar.gz
SOURCE_SUM=872d074c492e43d391f0f932e921adc0916ed58bd6388aaa591c966ce962f8be
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false

View file

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

View file

@ -6,7 +6,7 @@
"en": "Federated blogging application",
"fr": "Application de blogging fédérée"
},
"version": "0.6.0~ynh3",
"version": "0.7.1~ynh1",
"url": "https://joinplu.me/",
"upstream": {
"license": "AGPL-3.0-only",
@ -27,7 +27,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -63,7 +63,7 @@
"fr": "Les inscriptions sont-elles ouvertes à tout le monde ?"
},
"default": false
}
}
]
}
}

View file

@ -90,7 +90,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring 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

View file

@ -43,6 +43,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated 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
#=================================================
@ -51,24 +59,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
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
#=================================================
@ -86,12 +76,22 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
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
ynh_remove_logrotate
# 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
#=================================================
# 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..."
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
@ -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..."
# 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
@ -104,6 +105,13 @@ ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
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
#=================================================
@ -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"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -30,9 +30,34 @@ architecture=$YNH_ARCH
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
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
#=================================================
@ -65,37 +90,13 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $port
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
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# 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
@ -148,7 +149,7 @@ chown -R "$app":"$app" "/var/log/$app"
#=================================================
# 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"