From 68d377b25479cd87b5272ea5f54bde1ff435289a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:55:47 +0200 Subject: [PATCH] v2 --- check_process | 29 ----------------- conf/.env | 4 +-- conf/nginx.conf | 4 ++- manifest.json | 70 ---------------------------------------- manifest.toml | 36 ++++++++++----------- scripts/_common.sh | 3 -- scripts/backup | 28 ---------------- scripts/change_url | 80 ++-------------------------------------------- scripts/install | 40 +---------------------- scripts/remove | 73 ------------------------------------------ scripts/upgrade | 77 ++------------------------------------------ tests.toml | 10 ++++++ 12 files changed, 38 insertions(+), 416 deletions(-) delete mode 100644 check_process delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 2a8972b..0000000 --- a/check_process +++ /dev/null @@ -1,29 +0,0 @@ -;; Test complet - ; pre-install - sudo yunohost domain add dex.domain.tld - sudo yunohost domain add minio.domain.tld - ; Manifest - domain="domain.tld" - is_public=1 - language="fr" - dex_domain="dex.domain.tld" - dex_path="/example" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - #upgrade=1 from_commit=f56cd7d - backup_restore=1 - multi_instance=0 - change_url=0 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=f56cd7d - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/.env b/conf/.env index 00a44b7..3a73e8f 100644 --- a/conf/.env +++ b/conf/.env @@ -10,7 +10,7 @@ UTILS_SECRET=__UTILS_SECRET__ # For production point these at your databases, in development the default # should work out of the box. -DATABASE_URL=postgres://__DB_NAME__:__SECRET_KEY__@localhost:5432/__DB_NAME__ +DATABASE_URL=postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__ DATABASE_URL_TEST=postgres://user:pass@localhost:5532/outline-test # Uncomment this to disable SSL for connecting to Postgres PGSSLMODE=disable @@ -93,4 +93,4 @@ SMTP_SECURE='false' # The default interface language. See translate.getoutline.com for a list of # available language codes and their rough percentage translated. -DEFAULT_LANGUAGE=__LANGUAGE_KEY__ \ No newline at end of file +DEFAULT_LANGUAGE=__LANGUAGE__ diff --git a/conf/nginx.conf b/conf/nginx.conf index f9373a8..45b333f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,6 @@ -location / { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { + proxy_pass http://127.0.0.1:__PORT__; proxy_redirect off; proxy_set_header Host $host; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index e0ae787..0000000 --- a/manifest.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "Outline", - "id": "outline", - "packaging_format": 1, - "description": { - "en": "Wiki and knowledge base for teams", - "fr": "Wiki et base de connaissances pour les équipes" - }, - "version": "0.72.1~ynh1", - "url": "www.getoutline.com", - "upstream": { - "license": "BUSL-1.1", - "website": "https://www.getoutline.com", - "demo": "https://app.getoutline.com/create", - "admindoc": "https://www.getoutline.com/developers", - "userdoc": "https://www.getoutline.com/about", - "code": "https://github.com/outline/outline" - }, - "license": "BUSL-1.1", - "maintainer": { - "name": "Raoul de Limezy" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "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": ["fr", "en"], - "default": "en" - }, - { - "name": "dex_domain", - "type": "domain", - "ask": { - "en": "Domain for authentication. It can't be the same domain as above. Dex app will be installed and used for the authentication mechanism.", - "fr": "Domaine pour l'authentification. Il ne peut pas s'agir du même domaine que ci-dessus. L'application Dex sera installée et utilisée pour le mécanisme d'authentification." - } - }, - { - "name": "dex_path", - "type": "path", - "default": "/", - "ask": { - "en": "Path for authentication URL. Please don't use 'auth' as it will break NGINX configuration.", - "fr": "Chemin de l'URL d'authentification. Veuillez ne pas utiliser 'auth' car cela casserait la configuration NGINX." - } - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 43a79af..3c6e02a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,24 +16,20 @@ demo = "https://app.getoutline.com/create" admindoc = "https://www.getoutline.com/developers" userdoc = "https://www.getoutline.com/about" code = "https://github.com/outline/outline" -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.2" +architectures = "all" multi_instance = false -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.init_main_permission] type = "group" @@ -42,9 +38,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [install.language] ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" - type = "string" - choices = ["fr", "en"] - default = "en" + type = "select" + choices = ["fr_FR", "en_US"] + default = "en_US" [install.dex_domain] ask.en = "Domain for authentication. It can't be the same domain as above. Dex app will be installed and used for the authentication mechanism." @@ -62,17 +58,19 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen url = "https://github.com/outline/outline/archive/ebeb201a9f48e2c6b619a0d152e051946849aa10.zip" sha256 = "7f7afaff1c12a197583871659f7d08355586a4727133e903a63fd5def1bfbcd2" - [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 2>&1" - packages = "yarn" + + [resources.apt] + packages = "postgresql" + + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.yarn.packages = "yarn" [resources.database] type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index cd2d226..3f31ef3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="postgresql" - NODEJS_VERSION=18 #================================================= diff --git a/scripts/backup b/scripts/backup index e205675..3115901 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,31 +10,11 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - 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? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) -#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) #REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) #REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) #REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) @@ -51,11 +31,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP LOCAL STORAGE #================================================= @@ -112,9 +87,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Backing up the PostgreSQL database..." -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - ynh_psql_dump_db --database="$db_name" > db.sql #================================================= diff --git a/scripts/change_url b/scripts/change_url index 888c4e7..7842d35 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,31 +9,11 @@ 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) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) -#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) #REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) #REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) #REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) @@ -45,39 +25,6 @@ source /usr/share/yunohost/helpers #REMOVEME? dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) #REMOVEME? dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) -#================================================= -# 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 - ynh_die "Outline has to be installed on the root of a domain" -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -85,7 +32,7 @@ fi #================================================= 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" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -94,25 +41,9 @@ 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 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 - #================================================= # UPDATING A CONFIGURATION #================================================= -#REMOVEME? -domain=$new_domain - -#REMOVEME? ynh_secure_remove --file="$install_dir/.env" ynh_script_progression --message="Updating the configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" @@ -137,14 +68,7 @@ popd #================================================= 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? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # SLACK WARNING diff --git a/scripts/install b/scripts/install index 959942f..cbba3a2 100755 --- a/scripts/install +++ b/scripts/install @@ -9,36 +9,10 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# 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? language=$YNH_APP_ARG_LANGUAGE - -if [ $language == "fr" ]; then - language_key="fr_FR" - echo "French" -else - language_key="en_US" - echo "English" -fi - -secret_key=$(ynh_hex_32_random) utils_secret=$(ynh_hex_32_random) #REMOVEME? app=$YNH_APP_INSTANCE_NAME @@ -74,17 +48,6 @@ else dex_user_uri="https://$dex_domain$dex_path/userinfo" fi -#=================================================== -# 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 #================================================= @@ -93,7 +56,6 @@ fi #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 -ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_app_setting_set --app=$app --key=utils_secret --value=$utils_secret ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app @@ -254,7 +216,7 @@ yunohost service add $app --description="Outline server" --log="/var/log/$app/$a 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" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 19650e2..6d22c0b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,15 +14,6 @@ source /usr/share/yunohost/helpers #================================================= #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -#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? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) -#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) #REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) #REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) #REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) @@ -47,88 +38,24 @@ 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 LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # 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_name --db_name=$db_name - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies ynh_remove_nodejs -#================================================= -# 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 DEX APP -#================================================= -ynh_script_progression --message="Removing Dex app used for Outline auth..." --weight=1 - yunohost app remove $dex_app -#================================================= -# REMOVE LOCAL STORAGE -#================================================= -ynh_script_progression --message="Removing Outline local storage..." --weight=1 ynh_secure_remove --file="/var/lib/outline" -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -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/upgrade b/scripts/upgrade index 1b7049f..e3a2c06 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,15 +14,6 @@ source /usr/share/yunohost/helpers #================================================= #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -#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? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) -#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) #REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) #REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) #REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) @@ -40,23 +31,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=1 - -# Ugly fix for an early mistake - to be removed with next upgrade -#REMOVEME? ynh_secure_remove --file="$install_dir/outlinestorage" - -# 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 #================================================= @@ -64,15 +38,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= 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" - -#================================================= -# 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" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -83,13 +49,9 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -#REMOVEME? ynh_secure_remove --file="$install_dir" ynh_setup_source --dest_dir="$install_dir" fi -ynh_script_progression --message="Done" --weight=1 - -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -127,18 +89,8 @@ 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..." --weight=1 - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 - -# Install Yarn -#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" 2>&1 +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION #================================================= # UPGRADE YARN DEPENDENCIES @@ -183,30 +135,14 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# UPDATE THE CRON JOB -#================================================= - cron_path="/etc/cron.d/$app" ynh_add_config --template="../conf/outline.cron" --destination="$cron_path" chown root: "$cron_path" chmod 644 "$cron_path" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" #================================================= @@ -214,14 +150,7 @@ yunohost service add $app --description="Outline server" --log="/var/log/$app/$a #================================================= 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 +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..f9fa6df --- /dev/null +++ b/tests.toml @@ -0,0 +1,10 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.dex_domain="dex.domain.tld" + args.dex_path="/example" \ No newline at end of file