diff --git a/check_process b/check_process deleted file mode 100644 index 894a568..0000000 --- a/check_process +++ /dev/null @@ -1,25 +0,0 @@ -;; Test complet sans multisite - auto_remove=1 - ; Manifest - domain="domain.tld" - admin="john" - email="john@example.com" - isp_name="ARN" - isp_site="https://arn-fai.net" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=0 - upgrade=1 - # 20200630~ynh1 - #upgrade=1 from_commit=41916dc245ca37d999782cc2bc46a3a6ea9fa1c8 - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=0 -;;; Options -Email= -Notification=none diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 32bb293..0000000 --- a/manifest.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "Coin", - "id": "coin", - "packaging_format": 1, - "description": { - "en": "Member dashboard for non profit isp", - "fr": "Coin est un Outil pour un Internet Neutre" - }, - "version": "20220401~ynh1", - "url": "https://code.ffdn.org/FFDN/coin/", - "upstream": { - "license": "AGPL-3.0-or-later", - "website": "https://code.ffdn.org/FFDN/coin", - "code": "https://code.ffdn.org/ffdn/coin" - }, - "license": "AGPL-3.0-or-later", - "maintainer": { - "name": "ljf", - "email": "ljf+coin_ynh@grimaud.me", - "url": "https://www.arn-fai.net" - }, - "requirements": { - "yunohost": ">= 11.0.0" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "email", - "type": "string", - "ask": { - "en": "Choose email were send notification", - "fr": "Choisissez l'email vers lequel envoyer les notifications" - }, - "example": "admin@example.tld" - }, - { - "name": "isp_name", - "type": "string", - "ask": { - "en": "Enter your ISP name", - "fr": "Indiquez le nom de votre FAI" - }, - "example": "My ISP" - }, - { - "name": "isp_site", - "type": "string", - "ask": { - "en": "Enter the address of your ISP website", - "fr": "Saisissez l'adresse du siteweb de votre FAI" - }, - "example": "//www.exemple.tld" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index f2d0f4a..192211d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -13,27 +13,25 @@ maintainers = ["ljf"] license = "AGPL-3.0-or-later" website = "https://code.ffdn.org/FFDN/coin" code = "https://code.ffdn.org/ffdn/coin" -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.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.2" +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" - full_domain = true [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [install.email] @@ -67,5 +65,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + [resources.apt] + packages = "postgresql, gunicorn, libldap2-dev, libpq-dev, libsasl2-dev, libjpeg-dev, libxml2-dev, libxslt1-dev, libffi-dev, libpango1.0-0" + [resources.database] type = "postgresql" diff --git a/scripts/backup b/scripts/backup index 1400b1e..d487780 100644 --- 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 e3151c7..348a9f8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,64 +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) - -#================================================= -# 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 #================================================= @@ -83,36 +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 -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= @@ -123,13 +35,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# 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 d6591af..90f8724 100644 --- a/scripts/install +++ b/scripts/install @@ -10,37 +10,18 @@ source _common.sh source ynh_install_python 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 - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? export domain=$YNH_APP_ARG_DOMAIN -export path=/ -#REMOVEME? export admin=$YNH_APP_ARG_ADMIN -#REMOVEME? export email=$YNH_APP_ARG_EMAIL -#REMOVEME? export isp_name=$YNH_APP_ARG_ISP_NAME -#REMOVEME? export isp_site=$YNH_APP_ARG_ISP_SITE -is_public=1 export secret=$(ynh_string_random 24) -#REMOVEME? export app=$YNH_APP_INSTANCE_NAME - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= #REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -export install_dir=/opt/$app +#export install_dir=/opt/$app #REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path @@ -51,12 +32,9 @@ export install_dir=/opt/$app #================================================= #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 -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=email --value=$email -ynh_app_setting_set --app=$app --key=isp_name --value=$isp_name -ynh_app_setting_set --app=$app --key=isp_site --value=$isp_site +#ynh_app_setting_set --app=$app --key=email --value=$email +#ynh_app_setting_set --app=$app --key=isp_name --value=$isp_name +#ynh_app_setting_set --app=$app --key=isp_site --value=$isp_site #================================================= # STANDARD MODIFICATIONS @@ -65,39 +43,16 @@ ynh_app_setting_set --app=$app --key=isp_site --value=$isp_site #================================================= #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies ynh_install_python --python_version=$python_version -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app - -#================================================= -# CREATE A POSTGRESQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1 - -export db_name=$(ynh_sanitize_dbid --db_name=$app) -export 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 -#REMOVEME? export db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - #================================================= # 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" @@ -170,7 +125,7 @@ chown -R $app:www-data "/var/log/$app" #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/gunicorn_config.py" --destination="$install_dir/gunicorn_config.py" +ynh_add_config --template="gunicorn_config.py" --destination="$install_dir/gunicorn_config.py" chown $app:www-data "$install_dir/gunicorn_config.py" @@ -182,13 +137,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description "$app daemon" --log="/var/log/$app/$app.log" #================================================= @@ -199,26 +147,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# 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 5496d88..2e28280 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,19 +10,6 @@ source _common.sh source ynh_install_python 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? 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 #================================================= @@ -36,30 +23,9 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE POSTGRESQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1 - -# 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..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -68,35 +34,12 @@ 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..." --weight=1 - # Remove metapackage and its dependencies ynh_remove_python -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 # 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..." --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 3bbec05..d7e6837 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,52 +11,6 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_install_python 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? export app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? export domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? export path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? export install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? export db_name=$(ynh_app_setting_get --app=$app --key=db_name) -export db_user=$db_name -#REMOVEME? export admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? export email=$(ynh_app_setting_get --app=$app --key=email) -#REMOVEME? export isp_name=$(ynh_app_setting_get --app=$app --key=isp_name) -#REMOVEME? export isp_site=$(ynh_app_setting_get --app=$app --key=isp_site) -#REMOVEME? export secret=$(ynh_app_setting_get --app=$app --key=secret) - -#================================================= -# 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 - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -64,7 +18,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" @@ -73,10 +26,9 @@ 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_python --python_version=$python_version #================================================= @@ -89,17 +41,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 -#REMOVEME? export db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#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 #================================================= # PYTHON DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing more dependencies..." --weight=1 +ynh_script_progression --message="Installing more dependencies..." --weight=1 pushd "$install_dir" ynh_use_python @@ -139,13 +88,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f09a137..a0ee180 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,46 +10,12 @@ source _common.sh source ynh_install_python source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? export app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? export domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? export path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? export admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? export email=$(ynh_app_setting_get --app=$app --key=email) -#REMOVEME? export isp_name=$(ynh_app_setting_get --app=$app --key=isp_name) -#REMOVEME? export isp_site=$(ynh_app_setting_get --app=$app --key=isp_site) -#REMOVEME? export secret=$(ynh_app_setting_get --app=$app --key=secret) -#REMOVEME? export install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? export db_name=$(ynh_app_setting_get --app=$app --key=db_name) -export db_user=$db_name -#REMOVEME? export db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." --weight=1 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=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 #================================================= @@ -59,40 +25,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# 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 db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/opt/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - -ynh_secure_remove --file="${install_dir}/venv" - -#================================================= -# 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 - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -105,16 +37,14 @@ then ynh_setup_source --dest_dir="$install_dir" 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_python --python_version=$python_version #================================================= @@ -178,7 +108,7 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/gunicorn_config.py" --destination="$install_dir/gunicorn_config.py" +ynh_add_config --template="gunicorn_config.py" --destination="$install_dir/gunicorn_config.py" chown $app:www-data "$install_dir/gunicorn_config.py" @@ -190,13 +120,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description "$app daemon" --log="/var/log/$app/$app.log" #================================================= @@ -206,13 +129,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# 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..0a822c2 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + #---------------------------- + # Default args to use for install + # ------------------------------- + + args.isp_name="ARN" + args.isp_site="https://arn-fai.net" \ No newline at end of file