diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 7ce2f3c..6274d07 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -63,7 +63,7 @@ echo "Handling asset at $asset_url" # Here we base the source file name upon a unique keyword in the assets url (admin vs. update) # Leave $src empty to ignore the asset case $asset_url in - *".tar.gz"*) + *".tar.gz") src="app" ;; esac @@ -117,9 +117,6 @@ done # GENERIC FINALIZATION #================================================= -# Install moreutils, needed for sponge -sudo apt-get install moreutils - # Replace new version in manifest echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json diff --git a/README.md b/README.md index 06842b6..9a5dcea 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # CryptPad for YunoHost -[![Integration level](https://dash.yunohost.org/integration/cryptpad.svg)](https://dash.yunohost.org/appci/app/cryptpad) ![](https://ci-apps.yunohost.org/ci/badges/cryptpad.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/cryptpad.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/cryptpad.svg)](https://dash.yunohost.org/appci/app/cryptpad) ![Working status](https://ci-apps.yunohost.org/ci/badges/cryptpad.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/cryptpad.maintain.svg) [![Install CryptPad with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=cryptpad) *[Lire ce readme en français.](./README_fr.md)* @@ -17,13 +17,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in CryptPad is a collaboration suite that is end-to-end-encrypted and open-source. It is built to enable collaboration, synchronizing changes to documents in real time. Because all data is encrypted, the service and its administrators have no way of seeing the content being edited and stored. -**Shipped version:** 4.12.0~ynh1 +**Shipped version:** 4.12.0~ynh2 **Demo:** https://cryptpad.fr/ ## Screenshots -![](./doc/screenshots/screenshot.png) +![Screenshot of CryptPad](./doc/screenshots/screenshot.png) ## Disclaimers / important information @@ -39,23 +39,26 @@ adminKeys: [ ], ``` +3. Restart CryptPad service (In YunoHost webadmin -> Services -> cryptpad -> Restart) + ## Documentation and resources -* Official app website: https://cryptpad.fr/ -* Official admin documentation: https://docs.cryptpad.fr/en/ -* Upstream app code repository: https://github.com/xwiki-labs/cryptpad -* YunoHost documentation for this app: https://yunohost.org/app_cryptpad -* Report a bug: https://github.com/YunoHost-Apps/cryptpad_ynh/issues +* Official app website: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/cryptpad_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/cryptpad_ynh/tree/testing --debug or sudo yunohost app upgrade cryptpad -u https://github.com/YunoHost-Apps/cryptpad_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 28272bc..f7532c0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # CryptPad pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/cryptpad.svg)](https://dash.yunohost.org/appci/app/cryptpad) ![](https://ci-apps.yunohost.org/ci/badges/cryptpad.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/cryptpad.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/cryptpad.svg)](https://dash.yunohost.org/appci/app/cryptpad) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/cryptpad.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/cryptpad.maintain.svg) [![Installer CryptPad avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=cryptpad) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer CryptPad rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -13,13 +17,13 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour CryptPad est une suite de collaboration chiffrée de bout en bout et open source. Il est conçu pour permettre la collaboration, en synchronisant les modifications apportées aux documents en temps réel. Étant donné que toutes les données sont chiffrées, le service et ses administrateurs n'ont aucun moyen de voir le contenu modifié et stocké. -**Version incluse :** 4.12.0~ynh1 +**Version incluse :** 4.12.0~ynh2 **Démo :** https://cryptpad.fr/ ## Captures d'écran -![](./doc/screenshots/screenshot.png) +![Capture d'écran de CryptPad](./doc/screenshots/screenshot.png) ## Avertissements / informations importantes @@ -35,23 +39,26 @@ adminKeys: [ ], ``` +3. Redémarrer le service CryptPad (Dans webadmin YunoHost -> Services -> cryptpad -> Redémarrer) + ## Documentations et ressources -* Site officiel de l'app : https://cryptpad.fr/ -* Documentation officielle de l'admin : https://docs.cryptpad.fr/en/ -* Dépôt de code officiel de l'app : https://github.com/xwiki-labs/cryptpad -* Documentation YunoHost pour cette app : https://yunohost.org/app_cryptpad -* Signaler un bug : https://github.com/YunoHost-Apps/cryptpad_ynh/issues +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/cryptpad_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/cryptpad_ynh/tree/testing --debug ou sudo yunohost app upgrade cryptpad -u https://github.com/YunoHost-Apps/cryptpad_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index 6493356..86b0fb0 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,8 @@ -;; Nom du test - auto_remove=1 +;; Test complet ; Manifest domain="domain.tld" + is_public=1 admin="john" - is_public="1" ; Checks pkg_linter=1 setup_sub_dir=0 @@ -13,9 +12,10 @@ setup_public=1 upgrade=1 #4.10.0 - upgrade=1 from_commit=2a54cd03f90c93b07150a64644ffc7f208110a18 + upgrade=1 from_commit=2a54cd03f90c93b07150a64644ffc7f208110a18 backup_restore=1 multi_instance=0 + port_already_use=0 change_url=1 ;;; Options Email= diff --git a/conf/app.src b/conf/app.src index 70ad03b..b4fdbbf 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,4 @@ SOURCE_SUM=e529b484c297f73227f991971189c51f64da1ab53fc78334d1fb08e320d4385e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=cryptpad.tar.gz +SOURCE_FILENAME=cryptpad.tar.gz \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 6f67957..c46b37c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,23 +1,19 @@ -location ^~ / { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + proxy_pass http://127.0.0.1:__PORT__; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; - proxy_pass http://127.0.0.1:__PORT__; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; - more_clear_input_headers 'Accept-Encoding'; + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; + more_clear_input_headers 'Accept-Encoding'; } diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index bdc64b0..ea2cf42 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -9,3 +9,5 @@ adminKeys: [ "[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]", ], ``` + +3. Restart CryptPad service (In YunoHost webadmin -> Services -> cryptpad -> Restart) diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index ca9d712..6f6fe40 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -9,3 +9,5 @@ adminKeys: [ "[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]", ], ``` + +3. Redémarrer le service CryptPad (Dans webadmin YunoHost -> Services -> cryptpad -> Redémarrer) diff --git a/manifest.json b/manifest.json index dc4451c..c89aa0a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Zero Knowledge realtime collaborative editor", "fr": "Éditeur chiffré collaboratif en temps réel" }, - "version": "4.12.0~ynh1", + "version": "4.12.0~ynh2", "url": "https://cryptpad.fr/", "upstream": { "license": "AGPL-3.0-only", @@ -22,7 +22,7 @@ "url": "https://frju365.yunohost.support" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [ @@ -38,10 +38,6 @@ "fr": "CryptPad doit être installé dans un domaine ou sous-domaine dédié." } }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -50,6 +46,10 @@ "fr": "Si cette case est cochée, CryptPad sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/backup b/scripts/backup index c6c42c3..d72c557 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -22,11 +23,12 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index 4dff8ab..f1d87e1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,17 +30,18 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=2 # 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 + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -69,7 +70,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="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF @@ -107,7 +108,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server available" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="server available" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 23c4c4d..77ad500 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,7 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,7 +10,7 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE FAILURE OF THE SCRIPT +# MANAGE SCRIPT FAILURE #================================================= ynh_clean_setup () { @@ -24,20 +24,20 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -is_public=$YNH_APP_ARG_IS_PUBLIC path_url="/" +is_public=$YNH_APP_ARG_IS_PUBLIC admin=$YNH_APP_ARG_ADMIN email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME #================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +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 @@ -45,9 +45,10 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path_url --value=$path_url +ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= @@ -66,11 +67,10 @@ porti=$(ynh_find_port --port=$(($port + 1))) ynh_app_setting_set --app=$app --key=porti --value=$porti #================================================= -# INSTALL NODEJS & YARN +# INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing dependencies..." --weight=20 -# Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -102,23 +102,25 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." + +ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js" + +chmod 600 "$final_path/config/config.js" +chown $app "$final_path/config/config.js" + #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - +env_path="$PATH" +# Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# CONFIGURE CONFIG.JS -#================================================= - -ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js" -chmod 600 "$final_path/config/config.js" -chown $app "$final_path/config/config.js" - #================================================= # INSTALL CRYPTPAD #================================================= @@ -131,6 +133,8 @@ pushd "$final_path" ynh_exec_warn_less bower install --allow-root popd +#================================================= +# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -144,7 +148,7 @@ yunohost service add $app --description="Zero Knowledge realtime collaborative e ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="server available" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="server available" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index a9e6f33..e201fda 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,7 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -16,8 +16,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -port=$(ynh_app_setting_get --app=$app --key=port) 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) #================================================= @@ -29,7 +29,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # 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..." --weight=3 + ynh_script_progression --message="Removing $app service integration..." --weight=3 yunohost service remove $app fi @@ -41,17 +41,10 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NODEJS -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=3 - -ynh_remove_nodejs - #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing $app main directory..." --weight=3 +ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -64,6 +57,13 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=3 + +ynh_remove_nodejs + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index ad1593c..81c92b5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -44,6 +44,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -58,11 +59,10 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring CryptPad main directory..." --weight=6 +ynh_script_progression --message="Restoring the app main directory..." --weight=6 ynh_restore_file --origin_path="$final_path" -# Restore permissions on app files chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -73,7 +73,7 @@ chmod 600 "$final_path/config/config.js" #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -# Install Nodejs +# Define and install dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -96,7 +96,7 @@ yunohost service add $app --description="Zero Knowledge realtime collaborative e #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server available" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="server available" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 0cafe05..7b46a12 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,7 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -17,9 +17,9 @@ 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_url) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +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) email=$(ynh_user_get_info --username=$admin --key=mail) port=$(ynh_app_setting_get --app=$app --key=port) porti=$(ynh_app_setting_get --app=$app --key=porti) @@ -27,9 +27,34 @@ porti=$(ynh_app_setting_get --app=$app --key=porti) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." 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=1 + +# 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 +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -48,29 +73,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # 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 -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -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 #================================================= @@ -104,19 +106,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - ynh_add_nginx_config #================================================= -# INSTALL NODEJS +# UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=6 -# Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# CONFIGURE CONFIG.JS -#================================================= - -#ynh_add_config --template="../conf/config.js" --destination="$final_path/config/config.js" - #================================================= # INSTALL CRYPTPAD #================================================= @@ -134,11 +129,12 @@ popd #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - +env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -151,7 +147,7 @@ yunohost service add $app --description="Zero Knowledge realtime collaborative e #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server available" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="server available" #================================================= # RELOAD NGINX