From 7f5fad509a4c074e04e450596e617449b17a6ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:05:51 +0200 Subject: [PATCH 1/8] v2 --- conf/amd64.src | 5 -- conf/arm64.src | 5 -- conf/systemd.service | 4 +- manifest.toml | 79 +++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 16 +++---- scripts/change_url | 66 +++++++++++++------------- scripts/install | 108 +++++++++++++++++++++---------------------- scripts/remove | 34 +++++++------- scripts/restore | 48 +++++++++---------- scripts/upgrade | 82 ++++++++++++++++---------------- 11 files changed, 260 insertions(+), 189 deletions(-) delete mode 100644 conf/amd64.src delete mode 100644 conf/arm64.src create mode 100644 manifest.toml diff --git a/conf/amd64.src b/conf/amd64.src deleted file mode 100644 index 87bc748..0000000 --- a/conf/amd64.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/Plume-org/Plume/releases/download/0.7.2/plume-postgres.tar.gz -SOURCE_SUM=1a8c5a931fef25920503c9ae577b1c180ba7709e88f3d47b077ae80e2d9ea9ef -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false diff --git a/conf/arm64.src b/conf/arm64.src deleted file mode 100644 index 3eb2aa0..0000000 --- a/conf/arm64.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/plume_ynh/releases/download/0.7.2/plume-arm64-postgres.tar.gz -SOURCE_SUM=921b3b209b2f3cb352c676ecb93730aa4732e239a53f59f1ec5f128d5b28ec42 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false diff --git a/conf/systemd.service b/conf/systemd.service index 7617069..0134292 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,8 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/__APP__ -ExecStart=/bin/sh -c '__FINALPATH__/.cargo/bin/plume >> /var/log/__APP__/__APP__.log 2>&1' +WorkingDirectory=__INSTALL_DIR__/__APP__ +ExecStart=/bin/sh -c '__INSTALL_DIR__/.cargo/bin/plume >> /var/log/__APP__/__APP__.log 2>&1' TimeoutSec=30 Restart=always diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..7f8d20f --- /dev/null +++ b/manifest.toml @@ -0,0 +1,79 @@ +packaging_format = 2 + +id = "plume" +name = "Plume" +description.en = "Federated blogging application" +description.fr = "Application de blogging fédérée" + +version = "0.7.2~ynh1" + +maintainers = ["yalh76"] + +[upstream] +license = "AGPL-3.0-only" +website = "https://joinplu.me/" +demo = "https://joinplu.me/#instances" +admindoc = "https://docs.joinplu.me/" +code = "https://github.com/Plume-org/Plume" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 4.3.0" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = true +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + full_domain = true + + [install.init_main_permission] + type = "group" + default = "visitors" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + + [install.password] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "password" + + [install.name] + ask.en = "Choose a name for your Plume instance" + ask.fr = "Choisissez un nom pour votre instance Plume" + type = "string" + example = "My blog" + default = "My blog" + + [install.registration] + ask.en = "Is registrations open to everyone?" + ask.fr = "Les inscriptions sont-elles ouvertes à tout le monde ?" + type = "boolean" + default = false + +[resources] + [resources.sources.main] + in_subdir = false + arm64.url = "https://github.com/YunoHost-Apps/plume_ynh/releases/download/0.7.2/plume-arm64-postgres.tar.gz" + arm64.sha256 = "921b3b209b2f3cb352c676ecb93730aa4732e239a53f59f1ec5f128d5b28ec42" + amd64.url = "https://github.com/Plume-org/Plume/releases/download/0.7.2/plume-postgres.tar.gz" + amd64.sha256 = "1a8c5a931fef25920503c9ae577b1c180ba7709e88f3d47b077ae80e2d9ea9ef" + + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.database] + type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index c0220ac..2fd00e3 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib" +#REMOVEME? pkg_dependencies="postgresql postgresql-contrib" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 37a5e95..0247afc 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -40,7 +40,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 6712587..fecc159 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,54 +13,54 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path="/" +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path="/" -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { + #REMOVEME? ynh_clean_check_starting # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -77,28 +77,30 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --li #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the NGINX config file if [ $change_path -eq 1 ] then # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -108,7 +110,7 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." -config_file="$final_path/$app/.env" +config_file="$install_dir/$app/.env" ynh_backup_if_checksum_is_different --file=$config_file ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file=$config_file @@ -128,9 +130,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 7f5d814..ad99e4e 100755 --- a/scripts/install +++ b/scripts/install @@ -13,33 +13,33 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -admin=$YNH_APP_ARG_ADMIN -password=$YNH_APP_ARG_PASSWORD -instance_name=$YNH_APP_ARG_NAME -registration=$YNH_APP_ARG_REGISTRATION +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path="/" +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? admin=$YNH_APP_ARG_ADMIN +#REMOVEME? password=$YNH_APP_ARG_PASSWORD +#REMOVEME? instance_name=$YNH_APP_ARG_NAME +#REMOVEME? registration=$YNH_APP_ARG_REGISTRATION admin_email=$(ynh_user_get_info $admin 'mail') secret_key=$(ynh_string_random --length=32 | base64) architecture=$YNH_ARCH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." # Check machine architecture (in particular, we don't support ARM and 32bit machines) if [ $architecture == "armhf" ] @@ -47,23 +47,23 @@ then ynh_die --message="Sorry, but this app can only be installed on a 64 bits machine :(" fi -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +#REMOVEME? ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=instance --value="$instance_name" ynh_app_setting_set --app=$app --key=registration --value=$registration -ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email +#REMOVEME? ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key #================================================= @@ -71,63 +71,63 @@ ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." +#REMOVEME? ynh_script_progression --message="Finding an available port..." # Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." +#REMOVEME? ynh_script_progression --message="Installing dependencies..." -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." +#REMOVEME? ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." +#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name +#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) +#REMOVEME? db_user=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_psql_test_if_first_run +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path/$app" --source_id=$architecture +ynh_setup_source --dest_dir="$install_dir/$app" --source_id=$architecture # Create the media directory, where uploads will be stored -mkdir -p $final_path/media +mkdir -p $install_dir/media # Create the cargo directory -mkdir -p $final_path/.cargo/bin +mkdir -p $install_dir/.cargo/bin # Move binaries -mv $final_path/$app/bin/* $final_path/.cargo/bin/ -chmod +x $final_path/.cargo/bin/* +mv $install_dir/$app/bin/* $install_dir/.cargo/bin/ +chmod +x $install_dir/.cargo/bin/* # Remove empty bin directory -ynh_secure_remove --file="$final_path/$app/bin" +#REMOVEME? ynh_secure_remove --file="$install_dir/$app/bin" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION @@ -151,10 +151,10 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= ynh_script_progression --message="Adding a config file..." -ynh_add_config --template="../conf/.env" --destination="$final_path/$app/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/$app/.env" -chmod 400 "$final_path/$app/.env" -chown $app:$app "$final_path/$app/.env" +chmod 400 "$install_dir/$app/.env" +chown $app:$app "$install_dir/$app/.env" #================================================= # MAKE SETUP @@ -162,11 +162,11 @@ chown $app:$app "$final_path/$app/.env" ynh_script_progression --message="Making setup..." # Set right permissions -chown -R "$app":"$app" $final_path +chown -R "$app":"$app" $install_dir -export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" +export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" -pushd $final_path/$app +pushd $install_dir/$app sudo -u "$app" env PATH=$PATH plm migration run # Add new instance @@ -181,7 +181,7 @@ pushd $final_path/$app sudo -u "$app" env PATH=$PATH plm users new --admin -n "$admin" -N "$admin" --email "$admin_email" --password "$password" # Initialise search index - sudo -u "$app" env PATH=$PATH plm search init -p $final_path/$app + sudo -u "$app" env PATH=$PATH plm search init -p $install_dir/$app popd #================================================= @@ -219,22 +219,22 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then # Everyone can access the app. # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 5a4da68..753d7bc 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # STANDARD REMOVE @@ -54,18 +54,18 @@ ynh_remove_logrotate #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." +#REMOVEME? 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 +#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." +#REMOVEME? ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -78,14 +78,14 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." +#REMOVEME? ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies -export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" +export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" -pushd $final_path/$app +pushd $install_dir/$app sudo -u "$app" env PATH=$PATH cargo uninstall diesel_cli popd @@ -108,10 +108,10 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 5975fa8..725053b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,33 +14,33 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -54,21 +54,21 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." +#REMOVEME? 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 +#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # CREATE LOG FOLDER @@ -83,18 +83,18 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." +#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? ynh_psql_test_if_first_run +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d20aa9d..f7b3bf6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,19 +12,19 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -port=$(ynh_app_setting_get --app=$app --key=port) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) architecture=$YNH_ARCH #================================================= @@ -37,17 +37,17 @@ 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)..." +#REMOVEME? 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 () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -64,21 +64,21 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --li ynh_script_progression --message="Ensuring downward compatibility..." # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi # Fix previous database name -psql_db=$(ynh_app_setting_get --app=$app --key=psql_db) +#REMOVEME? psql_db=$(ynh_app_setting_get --app=$app --key=psql_db) if [ -n "$psql_db" ] then - db_name=$(ynh_app_setting_get --app=$app --key=psql_db) - db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name - ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=psql_db) +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_app_setting_delete --app=$app --key=psql_db ynh_app_setting_delete --app=$app --key=psqlpwd fi @@ -93,10 +93,10 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +#REMOVEME? 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 +#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -107,19 +107,19 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path/$app" --source_id=$architecture --keep="$app/.env" + ynh_setup_source --dest_dir="$install_dir/$app" --source_id=$architecture --keep="$app/.env" # Move binaries - mv $final_path/$app/bin/* $final_path/.cargo/bin/ - chmod +x $final_path/.cargo/bin/* + mv $install_dir/$app/bin/* $install_dir/.cargo/bin/ + chmod +x $install_dir/.cargo/bin/* # Remove empty bin directory - ynh_secure_remove --file="$final_path/$app/bin" +#REMOVEME? ynh_secure_remove --file="$install_dir/$app/bin" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION @@ -132,9 +132,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE @@ -151,19 +151,19 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= 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="$install_dir/$app/.env" -chmod 400 "$final_path/$app/.env" -chown $app:$app "$final_path/$app/.env" +chmod 400 "$install_dir/$app/.env" +chown $app:$app "$install_dir/$app/.env" #================================================= # MAKE SETUP #================================================= ynh_script_progression --message="Making setup..." -export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" +export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" -pushd $final_path/$app +pushd $install_dir/$app sudo -u "$app" env PATH=$PATH plm migration run popd @@ -202,9 +202,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From d074968dffedfbc2f5cf69db4dea96743cab7013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:15:43 +0200 Subject: [PATCH 2/8] v2 --- .github/workflows/updater.sh | 142 ---------------------------------- .github/workflows/updater.yml | 51 ------------ .travis.yml | 7 -- conf/nginx.conf | 3 +- conf/systemd.service | 2 +- doc/DISCLAIMER.md | 11 --- manifest.toml | 23 +++--- scripts/_common.sh | 3 - scripts/backup | 21 ----- scripts/change_url | 85 -------------------- scripts/install | 118 +--------------------------- scripts/remove | 59 +------------- scripts/restore | 83 +------------------- scripts/upgrade | 91 +--------------------- tests.toml | 10 +++ 15 files changed, 32 insertions(+), 677 deletions(-) delete mode 100644 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml delete mode 100644 .travis.yml delete mode 100644 doc/DISCLAIMER.md create mode 100644 tests.toml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 7499285..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically -# Since each app is different, maintainers can adapt its contents so as to perform -# automatic actions when a new upstream release is detected. - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -# TODO: Re-add "| select( .prerelease != true )" when Plume goes out of beta -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -admin_repo="TryGhost/Admin" -assets+=("https://github.com/TryGhost/Admin/archive/refs/tags/${version}.zip") - -# Later down the script, we assume the version has only digits and dots -# Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. -if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} -fi - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. - -count=0 - -# Let's loop over the array of assets URLs -for asset_url in ${assets[@]}; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"plume-postgres.tar.gz") - src="amd64" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=false -EOT -echo "... conf/$src.src updated" - -count=$((count+1)) - -else -echo "... asset ignored" -fi - -done - -if [ $count == 0 ]; then - echo "::warning ::None of the assets were processed." - exit 0 -fi - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 - diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index 627a436..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,51 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - /bin/bash .github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - branch: ci-auto-update-v${{ env.VERSION }} - base: testing - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - TODO: - - [ ] Add arm64 binaries - draft: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6133a24..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: python - -before_install: - - git clone https://github.com/YunoHost/package_linter /tmp/package_linter - -script: -- /tmp/package_linter/package_linter.py ./ \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index dcbc7d0..2c2f244 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,7 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_pass http://localhost:__PORT__/; + proxy_pass http://127.0.0.1:__PORT__; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/conf/systemd.service b/conf/systemd.service index 0134292..ab2d0e8 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=plume +Description=Plume After=network.target [Service] diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index a6d3793..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,11 +0,0 @@ -**Warning:** The package can take **15 to 30 minutes** to complete depending on your system configuration. **Don't intrupt the installation process while installing.** - -## Important points to read before installing -1. **Plume** is still in **pre-release** stage and undergoing heavy development, so there can be **bugs**. -1. **Plume** requires a dedicated **root domain**, eg. plume.domain.tld -1. **Plume** requires a valid **certificate** installed on the domain. YunoHost can **install a Let's Encrypt certificate** on the domain from **admin web-interface** or through **command-line**. -1. This package is **multi-instance** that means you can run **multiple Plume instances** on a **single server**. - -#### Multi-user support - -LDAP is activated but HTTP auth is not supported diff --git a/manifest.toml b/manifest.toml index 7f8d20f..fa94881 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,22 +15,19 @@ website = "https://joinplu.me/" demo = "https://joinplu.me/#instances" admindoc = "https://docs.joinplu.me/" code = "https://github.com/Plume-org/Plume" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.3.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.19" +architectures = ["amd64", "arm64"] multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = true +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true @@ -39,11 +36,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "visitors" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [install.password] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "password" [install.name] @@ -67,6 +62,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen amd64.url = "https://github.com/Plume-org/Plume/releases/download/0.7.2/plume-postgres.tar.gz" amd64.sha256 = "1a8c5a931fef25920503c9ae577b1c180ba7709e88f3d47b077ae80e2d9ea9ef" + [resources.ports] [resources.system_user] @@ -75,5 +71,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + [resources.apt] + packages = "postgresql postgresql-contrib" + [resources.database] type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 2fd00e3..944a65e 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="postgresql postgresql-contrib" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 0247afc..0f520f0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index fecc159..595509a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path="/" - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - #REMOVEME? ynh_clean_check_starting - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -79,30 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -127,13 +49,6 @@ ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index ad99e4e..0075f0d 100755 --- a/scripts/install +++ b/scripts/install @@ -9,106 +9,26 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path="/" -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -#REMOVEME? password=$YNH_APP_ARG_PASSWORD -#REMOVEME? instance_name=$YNH_APP_ARG_NAME -#REMOVEME? registration=$YNH_APP_ARG_REGISTRATION admin_email=$(ynh_user_get_info $admin 'mail') secret_key=$(ynh_string_random --length=32 | base64) -architecture=$YNH_ARCH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." - -# Check machine architecture (in particular, we don't support ARM and 32bit machines) -if [ $architecture == "armhf" ] -then - ynh_die --message="Sorry, but this app can only be installed on a 64 bits machine :(" -fi - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=instance --value="$instance_name" -ynh_app_setting_set --app=$app --key=registration --value=$registration -#REMOVEME? ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email +ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - -#================================================= -# CREATE A POSTGRESQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." - -#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? db_user=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_psql_test_if_first_run -#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/$app" --source_id=$architecture @@ -123,7 +43,7 @@ mv $install_dir/$app/bin/* $install_dir/.cargo/bin/ chmod +x $install_dir/.cargo/bin/* # Remove empty bin directory -#REMOVEME? ynh_secure_remove --file="$install_dir/$app/bin" +ynh_secure_remove --file="$install_dir/$app/bin" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -192,21 +112,9 @@ ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." - # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="$app daemon for Plume" --log="/var/log/$app/$app.log" #================================================= @@ -216,26 +124,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 753d7bc..eea6ea7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,19 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -35,53 +22,19 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -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 -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." - # Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies +ynh_script_progression --message="Removing dependencies..." export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" @@ -103,16 +56,6 @@ ynh_script_progression --message="Removing various files..." # Remove the log files ynh_secure_remove --file="/var/log/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 725053b..35603db 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,55 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -66,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -78,23 +28,11 @@ ynh_script_progression --message="Creating log folder..." mkdir -p "/var/log/$app" chown -R "$app":"$app" "/var/log/$app" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." - -# Define and install dependencies -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." +ynh_script_progression --message="Restoring the PostgreSQL database..." -#REMOVEME? ynh_psql_test_if_first_run -#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= @@ -102,21 +40,13 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= ynh_script_progression --message="Restoring the systemd configuration..." +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + 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 -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="$app daemon for Plume" --log="/var/log/$app/$app.log" #================================================= @@ -126,13 +56,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f7b3bf6..fde56ef 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,46 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -architecture=$YNH_ARCH - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -58,46 +24,6 @@ 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 -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# Fix previous database name -#REMOVEME? psql_db=$(ynh_app_setting_get --app=$app --key=psql_db) - -if [ -n "$psql_db" ] -then -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=psql_db) -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd - ynh_app_setting_delete --app=$app --key=psql_db - ynh_app_setting_delete --app=$app --key=psqlpwd -fi - -# Closing a port -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -114,10 +40,9 @@ then chmod +x $install_dir/.cargo/bin/* # Remove empty bin directory -#REMOVEME? ynh_secure_remove --file="$install_dir/$app/bin" + ynh_secure_remove --file="$install_dir/$app/bin" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -129,13 +54,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #================================================= @@ -199,13 +117,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started plume" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..cb63924 --- /dev/null +++ b/tests.toml @@ -0,0 +1,10 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.name="my blog" + args.registration=0 \ No newline at end of file From 769b8b683daa8fba238cd25a602b2ce7e068d1a7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 1 Jun 2023 20:15:50 +0000 Subject: [PATCH 3/8] Auto-update README --- README.md | 14 -------------- README_fr.md | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/README.md b/README.md index b06bfc8..bd3669d 100755 --- a/README.md +++ b/README.md @@ -27,20 +27,6 @@ Federated blogging engine, based on ActivityPub. It uses the Rocket framework, a ![Screenshot of Plume](./doc/screenshots/screenshot.png) -## Disclaimers / important information - -**Warning:** The package can take **15 to 30 minutes** to complete depending on your system configuration. **Don't intrupt the installation process while installing.** - -## Important points to read before installing -1. **Plume** is still in **pre-release** stage and undergoing heavy development, so there can be **bugs**. -1. **Plume** requires a dedicated **root domain**, eg. plume.domain.tld -1. **Plume** requires a valid **certificate** installed on the domain. YunoHost can **install a Let's Encrypt certificate** on the domain from **admin web-interface** or through **command-line**. -1. This package is **multi-instance** that means you can run **multiple Plume instances** on a **single server**. - -#### Multi-user support - -LDAP is activated but HTTP auth is not supported - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 5f4a763..987d5e9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,20 +27,6 @@ Federated blogging engine, based on ActivityPub. It uses the Rocket framework, a ![Capture d’écran de Plume](./doc/screenshots/screenshot.png) -## Avertissements / informations importantes - -**Warning:** The package can take **15 to 30 minutes** to complete depending on your system configuration. **Don't intrupt the installation process while installing.** - -## Important points to read before installing -1. **Plume** is still in **pre-release** stage and undergoing heavy development, so there can be **bugs**. -1. **Plume** requires a dedicated **root domain**, eg. plume.domain.tld -1. **Plume** requires a valid **certificate** installed on the domain. YunoHost can **install a Let's Encrypt certificate** on the domain from **admin web-interface** or through **command-line**. -1. This package is **multi-instance** that means you can run **multiple Plume instances** on a **single server**. - -#### Multi-user support - -LDAP is activated but HTTP auth is not supported - ## Documentations et ressources * Site officiel de l’app : From f55a4d64afe629b2c7ddafdf92b323b3e76cc421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:32:14 +0200 Subject: [PATCH 4/8] fix --- check_process | 48 ----------------------------------- manifest.json | 69 --------------------------------------------------- tests.toml | 8 +++++- 3 files changed, 7 insertions(+), 118 deletions(-) delete mode 100755 check_process delete mode 100755 manifest.json diff --git a/check_process b/check_process deleted file mode 100755 index db2834d..0000000 --- a/check_process +++ /dev/null @@ -1,48 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - is_public=1 - admin="john" - password="pass" - name="my blog" - registration=0 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 0.3.0-alpha-2~ynh1 - upgrade=1 from_commit=279716dff5fc79cc84ae2d7799c8094017ac028e - # 0.4.0-alpha-4~ynh1 - upgrade=1 from_commit=e99273dfb8df763ebbd41d51ee34d92776dfcbf0 - # 0.5.0~ynh1 - upgrade=1 from_commit=457f1dd7719286f28755d9561133a8e176be63c7 - # 0.6.0~ynh1 - upgrade=1 from_commit=0f9c1c6e3c151e94e5f53b1464aec732334209a3 - # 0.6.0~ynh2 - upgrade=1 from_commit=583e101b12a081c45bee50df9068e606b5983bb2 - # 0.7.1~ynh1 - upgrade=1 from_commit=655ae344f49a20eb4c335034244b547c9e56e6a0 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=279716dff5fc79cc84ae2d7799c8094017ac028e - name=0.3.0-alpha-2~ynh1 - ; commit=e99273dfb8df763ebbd41d51ee34d92776dfcbf0 - name=0.4.0-alpha-4~ynh1 - ; commit=457f1dd7719286f28755d9561133a8e176be63c7 - name=0.5.0~ynh1 - ; commit=0f9c1c6e3c151e94e5f53b1464aec732334209a3 - name=0.6.0~ynh1 - ; commit=583e101b12a081c45bee50df9068e606b5983bb2 - name=0.6.0~ynh2 - ; commit=655ae344f49a20eb4c335034244b547c9e56e6a0 - name=0.7.1~ynh1 diff --git a/manifest.json b/manifest.json deleted file mode 100755 index dd18992..0000000 --- a/manifest.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "Plume", - "id": "plume", - "packaging_format": 1, - "description": { - "en": "Federated blogging application", - "fr": "Application de blogging fédérée" - }, - "version": "0.7.2~ynh1", - "url": "https://joinplu.me/", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://joinplu.me/", - "demo": "https://joinplu.me/#instances", - "admindoc": "https://docs.joinplu.me/", - "code": "https://github.com/Plume-org/Plume" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "yalh76" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" - }, - { - "name": "name", - "type": "string", - "ask": { - "en": "Choose a name for your Plume instance", - "fr": "Choisissez un nom pour votre instance Plume" - }, - "example": "My blog", - "default": "My blog" - }, - { - "name": "registration", - "type": "boolean", - "ask": { - "en": "Is registrations open to everyone?", - "fr": "Les inscriptions sont-elles ouvertes à tout le monde ?" - }, - "default": false - } - ] - } -} diff --git a/tests.toml b/tests.toml index cb63924..27e3dbb 100644 --- a/tests.toml +++ b/tests.toml @@ -7,4 +7,10 @@ test_format = 1.0 # ------------------------------- args.name="my blog" - args.registration=0 \ No newline at end of file + args.registration=0 + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.655ae344f49a20eb4c335034244b547c9e56e6a0.name = "Upgrade from 0.7.1~ynh1" From f813a669daa7d0337d71bfd8dc392c1b48b74973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 2 Jun 2023 08:15:47 +0200 Subject: [PATCH 5/8] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 0075f0d..572d61f 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir/$app" --source_id=$architecture +ynh_setup_source --dest_dir="$install_dir/$app" # Create the media directory, where uploads will be stored mkdir -p $install_dir/media From aaca75df110f97afee9e558a52e11afea1b53c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:59:58 +0200 Subject: [PATCH 6/8] fix --- scripts/install | 4 ++-- scripts/upgrade | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 572d61f..f82c096 100755 --- a/scripts/install +++ b/scripts/install @@ -92,9 +92,9 @@ pushd $install_dir/$app # Add new instance if [ $registration -eq 1 ] then - sudo -u "$app" env PATH=$PATH plm instance new --domain "$domain" --name "$instance_name" -l 'CC-BY' + sudo -u "$app" env PATH=$PATH plm instance new --domain "$domain" --name "$name" -l 'CC-BY' else - sudo -u "$app" env PATH=$PATH plm instance new --private --domain "$domain" --name "$instance_name" -l 'CC-BY' + sudo -u "$app" env PATH=$PATH plm instance new --private --domain "$domain" --name "$name" -l 'CC-BY' fi # Add admin user diff --git a/scripts/upgrade b/scripts/upgrade index fde56ef..3879f8a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,7 +33,7 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir/$app" --source_id=$architecture --keep="$app/.env" + ynh_setup_source --dest_dir="$install_dir/$app" --keep="$app/.env" # Move binaries mv $install_dir/$app/bin/* $install_dir/.cargo/bin/ From 60e0e24e538df8209dcf78634b7fadc96ea5c76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 3 Jun 2023 14:12:26 +0200 Subject: [PATCH 7/8] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index fa94881..4d6d79a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Plume" description.en = "Federated blogging application" description.fr = "Application de blogging fédérée" -version = "0.7.2~ynh1" +version = "0.7.2~ynh2" maintainers = ["yalh76"] From 0b4f7a12ff8dc30e10cbf6d1fb3918e2a9c743dd Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 3 Jun 2023 12:12:30 +0000 Subject: [PATCH 8/8] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd3669d..041dfe3 100755 --- a/README.md +++ b/README.md @@ -19,7 +19,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.7.2~ynh1 +**Shipped version:** 0.7.2~ynh2 **Demo:** https://joinplu.me/#instances diff --git a/README_fr.md b/README_fr.md index 987d5e9..4e4fbe5 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Federated blogging engine, based on ActivityPub. It uses the Rocket framework, and Diesel to interact with the database. -**Version incluse :** 0.7.2~ynh1 +**Version incluse :** 0.7.2~ynh2 **Démo :** https://joinplu.me/#instances