diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index d451c61..0000000 --- a/manifest.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "Monica", - "id": "monica", - "packaging_format": 1, - "description": { - "en": "Personal Relationship Manager", - "fr": "Gestionnaire de relations personnelles" - }, - "version": "4.0.0~ynh1", - "url": "https://monicahq.com", - "upstream": { - "license": "GPL-3.0", - "website": "https://monicahq.com", - "code": "https://github.com/monicahq/monica", - "cpe": "cpe:2.3:a:monicahq:monica" - }, - "license": "GPL-3.0", - "maintainer": { - "name": "Sebastian Gumprich", - "email": "yunohost@gumpri.ch", - "url": "http://github.com/rndmh3ro/monica_ynh" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - "nginx", - "php8.1-fpm", - "mysql" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/monica", - "default": "/monica" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "language", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": [ - "cs", - "de", - "en", - "es", - "fr", - "he", - "it", - "nl", - "pt", - "ru", - "zh" - ], - "default": "en" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 9d3887c..30e0f09 100644 --- a/manifest.toml +++ b/manifest.toml @@ -13,26 +13,22 @@ maintainers = ["Sebastian Gumprich"] license = "GPL-3.0" website = "https://monicahq.com" code = "https://github.com/monicahq/monica" -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.0.9" -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.15" +architectures = "all" 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 = "/monica" @@ -48,11 +44,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "en" [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] @@ -60,17 +54,19 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen url = "https://github.com/monicahq/monica/archive/v4.0.0.zip" sha256 = "5b108525a2f5fedc0a2bb82a49d3de47d087b33082fb21e64f874d387304ed9f" - [resources.system_user] [resources.install_dir] [resources.permissions] main.url = "/" - [[resources.apt.extras]] - repo = "deb https://dl.yarnpkg.com/debian/ stable main" - key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - packages = "yarn" + + [resources.apt] + packages = "mariadb-server php8.1-bcmath php8.1-cli php8.1-curl php8.1-dom php8.1-gd php8.1-gmp php8.1-iconv php8.1-intl php8.1-mbstring php8.1-mysql php8.1-mysqli php8.1-opcache php8.1-redis php8.1-xml php8.1-zip" + + extras.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.packages = "yarn" [resources.database] type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index dc60261..a99fcb7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,10 +8,7 @@ YNH_COMPOSER_VERSION="2.5.1" -#REMOVEME? php_dependencies="php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-iconv php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip" -# dependencies used by the app (must be on a single line) -#REMOVEME? pkg_dependencies="$php_dependencies" NODEJS_VERSION=18 diff --git a/scripts/backup b/scripts/backup index 0960f89..35afc88 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,28 +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) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index 66e9462..ffe543d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,65 +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=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -# Add settings here as needed by your application -#REMOVEME? #db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#REMOVEME? #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # 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 #================================================= @@ -77,50 +18,15 @@ 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 #================================================= -# ... -#================================================= # Run monica update pushd "$install_dir" /usr/bin/php$phpversion artisan monica:update --force popd -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 318e11e..a1f6e33 100755 --- a/scripts/install +++ b/scripts/install @@ -9,52 +9,20 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# 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? language=$YNH_APP_ARG_LANGUAGE -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -#REMOVEME? password=$YNH_APP_ARG_PASSWORD - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - random_key=$(ynh_string_random --length=32) email=$(ynh_user_get_info --username=$admin --key="mail") fpm_footprint="low" fpm_free_footprint=0 fpm_usage="low" -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#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=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -ynh_app_setting_set --app=$app --key=language --value=$language -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=random_key --value=$random_key ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint @@ -65,40 +33,18 @@ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=1 -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -#REMOVEME? 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=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1 - -#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_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -#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" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -107,9 +53,7 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 -# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION @@ -163,7 +107,7 @@ pushd "$install_dir" ynh_replace_string --match_string="mobile_key" --replace_string="$mobile_key" --target_file="$install_dir/.env" ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key -#REMOVEME? ynh_secure_remove --file="$install_dir/key.txt" + ynh_secure_remove --file="$install_dir/key.txt" ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan config:cache popd @@ -185,28 +129,6 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# 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=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 5840401..1c16c0b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,36 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? 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? 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 -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1 - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -58,11 +28,10 @@ ynh_remove_fpm_config #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_nodejs -#REMOVEME? ynh_remove_app_dependencies #================================================= # SPECIFIC REMOVE @@ -74,16 +43,6 @@ ynh_script_progression --message="Removing various files..." --weight=1 # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" -#================================================= -# 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 050adfb..39643a4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,51 +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_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? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) - -#================================================= -# 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" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -62,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -71,12 +25,10 @@ chown -R $app:www-data "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -#REMOVEME? 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 PHP-FPM CONFIGURATION @@ -98,10 +50,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b74e414..8345464 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,25 +12,8 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? 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? language=$(ynh_app_setting_get --app=$app --key=language) -#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=mysqlpwd) -#REMOVEME? random_key=$(ynh_app_setting_get --app=$app --key=random_key) email=$(ynh_user_get_info --username=$admin --key=mail) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) #================================================= # CHECK VERSION @@ -38,22 +21,6 @@ email=$(ynh_user_get_info --username=$admin --key=mail) upgrade_type=$(ynh_check_app_version_changed) -#REMOVEME? previous_version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # 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 #================================================= @@ -79,21 +46,6 @@ if [ -z "$fpm_usage" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage 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 - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -106,18 +58,15 @@ then ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=1 -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # PHP-FPM CONFIGURATION @@ -126,7 +75,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION @@ -141,9 +89,9 @@ ynh_add_nginx_config #================================================= # UPDATE PHP DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Updating php dependencies..." +ynh_script_progression --message="Updating php dependencies..." -#REMOVEME? ynh_secure_remove --file="$install_dir/vendor" +ynh_secure_remove --file="$install_dir/vendor" ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir" chmod 750 "$install_dir" @@ -174,8 +122,8 @@ pushd "$install_dir" popd if [ -f $install_dir/storage/oauth-private.key ]; then -#REMOVEME? mobile_id=$(ynh_app_setting_get --app=$app --key=mobile_id) -#REMOVEME? mobile_key=$(ynh_app_setting_get --app=$app --key=mobile_key) + mobile_id=$(ynh_app_setting_get --app=$app --key=mobile_id) + mobile_key=$(ynh_app_setting_get --app=$app --key=mobile_key) ynh_replace_string --match_string="mobile_id" --replace_string="$mobile_id" --target_file="$install_dir/.env" ynh_replace_string --match_string="mobile_key" --replace_string="$mobile_key" --target_file="$install_dir/.env" else @@ -188,7 +136,7 @@ else ynh_replace_string --match_string="mobile_key" --replace_string="$mobile_key" --target_file="$install_dir/.env" ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key -#REMOVEME? ynh_secure_remove --file="$install_dir/key.txt" + ynh_secure_remove --file="$install_dir/key.txt" popd fi pushd "$install_dir" @@ -210,15 +158,6 @@ chown $app:$app "$install_dir/.env" update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} -#================================================= -# GENERIC FINALIZATION -#================================================= -# 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..cbbeef1 --- /dev/null +++ b/tests.toml @@ -0,0 +1,3 @@ +test_format = 1.0 + +[default]