diff --git a/manifest.toml b/manifest.toml index 5b6604f..d8c4867 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,41 +16,35 @@ demo = "https://cloud.rocket.chat/trial" admindoc = "https://docs.rocket.chat/" userdoc = "https://docs.rocket.chat/guides/user-guides" code = "https://github.com/RocketChat/Rocket.Chat" -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 = ">> 11.1.7" -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"] +architectures = ["amd64"] 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 = false +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" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/rocketchat" [install.init_main_permission] - help.en = "You must activate public site if you want to connect a Mobile or desktop client to Rocket.Chat. This can be changed later via the webadmin." - help.fr = "Vous devez activer site public si vous souhaitez connecter un client mobile ou desktop à Rocket.Chat. Vous pourrez changer ceci plus tard via la webadmin." + help.en = "You must activate 'Visitors' if you want to connect a Mobile or desktop client to Rocket.Chat. This can be changed later via the webadmin." + help.fr = "Vous devez activer 'Visiteurs' si vous souhaitez connecter un client mobile ou desktop à Rocket.Chat. Vous pourrez changer ceci plus tard via la webadmin." 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" [resources] @@ -58,8 +52,14 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.install_dir] + [resources.ports] + [resources.permissions] main.url = "/" + + [resources.apt] + packages = "apt-transport-https build-essential gzip curl fontconfig graphicsmagick" + [[resources.apt.extras]] repo = "deb https://dl.yarnpkg.com/debian/ stable main" key = "https://dl.yarnpkg.com/debian/pubkey.gpg" diff --git a/scripts/_common.sh b/scripts/_common.sh index 6a8082d..8de137a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,9 +8,6 @@ nodejs_version=14 mongo_version=5.0 -# dependencies used by the app -#REMOVEME? pkg_dependencies="apt-transport-https build-essential gzip curl fontconfig graphicsmagick" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 0f46105..79d7175 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,12 @@ 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..." +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) +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 f441582..a85a152 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,17 +21,6 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -# Add settings here as needed by your application -port=$(ynh_app_setting_get --app=$app --key=port) - #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= diff --git a/scripts/install b/scripts/install index 18b47c9..6644b6b 100644 --- a/scripts/install +++ b/scripts/install @@ -9,95 +9,37 @@ 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 -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -#REMOVEME? password=$YNH_APP_ARG_PASSWORD - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - +password=$YNH_APP_ARG_PASSWORD email=$(ynh_user_get_info --username=$admin --key=mail) -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -# Check machine architecture (in particular, we don't support ARM and 32bit machines) -if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ] || [ $YNH_ARCH == "armhf" ] || [ $YNH_ARCH == "arm64" ] -then - ynh_die --message="Sorry, but this app can only be installed on a x86, 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..." --weight=2 +ynh_script_progression --message="Storing installation settings..." --weight=2 -#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 -#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password" +ynh_app_setting_set --app=$app --key=password --value="$password" ynh_app_setting_set --app=$app --key=email --value=$email -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=3000) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=48 +ynh_script_progression --message="Installing dependencies..." --weight=48 -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A MONGODB DATABASE #================================================= ynh_script_progression --message="Creating a MongoDB database..." --weight=5 -#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 +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_mongo_setup_db --db_user=$db_user --db_name=$db_name #================================================= @@ -105,7 +47,6 @@ ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name #================================================= ynh_script_progression --message="Setting up source files..." --weight=10 -#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" @@ -183,26 +124,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=29 ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="SERVER RUNNING" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# 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..." --weight=2 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 99c00b6..64bf733 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,15 +12,10 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 -#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) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name #================================================= # STANDARD REMOVE @@ -68,10 +63,7 @@ ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=2 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" +ynh_script_progression --message="Removing app main directory..." --weight=2 if [ -d "/tmp/ufs" ]; then ynh_secure_remove --file="/tmp/ufs" @@ -88,23 +80,12 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=4 +ynh_script_progression --message="Removing dependencies..." --weight=4 # Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies ynh_remove_nodejs ynh_remove_mongo -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 1651646..2500648 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,47 +10,14 @@ 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..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 -#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? mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) #================================================= # RESTORE THE APP MAIN DIR @@ -68,13 +35,11 @@ chown -R $app:$app "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=40 +ynh_script_progression --message="Reinstalling dependencies..." --weight=40 # Define and install dependencies -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # RESTORE THE NGINX CONFIGURATION @@ -88,7 +53,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Restoring the MongoDB database..." --weight=10 -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mongo_restore_db --database="$db_name" < ./dump.bson diff --git a/scripts/upgrade b/scripts/upgrade index a8f17cd..aff0c07 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,20 +12,12 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 -#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? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) -#REMOVEME? mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +password=$(ynh_app_setting_get --app=$app --key=password) +email=$(ynh_app_setting_get --app=$app --key=email) +mongo_version=$(ynh_app_setting_get --app=$app --key=mongo_version) #================================================= # CHECK VERSION @@ -33,21 +25,6 @@ source /usr/share/yunohost/helpers 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)..." --weight=45 - -# 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 #================================================= @@ -62,33 +39,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - -# 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 - # If mongo_version doesn't exist, create it if [ -z "$mongo_version" ]; then mongo_version="$(mongod --version | grep -oP 'db version v\K.{0,3}')" ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version fi -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=4 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -97,7 +53,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=22 # Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" + ynh_secure_remove --file="$install_dir" # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" fi @@ -109,12 +65,10 @@ chown -R $app:$app "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=7 +ynh_script_progression --message="Upgrading dependencies..." --weight=7 -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_mongo --mongo_version=$mongo_version -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # NGINX CONFIGURATION @@ -183,13 +137,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=19 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="SERVER RUNNING" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#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..9358b03 --- /dev/null +++ b/tests.toml @@ -0,0 +1,10 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.78312cfb.name = "Upgrade from 4.7.2" +