Skip to content

Commit

Permalink
Merge pull request #81 from YunoHost-Apps/testing
Browse files Browse the repository at this point in the history
Upgrade to 0.7.1~ynh1
  • Loading branch information
yalh76 authored Jan 23, 2022
2 parents 23a2dc3 + 911c242 commit 655ae34
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions check_process
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions conf/amd64.src
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions conf/arm64.src
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion conf/systemd.service
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -27,7 +27,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
Expand Down Expand Up @@ -63,7 +63,7 @@
"fr": "Les inscriptions sont-elles ouvertes à tout le monde ?"
},
"default": false
}
}
]
}
}
2 changes: 1 addition & 1 deletion scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 22 additions & 22 deletions scripts/remove
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,20 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config

#=================================================
# REMOVE THE POSTGRESQL DATABASE
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..."
ynh_script_progression --message="Removing logrotate configuration..."

# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
# Remove the app-specific logrotate config
ynh_remove_logrotate

#=================================================
# REMOVE DEPENDENCIES
# REMOVE THE POSTGRESQL DATABASE
#=================================================
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
ynh_script_progression --message="Removing the PostgreSQL database..."

if [ -d "/usr/local/lib/rustlib" ]; then
sudo /usr/local/lib/rustlib/uninstall.sh
fi
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name

#=================================================
# REMOVE APP MAIN DIR
Expand All @@ -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
Expand Down
19 changes: 10 additions & 9 deletions scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
#=================================================
Expand All @@ -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
#=================================================
Expand Down
53 changes: 27 additions & 26 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -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
#=================================================
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 655ae34

Please sign in to comment.