From d35be6111dacf2356582adef10067ed39c6f3922 Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Fri, 24 Feb 2023 11:00:57 -0800 Subject: [PATCH 1/9] Switch to packaging v2 and upgrade to v0.58.8 Signed-off-by: John Schmidt --- check_process | 22 ---- conf/app.src | 6 +- conf/systemd.service | 7 +- doc/DISCLAIMER.md | 3 - doc/DISCLAIMER_fr.md | 3 - doc/post_install.md | 3 + doc/post_install_fr.md | 3 + manifest.json | 56 -------- manifest.toml | 68 ++++++++++ scripts/_common.sh | 3 - scripts/backup | 33 ++--- scripts/install | 292 ++++++++++++++++++++++------------------- scripts/remove | 81 +++--------- scripts/restore | 103 ++++----------- scripts/upgrade | 193 +++++++++++++-------------- tests.toml | 54 ++++++++ 16 files changed, 434 insertions(+), 496 deletions(-) delete mode 100644 check_process delete mode 100644 doc/DISCLAIMER.md delete mode 100644 doc/DISCLAIMER_fr.md create mode 100644 doc/post_install.md create mode 100644 doc/post_install_fr.md delete mode 100644 manifest.json create mode 100644 manifest.toml mode change 100755 => 100644 scripts/backup mode change 100755 => 100644 scripts/install mode change 100755 => 100644 scripts/remove mode change 100755 => 100644 scripts/restore create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 8f35af4..0000000 --- a/check_process +++ /dev/null @@ -1,22 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - is_public=1 - instance_name="MyTrillium" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 0.50.2~ynh1 - upgrade=0 from_commit=1a944e70223108bc16a28d236eca6e7efd25018e - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none diff --git a/conf/app.src b/conf/app.src index 5d7972c..a8e36f3 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/zadam/trilium/archive/refs/tags/v0.57.5.tar.gz -SOURCE_SUM=a6025d5946dbefc1ee8e8fb2517cb969680277caf041cea9ac1ec90c98a943cb +SOURCE_URL=https://github.com/zadam/trilium/archive/refs/tags/v0.58.8.tar.gz +SOURCE_SUM=a4b8d062bfacaa47bcde6356c8a5be0fe114f3f8db78c697e7f6cc4a72c03593 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=v0.57.5.tar.gz +SOURCE_FILENAME=v0.58.8.tar.gz SOURCE_EXTRACT=true diff --git a/conf/systemd.service b/conf/systemd.service index 2e1b097..b8e829c 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,12 +6,13 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -Environment=TRILIUM_DATA_DIR=__DATADIR__ +Environment=TRILIUM_DATA_DIR=__DATA_DIR__ Environment=TRILIUM_PORT=__PORT__ Environment="__YNH_NODE_LOAD_PATH__" Environment=NODE_ENV=production -WorkingDirectory=__FINALPATH__/ -ExecStart=__YNH_NODE__ __FINALPATH__/src/www +Environment=TRILIUM_ENV=dev +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/www [Install] WantedBy=multi-user.target diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index 06cde09..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,3 +0,0 @@ -## Configuration - -You will be asked to choose a username and password when you first access the app. You can configure Trillium from the settings menu of the app interface. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index f3cd78b..0000000 --- a/doc/DISCLAIMER_fr.md +++ /dev/null @@ -1,3 +0,0 @@ -## Configuration - -On vous demandera de choisir un nom d'utilisateur et mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web. diff --git a/doc/post_install.md b/doc/post_install.md new file mode 100644 index 0000000..58865bf --- /dev/null +++ b/doc/post_install.md @@ -0,0 +1,3 @@ +## Configuration + +You will be asked to choose a password when you first access the app. You can configure Trillium from the settings menu of the app interface. diff --git a/doc/post_install_fr.md b/doc/post_install_fr.md new file mode 100644 index 0000000..d7edf68 --- /dev/null +++ b/doc/post_install_fr.md @@ -0,0 +1,3 @@ +## Configuration + +On vous demandera de choisir un mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web. diff --git a/manifest.json b/manifest.json deleted file mode 100644 index bd71572..0000000 --- a/manifest.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "Trilium Notes", - "id": "trilium", - "packaging_format": 1, - "description": { - "en": "A hierarchical note taking application with focus on building large personal knowledge base", - "fr": "Une application de prise de note hiérarchique centrée sur la construction d'une large base de connaissances personnelle" - }, - "version": "0.57.5~ynh1", - "url": "https://github.com/zadam/trilium", - "upstream": { - "license": "AGPL-3.0-only", - "admindoc": "https://github.com/zadam/trilium/wiki", - "code": "https://github.com/zadam/trilium" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "Jules Bertholet", - "email": "jules.bertholet@gmail.com" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true, - "help": { - "en": "Required for sync with desktop app", - "fr": "Nécessaire pour la synchronisation avec l'application desktop" - } - }, - { - "name": "instance_name", - "type": "string", - "ask": { - "en": "Choose a unique name for this instance (optional)", - "fr": "Choisissez un nom unique pour cette instance (facultatif)" - }, - "example": "MyTrillium", - "optional": true, - "default": "" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..1d3573b --- /dev/null +++ b/manifest.toml @@ -0,0 +1,68 @@ +packaging_format = 2 + +id = "trilium" +name = "Trilium Notes" +description.en = "A hierarchical note taking application with focus on building large personal knowledge base" +description.fr = "Une application de prise de note hiérarchique centrée sur la construction d'une large base de connaissances personnelle" + +version = "0.58.8~ynh1" + +maintainers = ["Jules Bertholet"] + +[upstream] +license = "AGPL-3.0-only" +admindoc = "https://github.com/zadam/trilium/wiki" +code = "https://github.com/zadam/trilium" +cpe = "cpe:2.3:a:trilium_project:trilium" +fund = "https://github.com/sponsors/zadam" + +[integration] +yunohost = ">= 11.1.11.1" +architectures = [ "amd64" ] +multi_instance = true +ldap = false +sso = false +disk = "200M" +ram.build = "350M" +ram.runtime = "110M" + +[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] + help.en = "Required for sync with desktop app" + help.fr = "Nécessaire pour la synchronisation avec l'application desktop" + type = "group" + default = "visitors" + + [install.instance_name] + ask.en = "Choose a unique name for this instance (optional)" + ask.fr = "Choisissez un nom unique pour cette instance (facultatif)" + type = "string" + example = "MyTrillium" + optional = true + default = "" + +[resources] + + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 8095 + + [resources.apt] + packages = "libpng16-16, libpng-dev, pkg-config, autoconf, libtool, build-essential, nasm, libx11-dev, libxkbfile-dev" + + 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" diff --git a/scripts/_common.sh b/scripts/_common.sh index d508ada..b818f0f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,9 +6,6 @@ nodejs_version=16 -# dependencies used by the app -pkg_dependencies="libpng16-16 libpng-dev pkg-config autoconf libtool build-essential nasm libx11-dev libxkbfile-dev" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup old mode 100755 new mode 100644 index d8cb0be..2638ff2 --- a/scripts/backup +++ b/scripts/backup @@ -10,43 +10,28 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= 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 THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +# Only relevant if there is a "data_dir" resource for this app +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION @@ -66,4 +51,4 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." \ No newline at end of file diff --git a/scripts/install b/scripts/install old mode 100755 new mode 100644 index 473d9f3..4029d6f --- a/scripts/install +++ b/scripts/install @@ -9,98 +9,58 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= +# Install parameters are automatically saved as settings +# +# Settings are automatically loaded as bash variables +# in every app script context, therefore typically these will exist: +# - $domain +# - $path +# - $language +# ... etc +# +# Resources defined in the manifest are provisioned prior to this script +# and corresponding settings are also available, such as: +# - $install_dir +# - $port +# - $db_name +# ... -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +# +# $app is the app id (i.e. 'example' for first install, +# or 'example__2', '__3', ... for multi-instance installs) +# #================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST +# INSTALL NODEJS #================================================= +ynh_script_progression --message="Installing nodejs..." --weight=10 -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -instance_name=$YNH_APP_ARG_INSTANCE_NAME - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 - -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=instance_name --value=$instance_name - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=60 - -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_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 -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" - +# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=5 +ynh_script_progression --message="Setting up source files..." --weight=10 + +### `ynh_setup_source` is used to install an app from a zip or tar.gz file, +### downloaded from an upstream source, like a git repository. +### `ynh_setup_source` use the file conf/app.src -ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$install_dir" -grep -v electron "$final_path/package.json" > "$final_path/server-package.json" -mv "$final_path/server-package.json" "$final_path/package.json" +grep -v electron "$install_dir/package.json" > "$install_dir/server-package.json" +mv "$install_dir/server-package.json" "$install_dir/package.json" +# $install_dir will automatically be initialized with some decent +# permission by default ... however, you may need to recursively reapply +# ownership to all files such as after the ynh_setup_source step +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config +ynh_exec_as root echo ~$app #================================================= # SPECIFIC SETUP @@ -109,84 +69,150 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Installing Node.js packages ..." --weight=45 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm rebuild + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ./ + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm rebuild ./ popd #================================================= -# CREATE DATA DIRECTORY +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Creating a data directory..." +ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1 -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir +### `ynh_add_fpm_config` is used to set up a PHP config. +### You can remove it if your app doesn't use PHP. +### `ynh_add_fpm_config` will use the files conf/php-fpm.conf +### If you're not using these lines: +### - You can remove these files in conf/. +### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script +### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script +### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script +### with the reload at the end of the script. +### - And the section "PHP-FPM CONFIGURATION" in the upgrade script -mkdir -p $datadir +# Create a dedicated NGINX config using the conf/nginx.conf template +ynh_add_nginx_config -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" - -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." - -ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini" -ln -sf $final_path/config.ini $datadir/config.ini - -chmod 400 "$final_path/config.ini" -chown $app:$app "$final_path/config.ini" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +### `ynh_systemd_config` is used to configure a systemd script for an app. +### It can be used for apps that use sysvinit (with adaptation) or systemd. +### Have a look at the app to be sure this app needs a systemd script. +### `ynh_systemd_config` will use the file conf/systemd.service +### If you're not using these lines: +### - You can remove those files in conf/. +### - Remove the section "BACKUP SYSTEMD" in the backup script +### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script +### - As well as the section "RESTORE SYSTEMD" in the restore script +### - And the section "SETUP SYSTEMD" in the upgrade script # 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` integrates a service in YunoHost. It then gets +### displayed in the admin interface and through the others `yunohost service` commands. +### (N.B.: this line only makes sense if the app adds a service to the system!) +### If you're not using these lines: +### - You can remove these files in conf/. +### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script +### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script +### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script yunohost service add $app --description="Trilium Notes app" --log="systemd" +### Additional options starting with 3.8: +### +### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed +### which will then be checked by YunoHost's diagnosis system +### (N.B. DO NOT USE THIS is the port is only internal!!!) +### +### --test_status "some command" a custom command to check the status of the service +### (only relevant if 'systemctl status' doesn't do a good job) +### +### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service +### +### Re-calling 'yunohost service add' during the upgrade script is the right way +### to proceed if you later realize that you need to enable some flags that +### weren't enabled on old installs (be careful it'll override the existing +### service though so you should re-provide all relevant flags when doing so) + +### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. +### Use this helper only if there is effectively a log file for this app. +### If you're not using this helper: +### - Remove the section "BACKUP LOGROTATE" in the backup script +### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script +### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script +### - And the section "SETUP LOGROTATE" in the upgrade script + +# Create a dedicated Fail2Ban config +#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" + +#================================================= +# APP INITIAL CONFIGURATION +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +### You can add specific configuration files. +### +### Typically, put your template conf file in ../conf/your_config_file +### The template may contain strings such as __FOO__ or __FOO_BAR__, +### which will automatically be replaced by the values of $foo and $foo_bar +### +### ynh_add_config will also keep track of the config file's checksum, +### which later during upgrade may allow to automatically backup the config file +### if it's found that the file was manually modified +### +### Check the documentation of `ynh_add_config` for more info. + +ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini" +ln -sf $install_dir/config.ini $data_dir/config.ini + +# FIXME: this should be handled by the core in the future +# You may need to use chmod 600 instead of 400, +# for example if the app is expected to be able to modify its own config +chmod 400 "$install_dir/config.ini" +chown $app:$app "$install_dir/config.ini" + +### For more complex cases where you want to replace stuff using regexes, +### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) +### When doing so, you also need to manually call ynh_store_file_checksum +### +### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" +### ynh_store_file_checksum --file="$install_dir/some_config_file" + +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= + +### Use these lines only if the app installation needs to be finalized through +### web forms. We generally don't want to ask the final user, +### so we're going to use curl to automatically fill the fields and submit the +### forms. + +# Installation with curl +#ynh_script_progression --message="Finalizing installation..." --weight=1 +#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" + +#================================================= +# GENERIC FINALIZATION #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 +### `ynh_systemd_action` is used to start a systemd service for an app. +### Only needed if you have configure a systemd service +### If you're not using these lines: +### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script +### - As well as the section "START SYSTEMD SERVICE" in the restore script +### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script +### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script + # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT #================================================= - -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file diff --git a/scripts/remove b/scripts/remove old mode 100755 new mode 100644 index 3e1214b..2d8e2cf --- a/scripts/remove +++ b/scripts/remove @@ -9,87 +9,44 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +# Settings are automatically loaded as bash variables +# in every app script context, therefore typically these will exist: +# - $domain +# - $path +# - $language +# - $install_dir +# - $port +# ... -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +# For remove operations : +# - the core will deprovision every resource defined in the manifest **after** this script is ran +# this includes removing the install directory, and data directory (if --purge was used) #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=60 + +# This should be a symetric version of what happens in the install script + # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=30 yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=30 - -# Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." - ynh_secure_remove --file="$datadir" -fi - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=30 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies ynh_remove_nodejs -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file diff --git a/scripts/restore b/scripts/restore old mode 100755 new mode 100644 index 9304fe7..3e28028 --- a/scripts/restore +++ b/scripts/restore @@ -10,117 +10,58 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=20 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# $install_dir will automatically be initialized with some decent +# permission by default ... however, you may need to recursively reapply +# ownership to all files such as after the ynh_setup_source step +chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Restoring the data directory..." +ynh_script_progression --message="Restoring the data directory..." --weight=50 -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $datadir - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +# (Same as for install dir) +chown -R $app:www-data "$data_dir" #================================================= -# SPECIFIC RESTORATION +# INSTALL NODEJS #================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=40 +ynh_script_progression --message="Installing nodejs..." --weight=20 -# Define and install dependencies -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_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 +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=10 + +# This should be a symetric version of what happens in the install script ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Trilium Notes app" --log="systemd" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" - #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 + +# Typically you only have either $app or php-fpm but not both at the same time... +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" ynh_systemd_action --service_name=nginx --action=reload @@ -128,4 +69,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for $app" --last \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index c1de86b..a6c2af5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,45 +9,52 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +# Settings are automatically loaded as bash variables +# in every app script context, therefore typically these will exist: +# - $domain +# - $path +# - $language +# - $install_dir +# - $port +# ... -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -port=$(ynh_app_setting_get --app=$app --key=port) -instance_name=$(ynh_app_setting_get --app=$app --key=instance_name) - -#================================================= -# CHECK VERSION -#================================================= -ynh_script_progression --message="Checking version..." +# In the context of upgrade, +# - resources are automatically provisioned / updated / deleted (depending on existing resources) +# - a safety backup is automatically created by the core and will be restored if the upgrade fails +### This helper will compare the version of the currently installed app and the version of the upstream package. +### $upgrade_type can have 2 different values +### - UPGRADE_APP if the upstream app version has changed +### - UPGRADE_PACKAGE if only the YunoHost package has changed +### ynh_check_app_version_changed will stop the upgrade if the app is up to date. +### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +#ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 + +# +# N.B. : the followings setting migrations snippets are provided as *EXAMPLES* +# of what you may want to do in some cases (e.g. a setting was not defined on +# some legacy installs and you therefore want to initiaze stuff during upgrade) +# + +# If db_name doesn't exist, create it +#if [ -z "$db_name" ]; then +# db_name=$(ynh_sanitize_dbid --db_name=$app) +# 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 +# install_dir=/var/www/$app +# ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir +#fi + #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -56,102 +63,89 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=60 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -# If datadir doesn't exist, create it -if [ -z "$datadir" ]; then - datadir=$(ynh_app_setting_get --app=$app --key=data_path) - ynh_app_setting_set --app=$app --key=datadir --value=$datadir - ynh_app_setting_delete --app=$app --key=data_path -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - +# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD, ETC...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." + ynh_script_progression --message="Upgrading source files..." --weight=10 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="config.ini" + ynh_setup_source --dest_dir="$install_dir" --keep="config.ini" - grep -v electron "$final_path/package.json" > "$final_path/server-package.json" - mv "$final_path/server-package.json" "$final_path/package.json" + grep -v electron "$install_dir/package.json" > "$install_dir/server-package.json" + mv "$install_dir/server-package.json" "$install_dir/package.json" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# $install_dir will automatically be initialized with some decent +# permission by default ... however, you may need to recursively reapply +# ownership to all files such as after the ynh_setup_source step +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= -# UPGRADE DEPENDENCIES +# UPGRADE NODEJS #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=5 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Upgrading nodejs..." --weight=5 + ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -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 -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - -#================================================= -# SPECIFIC UPGRADE #================================================= # INSTALL NODE PACKAGES #================================================= ynh_script_progression --message="Installing Node.js packages ..." --weight=45 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm rebuild + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ./ + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm rebuild ./ popd #================================================= -# UPDATE A CONFIG FILE +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Updating a configuration file..." +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini" -ln -sf $final_path/config.ini $datadir/config.ini +# This should be a literal copypasta of what happened in the install's "System configuration" section -chmod 400 "$final_path/config.ini" -chown $app:$app "$final_path/config.ini" +ynh_add_nginx_config -#================================================= -# SETUP SYSTEMD -#================================================= -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="Trilium Notes app" --log="systemd" +#================================================= +# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS, ...) +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +### Same as during install +### +### The file will automatically be backed-up if it's found to be manually modified (because +### ynh_add_config keeps track of the file's checksum) + +ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini" +ln -sf $install_dir/config.ini $data_dir/config.ini + +# FIXME: this should be handled by the core in the future +# You may need to use chmod 600 instead of 400, +# for example if the app is expected to be able to modify its own config +chmod 400 "$install_dir/config.ini" +chown $app:$app "$install_dir/config.ini" + +### For more complex cases where you want to replace stuff using regexes, +### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) +### When doing so, you also need to manually call ynh_store_file_checksum +### +### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" +### ynh_store_file_checksum --file="$install_dir/some_config_file" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -159,15 +153,8 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..911bceb --- /dev/null +++ b/tests.toml @@ -0,0 +1,54 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + # NB: the tests to run are automatically deduced by the CI script according to the + # content of the app's manifest. The declarations below allow to customize which + # tests are ran, possibly add special test suite to test special args, or + # declare which commits to test upgrade from. + # + # You can also decide (though this is discouraged!) to ban/ignore some tests, + + #exclude = ["install.private", "install.multi"] # NB : you should NOT need this except if you really have a good reason ... + + # For special usecases, sometimes you need to setup other things on the machine + # prior to installing the app (such as installing another app) + # (Remove this key entirely if not needed) + #preinstall = """ + #sudo yunohost app install foobar + #sudo yunohost user list + #""" + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + # By default, the CI will automagically fill the 'standard' args + # such as domain, path, admin, is_public and password with relevant values + # and also install args with a "default" provided in the manifest.. + # It should only make sense to declare custom args here for args with no default values + + #args.language = "fr_FR" # NB : you should NOT need those lines unless for custom questions with no obvious/default value + #args.multisite = 0 + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.85a53b5.name = "Merge pull request #36 from YunoHost-Apps/testing" + #test_upgrade_from.00a1a6e7.args.foo = "bar" + + +# This is an additional test suite +#[some_additional_testsuite] + + # On additional tests suites, you can decide to run only specific tests + + #only = ["install.subdir"] + + #args.language = "en_GB" + #args.multisite = 1 \ No newline at end of file From 9e5f3aaf5fe4164bfe4aec2463d260ac0b87987e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 14 Feb 2023 08:10:16 +0000 Subject: [PATCH 2/9] Auto-update README --- README.md | 5 +++-- README_fr.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da9ca53..3c17f40 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # Trilium Notes for YunoHost -[![Integration level](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![Working status](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![Working status](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg) + [![Install Trilium Notes with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=trilium) *[Lire ce readme en français.](./README_fr.md)* @@ -18,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Trilium Notes is an Evernote-like hierarchical note taking application with many advanced features, focused on building a large personal knowledge base. -**Shipped version:** 0.57.5~ynh1 +**Shipped version:** 0.58.7~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 84ee0f4..89494e9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # Trilium Notes pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg) + [![Installer Trilium Notes avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=trilium) *[Read this readme in english.](./README.md)* @@ -18,7 +19,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Trilium Notes est une application de prise de note hiérarchique semblable a Evernote, avec maintes fonctions avancées, centrée sur la construction d'une large base de connaissances personnelle. -**Version incluse :** 0.57.5~ynh1 +**Version incluse :** 0.58.7~ynh1 ## Captures d'écran From 16b5faac8c230793de08734fdd2012ac9b15083b Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Sat, 25 Feb 2023 15:38:10 -0800 Subject: [PATCH 3/9] Misc. fixes from Alex Signed-off-by: John Schmidt --- doc/{post_install.md => POST_INSTALL.md} | 0 doc/{post_install_fr.md => POST_INSTALL_fr.md} | 0 manifest.toml | 4 ++-- scripts/install | 4 +--- scripts/remove | 4 ++-- 5 files changed, 5 insertions(+), 7 deletions(-) rename doc/{post_install.md => POST_INSTALL.md} (100%) rename doc/{post_install_fr.md => POST_INSTALL_fr.md} (100%) diff --git a/doc/post_install.md b/doc/POST_INSTALL.md similarity index 100% rename from doc/post_install.md rename to doc/POST_INSTALL.md diff --git a/doc/post_install_fr.md b/doc/POST_INSTALL_fr.md similarity index 100% rename from doc/post_install_fr.md rename to doc/POST_INSTALL_fr.md diff --git a/manifest.toml b/manifest.toml index 1d3573b..61db184 100644 --- a/manifest.toml +++ b/manifest.toml @@ -33,8 +33,8 @@ ram.runtime = "110M" full_domain = true [install.init_main_permission] - help.en = "Required for sync with desktop app" - help.fr = "Nécessaire pour la synchronisation avec l'application desktop" + help.en = "Enabling visitors access is required for sync with desktop app" + help.fr = "Autoriser l'accès aux visiteurs est nécessaire pour la synchronisation avec l'application desktop" type = "group" default = "visitors" diff --git a/scripts/install b/scripts/install index 4029d6f..1aa8727 100644 --- a/scripts/install +++ b/scripts/install @@ -60,8 +60,6 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -ynh_exec_as root echo ~$app - #================================================= # SPECIFIC SETUP #================================================= @@ -151,7 +149,7 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd" #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression --message="Adding a configuration file..." ### You can add specific configuration files. ### diff --git a/scripts/remove b/scripts/remove index 2d8e2cf..5f3ead0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,14 +28,14 @@ source /usr/share/yunohost/helpers # REMOVE SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=60 +ynh_script_progression --message="Removing system configurations related to $app..." # This should be a symetric version of what happens in the install script # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=30 + ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi From bd3622b532b4baf8211eefee3a3d4d4f727e21d7 Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Sat, 25 Feb 2023 15:48:16 -0800 Subject: [PATCH 4/9] Removing example_ynh boilerplate comments. Signed-off-by: John Schmidt --- scripts/install | 103 ------------------------------------------------ scripts/remove | 13 ------ scripts/upgrade | 40 ++----------------- tests.toml | 45 --------------------- 4 files changed, 3 insertions(+), 198 deletions(-) diff --git a/scripts/install b/scripts/install index 1aa8727..b791552 100644 --- a/scripts/install +++ b/scripts/install @@ -44,10 +44,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Setting up source files..." --weight=10 -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src - # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" @@ -78,72 +74,14 @@ popd #================================================= ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1 -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### with the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - # Create a dedicated NGINX config using the conf/nginx.conf template ynh_add_nginx_config -### `ynh_systemd_config` is used to configure a systemd script for an app. -### It can be used for apps that use sysvinit (with adaptation) or systemd. -### Have a look at the app to be sure this app needs a systemd script. -### `ynh_systemd_config` will use the file conf/systemd.service -### If you're not using these lines: -### - You can remove those files in conf/. -### - Remove the section "BACKUP SYSTEMD" in the backup script -### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script -### - As well as the section "RESTORE SYSTEMD" in the restore script -### - And the section "SETUP SYSTEMD" in the upgrade script - # Create a dedicated systemd config ynh_add_systemd_config -### `yunohost service add` integrates a service in YunoHost. It then gets -### displayed in the admin interface and through the others `yunohost service` commands. -### (N.B.: this line only makes sense if the app adds a service to the system!) -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script -### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script -### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script - yunohost service add $app --description="Trilium Notes app" --log="systemd" -### Additional options starting with 3.8: -### -### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed -### which will then be checked by YunoHost's diagnosis system -### (N.B. DO NOT USE THIS is the port is only internal!!!) -### -### --test_status "some command" a custom command to check the status of the service -### (only relevant if 'systemctl status' doesn't do a good job) -### -### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service -### -### Re-calling 'yunohost service add' during the upgrade script is the right way -### to proceed if you later realize that you need to enable some flags that -### weren't enabled on old installs (be careful it'll override the existing -### service though so you should re-provide all relevant flags when doing so) - -### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. -### Use this helper only if there is effectively a log file for this app. -### If you're not using this helper: -### - Remove the section "BACKUP LOGROTATE" in the backup script -### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script -### - And the section "SETUP LOGROTATE" in the upgrade script - -# Create a dedicated Fail2Ban config -#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # APP INITIAL CONFIGURATION #================================================= @@ -152,46 +90,13 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd" ynh_script_progression --message="Adding a configuration file..." ### You can add specific configuration files. -### -### Typically, put your template conf file in ../conf/your_config_file -### The template may contain strings such as __FOO__ or __FOO_BAR__, -### which will automatically be replaced by the values of $foo and $foo_bar -### -### ynh_add_config will also keep track of the config file's checksum, -### which later during upgrade may allow to automatically backup the config file -### if it's found that the file was manually modified -### -### Check the documentation of `ynh_add_config` for more info. ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini" ln -sf $install_dir/config.ini $data_dir/config.ini -# FIXME: this should be handled by the core in the future -# You may need to use chmod 600 instead of 400, -# for example if the app is expected to be able to modify its own config chmod 400 "$install_dir/config.ini" chown $app:$app "$install_dir/config.ini" -### For more complex cases where you want to replace stuff using regexes, -### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) -### When doing so, you also need to manually call ynh_store_file_checksum -### -### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" -### ynh_store_file_checksum --file="$install_dir/some_config_file" - -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= - -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. - -# Installation with curl -#ynh_script_progression --message="Finalizing installation..." --weight=1 -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" - #================================================= # GENERIC FINALIZATION #================================================= @@ -199,14 +104,6 @@ chown $app:$app "$install_dir/config.ini" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -### `ynh_systemd_action` is used to start a systemd service for an app. -### Only needed if you have configure a systemd service -### If you're not using these lines: -### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script -### - As well as the section "START SYSTEMD SERVICE" in the restore script -### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script -### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script - # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index 5f3ead0..c190d7e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,19 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -# Settings are automatically loaded as bash variables -# in every app script context, therefore typically these will exist: -# - $domain -# - $path -# - $language -# - $install_dir -# - $port -# ... - -# For remove operations : -# - the core will deprovision every resource defined in the manifest **after** this script is ran -# this includes removing the install directory, and data directory (if --purge was used) - #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a6c2af5..1fe652c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,25 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -# Settings are automatically loaded as bash variables -# in every app script context, therefore typically these will exist: -# - $domain -# - $path -# - $language -# - $install_dir -# - $port -# ... - -# In the context of upgrade, -# - resources are automatically provisioned / updated / deleted (depending on existing resources) -# - a safety backup is automatically created by the core and will be restored if the upgrade fails - -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) #================================================= @@ -58,7 +39,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=60 +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" @@ -123,33 +104,18 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd" #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 - -### Same as during install -### -### The file will automatically be backed-up if it's found to be manually modified (because -### ynh_add_config keeps track of the file's checksum) +ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini" ln -sf $install_dir/config.ini $data_dir/config.ini -# FIXME: this should be handled by the core in the future -# You may need to use chmod 600 instead of 400, -# for example if the app is expected to be able to modify its own config chmod 400 "$install_dir/config.ini" chown $app:$app "$install_dir/config.ini" -### For more complex cases where you want to replace stuff using regexes, -### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) -### When doing so, you also need to manually call ynh_store_file_checksum -### -### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" -### ynh_store_file_checksum --file="$install_dir/some_config_file" - #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" diff --git a/tests.toml b/tests.toml index 911bceb..2d4a70e 100644 --- a/tests.toml +++ b/tests.toml @@ -2,53 +2,8 @@ test_format = 1.0 [default] - # ------------ - # Tests to run - # ------------ - - # NB: the tests to run are automatically deduced by the CI script according to the - # content of the app's manifest. The declarations below allow to customize which - # tests are ran, possibly add special test suite to test special args, or - # declare which commits to test upgrade from. - # - # You can also decide (though this is discouraged!) to ban/ignore some tests, - - #exclude = ["install.private", "install.multi"] # NB : you should NOT need this except if you really have a good reason ... - - # For special usecases, sometimes you need to setup other things on the machine - # prior to installing the app (such as installing another app) - # (Remove this key entirely if not needed) - #preinstall = """ - #sudo yunohost app install foobar - #sudo yunohost user list - #""" - - # ------------------------------- - # Default args to use for install - # ------------------------------- - - # By default, the CI will automagically fill the 'standard' args - # such as domain, path, admin, is_public and password with relevant values - # and also install args with a "default" provided in the manifest.. - # It should only make sense to declare custom args here for args with no default values - - #args.language = "fr_FR" # NB : you should NOT need those lines unless for custom questions with no obvious/default value - #args.multisite = 0 - # ------------------------------- # Commits to test upgrade from # ------------------------------- test_upgrade_from.85a53b5.name = "Merge pull request #36 from YunoHost-Apps/testing" - #test_upgrade_from.00a1a6e7.args.foo = "bar" - - -# This is an additional test suite -#[some_additional_testsuite] - - # On additional tests suites, you can decide to run only specific tests - - #only = ["install.subdir"] - - #args.language = "en_GB" - #args.multisite = 1 \ No newline at end of file From 7b5f0edf761b6e6564d66804611a7419f528329a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Feb 2023 08:46:11 +0100 Subject: [PATCH 5/9] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 61db184..a228318 100644 --- a/manifest.toml +++ b/manifest.toml @@ -2,8 +2,8 @@ packaging_format = 2 id = "trilium" name = "Trilium Notes" -description.en = "A hierarchical note taking application with focus on building large personal knowledge base" -description.fr = "Une application de prise de note hiérarchique centrée sur la construction d'une large base de connaissances personnelle" +description.en = "Hierarchical note taking application with focus on building large personal knowledge base" +description.fr = "Application de prise de note hiérarchique centrée sur la construction d'une large base de connaissances personnelle" version = "0.58.8~ynh1" From 8562c3b19c78eff0a267f102f4af53303a67263c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Feb 2023 08:51:31 +0100 Subject: [PATCH 6/9] cleaning --- conf/nginx.conf | 4 ++- conf/systemd.service | 37 ++++++++++++++++++++- doc/POST_INSTALL.md | 2 -- doc/POST_INSTALL_fr.md | 1 - manifest.toml | 1 - scripts/backup | 5 --- scripts/change_url | 73 +----------------------------------------- scripts/install | 23 +------------ scripts/remove | 1 - scripts/upgrade | 26 --------------- 10 files changed, 41 insertions(+), 132 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index e37e88e..061375b 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/conf/systemd.service b/conf/systemd.service index b8e829c..e152647 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Trilium notes server +Description=Trilium: notes server After=network.target [Service] @@ -14,5 +14,40 @@ Environment=TRILIUM_ENV=dev WorkingDirectory=__INSTALL_DIR__/ ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/www + +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallArchitectures=native +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 58865bf..bc7bc57 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,3 +1 @@ -## Configuration - You will be asked to choose a password when you first access the app. You can configure Trillium from the settings menu of the app interface. diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index d7edf68..c02d007 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -1,3 +1,2 @@ -## Configuration On vous demandera de choisir un mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web. diff --git a/manifest.toml b/manifest.toml index a228318..087ef5d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -28,7 +28,6 @@ ram.runtime = "110M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true diff --git a/scripts/backup b/scripts/backup index 2638ff2..e32ebb5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,11 +15,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 THE APP MAIN DIR #================================================= diff --git a/scripts/change_url b/scripts/change_url index 6beabb0..b690f54 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -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) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=15 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -77,17 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -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 - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # GENERIC FINALISATION @@ -98,13 +34,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index b791552..f059f51 100644 --- a/scripts/install +++ b/scripts/install @@ -9,27 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -# Install parameters are automatically saved as settings -# -# Settings are automatically loaded as bash variables -# in every app script context, therefore typically these will exist: -# - $domain -# - $path -# - $language -# ... etc -# -# Resources defined in the manifest are provisioned prior to this script -# and corresponding settings are also available, such as: -# - $install_dir -# - $port -# - $db_name -# ... - -# -# $app is the app id (i.e. 'example' for first install, -# or 'example__2', '__3', ... for multi-instance installs) -# - #================================================= # INSTALL NODEJS #================================================= @@ -87,7 +66,7 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd" #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding a configuration file..." --weight=1 ### You can add specific configuration files. diff --git a/scripts/remove b/scripts/remove index c190d7e..03deb14 100644 --- a/scripts/remove +++ b/scripts/remove @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEMD SERVICE #================================================= - ynh_script_progression --message="Removing system configurations related to $app..." # This should be a symetric version of what happens in the install script diff --git a/scripts/upgrade b/scripts/upgrade index 1fe652c..fdbfef7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,31 +11,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -#ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 - -# -# N.B. : the followings setting migrations snippets are provided as *EXAMPLES* -# of what you may want to do in some cases (e.g. a setting was not defined on -# some legacy installs and you therefore want to initiaze stuff during upgrade) -# - -# If db_name doesn't exist, create it -#if [ -z "$db_name" ]; then -# db_name=$(ynh_sanitize_dbid --db_name=$app) -# 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 -# install_dir=/var/www/$app -# ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -#fi - #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -70,7 +45,6 @@ chown -R $app:www-data "$install_dir" #================================================= # UPGRADE NODEJS #================================================= - ynh_script_progression --message="Upgrading nodejs..." --weight=5 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version From bfc86f8c936c076055edfe282bb15013315ef624 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 Feb 2023 07:51:36 +0000 Subject: [PATCH 7/9] Auto-update README --- README.md | 8 +------- README_fr.md | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3c17f40..6e1c4bb 100644 --- a/README.md +++ b/README.md @@ -19,18 +19,12 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Trilium Notes is an Evernote-like hierarchical note taking application with many advanced features, focused on building a large personal knowledge base. -**Shipped version:** 0.58.7~ynh1 +**Shipped version:** 0.58.8~ynh1 ## Screenshots ![Screenshot of Trilium Notes](./doc/screenshots/screenshot.png) -## Disclaimers / important information - -## Configuration - -You will be asked to choose a username and password when you first access the app. You can configure Trillium from the settings menu of the app interface. - ## Documentation and resources * Official admin documentation: diff --git a/README_fr.md b/README_fr.md index f648108..a6ed6a2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,18 +19,12 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Trilium Notes est une application de prise de note hiérarchique semblable a Evernote, avec maintes fonctions avancées, centrée sur la construction d'une large base de connaissances personnelle. -**Version incluse :** 0.58.7~ynh1 +**Version incluse :** 0.58.8~ynh1 ## Captures d’écran ![Capture d’écran de Trilium Notes](./doc/screenshots/screenshot.png) -## Avertissements / informations importantes - -## Configuration - -On vous demandera de choisir un nom d'utilisateur et mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web. - ## Documentations et ressources * Documentation officielle de l’admin : From 9189495c8f79de20c91f1dd8c767caf4f5975217 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 Feb 2023 07:52:37 +0000 Subject: [PATCH 8/9] Auto-update README --- README.md | 8 +------- README_fr.md | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3c17f40..6e1c4bb 100644 --- a/README.md +++ b/README.md @@ -19,18 +19,12 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Trilium Notes is an Evernote-like hierarchical note taking application with many advanced features, focused on building a large personal knowledge base. -**Shipped version:** 0.58.7~ynh1 +**Shipped version:** 0.58.8~ynh1 ## Screenshots ![Screenshot of Trilium Notes](./doc/screenshots/screenshot.png) -## Disclaimers / important information - -## Configuration - -You will be asked to choose a username and password when you first access the app. You can configure Trillium from the settings menu of the app interface. - ## Documentation and resources * Official admin documentation: diff --git a/README_fr.md b/README_fr.md index f648108..a6ed6a2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,18 +19,12 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Trilium Notes est une application de prise de note hiérarchique semblable a Evernote, avec maintes fonctions avancées, centrée sur la construction d'une large base de connaissances personnelle. -**Version incluse :** 0.58.7~ynh1 +**Version incluse :** 0.58.8~ynh1 ## Captures d’écran ![Capture d’écran de Trilium Notes](./doc/screenshots/screenshot.png) -## Avertissements / informations importantes - -## Configuration - -On vous demandera de choisir un nom d'utilisateur et mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web. - ## Documentations et ressources * Documentation officielle de l’admin : From 0206878d37104b2162124afe0f69f6d74b1c6a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Feb 2023 23:22:06 +0100 Subject: [PATCH 9/9] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index e152647..616c04c 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -35,7 +35,7 @@ ProtectKernelModules=yes ProtectKernelTunables=yes LockPersonality=yes SystemCallArchitectures=native -SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation # Denying access to capabilities that should not be relevant for webapps # Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html