diff --git a/README.md b/README.md index d5a024c..64d2728 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,30 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -## TODO -Une description longue de ce que fait l'application +[Armadietto](https://github.com/remotestorage/armadietto/) is a [remoteStorage](https://remotestorage.io) server written for Node.js. + +Armadietto is maintained by remoteStorage Team [IRC](https://kiwiirc.com/client/irc.freenode.net/#remotestorage) + +> ### :warning: WARNING +> Please do not consider `armadietto` production ready, this project is still +> considered experimental. As with any alpha-stage storage technology, you +> MUST expect that it will eat your data and take precautions against this. You +> SHOULD expect that its APIs and storage schemas will change before it is +> labelled stable. + +**Shipped version:** 0.1.5 + +### Application for remoteStorage + +[Click here](https://remotestorage.io/apps/) to see the list of applications that can be used with RemoteStorage. ### Features - liste des caractéristiques... -**Shipped version:** 0.0.2-beta.10~ynh3 +**Shipped version:** 0.0.2~ynh6 @@ -34,22 +48,50 @@ Une description longue de ce que fait l'application ## Disclaimers / important information +### :warning: WARNING +Armadietto_ynh still in develoment: + +* Security considerations from [Armadietto](https://github.com/remotestorage/armadietto/) : + + +>### **Storage security** +> +>In production, we recommend that you restrict access to the files managed by your armadietto server as much as possible. This is particularly true if you host your storage on a machine with other web applications; you need to protect your files in the event that one of those apps is exploited. +> +>You should take these steps to keep your storage safe: +> +> - Pick a unique Unix user to run your server process; no other process on the box should run as this user: sudo useradd armadietto --system --no-create-home +> +> - Do not run other applications as root, or as any user that could access files owned by your armadietto user +> +> - Make sure the directory path/to/storage cannot be read, written or executed by anyone but this user: sudo chmod 0700 /path/to/storage && sudo chown armadietto /path/to/storage +> +> - Do not run armadietto as root; if you need to bind to port 80 or 443 use a reverse proxy like nginx, Apache2, caddy, lighttpd or enable bind capability: setcap 'cap_net_bind_service=+ep' `which armadietto` +> +> - Ideally, run your storage inside a container or on a dedicated machine + +
+ +### **Important Notes** + +- RemoteStorage requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. +- As RemoteStorage uses the full domain and is installed on the root, you can create a subdomain such as remote.domain.tld. +- Don't forget to update your DNS if you manage them manually. + +- RemoteStorage requires browser-approved SSL certificates. If you have certificates not issued by [Let's Encrypt](https://letsencrypt.org/), install them manually as usual. + ## TODO -* Toute limitation ou contrainte connue ou tout élément ne fonctionnant pas, tel que (mais non limité à) : - * nécessitant un domaine dédié complet ? - * architectures non prises en charge ? - * L'authentification unique ou l'intégration LDAP ne fonctionnent pas ? - * l'application nécessite une quantité importante de RAM / disque / ... pour s'installer ou fonctionner correctement. +* Any known limitations, constraints or non-functioning elements, such as (but not limited to) : + * Unsupported architectures? + * Single sign-on or LDAP integration not working? * etc... -* D'autres informations que les gens devraient connaître, comme.. : - * toute étape spécifique à effectuer après l'installation (comme terminer manuellement l'installation, des identifiants d'administration spécifiques, ...) - * Comment configurer / administrer l'application si ce n'est pas évident. - * le processus de mise à niveau, les spécificités, les choses à savoir ? - * Considérations de sécurité +* Other information that people should know, such as. : + * any specific steps to be performed after installation (like manually terminating the installation, specific admin credentials, ...) + * How to configure / administer the application if it is not obvious. + * Specifics, things to know? -Traduit avec www.DeepL.com/Translator (version gratuite) ## Documentation and resources * Official app website: https://remotestorage.io/ diff --git a/README_fr.md b/README_fr.md index 917c26a..2486452 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,16 +11,25 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -## TODO -Une description longue de ce que fait l'application +[Armadietto](https://github.com/remotestorage/armadietto/) est un serveur [remoteStorage](https://remotestorage.io) écrit pour Node.js. -### Features +Armadietto est maintenu par l'équipe remoteStorage [IRC](https://kiwiirc.com/client/irc.freenode.net/#remotestorage). -- liste des caractéristiques... +> ### :warning: WARNING +> Veuillez ne pas considérer `armadietto` comme prêt pour la production, ce projet est toujours +> comme expérimental. Comme avec toute technologie de stockage en phase alpha, vous +> devez vous attendre à ce qu'elle mange vos données et prendre des précautions contre cela. Vous +> Vous devez vous attendre à ce que ses API et ses schémas de stockage changent avant qu'il ne soit +> étiqueté comme stable. +**Version livrée:** 0.1.5 -**Version incluse :** 0.0.2-beta.10~ynh3 +### Application pour remoteStorage + +[Cliquez ici](https://remotestorage.io/apps/) pour voir la liste des applications qui peuvent être utilisées avec RemoteStorage. + +**Version incluse :** 0.0.2~ynh6 @@ -30,22 +39,51 @@ Une description longue de ce que fait l'application ## Avertissements / informations importantes +### :warning: WARNING +Armadietto_ynh still in develoment: + +* l'authentification unique ou l'intégration LDAP ne fonctionne pas ? +* Considérations sur la sécurité de [Armadietto](https://github.com/remotestorage/armadietto/) : + + +> ### **Sécurité du stockage** +> +> En production, nous vous recommandons de restreindre autant que possible l'accès aux fichiers gérés par votre serveur armadietto. Ceci est particulièrement vrai si vous hébergez votre stockage sur une machine avec d'autres applications web ; vous devez protéger vos fichiers dans le cas où l'une de ces applications serait exploitée. +> +> Vous devez prendre les mesures suivantes pour assurer la sécurité de votre stockage : +> +> - Choisissez un utilisateur Unix unique pour exécuter votre processus serveur ; aucun autre processus sur la machine ne doit être exécuté sous cet utilisateur : sudo useradd armadietto --system --no-create-home +> +> - Ne lancez pas d'autres applications en tant que root, ou en tant qu'utilisateur qui pourrait accéder à des fichiers appartenant à votre utilisateur armadietto. +> +> - Assurez-vous que le répertoire path/to/storage ne peut être lu, écrit ou exécuté par personne d'autre que cet utilisateur : sudo chmod 0700 /path/to/storage && sudo chown armadietto /path/to/storage +> +> - Ne lancez pas armadietto en tant que root ; si vous avez besoin de vous lier au port 80 ou 443, utilisez un reverse proxy comme nginx, Apache2, caddy, lighttpd ou activez la capacité de liaison : setcap 'cap_net_bind_service=+ep' `which armadietto`. +> +> - Idéalement, exécutez votre stockage dans un conteneur ou sur une machine dédiée. + +
+ +### **Notes importantes** + +- RemoteStorage nécessite un domaine dédié, il faut donc en obtenir un et l'ajouter en utilisant le panneau d'administration de YunoHost. **Domaines -> Ajouter un domaine**. +- Comme RemoteStorage utilise le domaine complet et est installé à la racine, vous pouvez créer un sous-domaine tel que remote.domain.tld. +- N'oubliez pas de mettre à jour vos DNS si vous les gérez manuellement. + +- RemoteStorage nécessite des certificats SSL approuvés par le navigateur. Si vous disposez de certificats qui ne sont pas émis par [Let's Encrypt](https://letsencrypt.org/), installez-les manuellement comme d'habitude. + + ## TODO * Toute limitation ou contrainte connue ou tout élément ne fonctionnant pas, tel que (mais non limité à) : - * nécessitant un domaine dédié complet ? * architectures non prises en charge ? * L'authentification unique ou l'intégration LDAP ne fonctionnent pas ? - * l'application nécessite une quantité importante de RAM / disque / ... pour s'installer ou fonctionner correctement. * etc... * D'autres informations que les gens devraient connaître, comme.. : * toute étape spécifique à effectuer après l'installation (comme terminer manuellement l'installation, des identifiants d'administration spécifiques, ...) * Comment configurer / administrer l'application si ce n'est pas évident. - * le processus de mise à niveau, les spécificités, les choses à savoir ? - * Considérations de sécurité - -Traduit avec www.DeepL.com/Translator (version gratuite) + * Spécificités, les choses à savoir ? ## Documentations et ressources * Site officiel de l'app : https://remotestorage.io/ diff --git a/check_process b/check_process index 6bb6c08..9444bd9 100644 --- a/check_process +++ b/check_process @@ -16,20 +16,20 @@ pkg_linter=1 setup_sub_dir=0 setup_root=1 - setup_nourl=1 + setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 - # 0.0.2-beta.10~ynh1 - upgrade=1 from_commit=27894600799b8b04f71e7ec219798e34512e51b0 + # 0.0.2~ynh5 + upgrade=1 from_commit=d185b84698a9f7e83eff6bf6dd5606f35282a536 backup_restore=1 multi_instance=0 - port_already_use=1 + port_already_use=0 change_url=1 ;;; Options Email= Notification=none ;;; Upgrade options - ; commit=27894600799b8b04f71e7ec219798e34512e51b0 - name= Upgrade to version 0.0.2-beta.10~ynh1 + ; commit=d185b84698a9f7e83eff6bf6dd5606f35282a536 + name= Upgrade to version 0.0.2~ynh6 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&is_signup=true&port=8008& diff --git a/conf/config.sample.yml b/conf/config.sample.yml index bf417a5..94a2890 100644 --- a/conf/config.sample.yml +++ b/conf/config.sample.yml @@ -7,4 +7,5 @@ final_path: __FINALPATH__ datadir: __DATADIR__ port: __PORT__ domain: __DOMAIN__ +is_signup: __IS_SIGNUP__ diff --git a/conf/nginx.conf b/conf/nginx.conf index bd2ced4..bc145c9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -11,6 +11,5 @@ location __PATH__ { # Include SSOWAT user panel. # include conf.d/yunohost_panel.conf.inc; - } \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 4e4f62d..5fc0dcf 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Armadietto is a remoteStorage server written in nodejs +Description=Armadietto, a remoteStorage server service After=network.target [Service] diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 9084a24..b305f9b 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,6 +1,20 @@ -## TODO -Une description longue de ce que fait l'application +[Armadietto](https://github.com/remotestorage/armadietto/) is a [remoteStorage](https://remotestorage.io) server written for Node.js. + +Armadietto is maintained by remoteStorage Team [IRC](https://kiwiirc.com/client/irc.freenode.net/#remotestorage) + +> ### :warning: WARNING +> Please do not consider `armadietto` production ready, this project is still +> considered experimental. As with any alpha-stage storage technology, you +> MUST expect that it will eat your data and take precautions against this. You +> SHOULD expect that its APIs and storage schemas will change before it is +> labelled stable. + +**Shipped version:** 0.1.5 + +### Application for remoteStorage + +[Click here](https://remotestorage.io/apps/) to see the list of applications that can be used with RemoteStorage. ### Features diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..7fd6c07 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,17 @@ + +[Armadietto](https://github.com/remotestorage/armadietto/) est un serveur [remoteStorage](https://remotestorage.io) écrit pour Node.js. + +Armadietto est maintenu par l'équipe remoteStorage [IRC](https://kiwiirc.com/client/irc.freenode.net/#remotestorage). + +> ### :warning: WARNING +> Veuillez ne pas considérer `armadietto` comme prêt pour la production, ce projet est toujours +> comme expérimental. Comme avec toute technologie de stockage en phase alpha, vous +> devez vous attendre à ce qu'elle mange vos données et prendre des précautions contre cela. Vous +> Vous devez vous attendre à ce que ses API et ses schémas de stockage changent avant qu'il ne soit +> étiqueté comme stable. + +**Version livrée:** 0.1.5 + +### Application pour remoteStorage + +[Cliquez ici](https://remotestorage.io/apps/) pour voir la liste des applications qui peuvent être utilisées avec RemoteStorage. \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 151747f..62f67a7 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,16 +1,43 @@ +### :warning: WARNING +Armadietto_ynh still in develoment: + +* Security considerations from [Armadietto](https://github.com/remotestorage/armadietto/) : + + +>### **Storage security** +> +>In production, we recommend that you restrict access to the files managed by your armadietto server as much as possible. This is particularly true if you host your storage on a machine with other web applications; you need to protect your files in the event that one of those apps is exploited. +> +>You should take these steps to keep your storage safe: +> +> - Pick a unique Unix user to run your server process; no other process on the box should run as this user: sudo useradd armadietto --system --no-create-home +> +> - Do not run other applications as root, or as any user that could access files owned by your armadietto user +> +> - Make sure the directory path/to/storage cannot be read, written or executed by anyone but this user: sudo chmod 0700 /path/to/storage && sudo chown armadietto /path/to/storage +> +> - Do not run armadietto as root; if you need to bind to port 80 or 443 use a reverse proxy like nginx, Apache2, caddy, lighttpd or enable bind capability: setcap 'cap_net_bind_service=+ep' `which armadietto` +> +> - Ideally, run your storage inside a container or on a dedicated machine + +
+ +### **Important Notes** + +- RemoteStorage requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. +- As RemoteStorage uses the full domain and is installed on the root, you can create a subdomain such as remote.domain.tld. +- Don't forget to update your DNS if you manage them manually. + +- RemoteStorage requires browser-approved SSL certificates. If you have certificates not issued by [Let's Encrypt](https://letsencrypt.org/), install them manually as usual. + ## TODO -* Toute limitation ou contrainte connue ou tout élément ne fonctionnant pas, tel que (mais non limité à) : - * nécessitant un domaine dédié complet ? - * architectures non prises en charge ? - * L'authentification unique ou l'intégration LDAP ne fonctionnent pas ? - * l'application nécessite une quantité importante de RAM / disque / ... pour s'installer ou fonctionner correctement. +* Any known limitations, constraints or non-functioning elements, such as (but not limited to) : + * Unsupported architectures? + * Single sign-on or LDAP integration not working? * etc... -* D'autres informations que les gens devraient connaître, comme.. : - * toute étape spécifique à effectuer après l'installation (comme terminer manuellement l'installation, des identifiants d'administration spécifiques, ...) - * Comment configurer / administrer l'application si ce n'est pas évident. - * le processus de mise à niveau, les spécificités, les choses à savoir ? - * Considérations de sécurité - -Traduit avec www.DeepL.com/Translator (version gratuite) \ No newline at end of file +* Other information that people should know, such as. : + * any specific steps to be performed after installation (like manually terminating the installation, specific admin credentials, ...) + * How to configure / administer the application if it is not obvious. + * Specifics, things to know? diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..0fbb563 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,45 @@ +### :warning: WARNING +Armadietto_ynh still in develoment: + +* l'authentification unique ou l'intégration LDAP ne fonctionne pas ? +* Considérations sur la sécurité de [Armadietto](https://github.com/remotestorage/armadietto/) : + + +> ### **Sécurité du stockage** +> +> En production, nous vous recommandons de restreindre autant que possible l'accès aux fichiers gérés par votre serveur armadietto. Ceci est particulièrement vrai si vous hébergez votre stockage sur une machine avec d'autres applications web ; vous devez protéger vos fichiers dans le cas où l'une de ces applications serait exploitée. +> +> Vous devez prendre les mesures suivantes pour assurer la sécurité de votre stockage : +> +> - Choisissez un utilisateur Unix unique pour exécuter votre processus serveur ; aucun autre processus sur la machine ne doit être exécuté sous cet utilisateur : sudo useradd armadietto --system --no-create-home +> +> - Ne lancez pas d'autres applications en tant que root, ou en tant qu'utilisateur qui pourrait accéder à des fichiers appartenant à votre utilisateur armadietto. +> +> - Assurez-vous que le répertoire path/to/storage ne peut être lu, écrit ou exécuté par personne d'autre que cet utilisateur : sudo chmod 0700 /path/to/storage && sudo chown armadietto /path/to/storage +> +> - Ne lancez pas armadietto en tant que root ; si vous avez besoin de vous lier au port 80 ou 443, utilisez un reverse proxy comme nginx, Apache2, caddy, lighttpd ou activez la capacité de liaison : setcap 'cap_net_bind_service=+ep' `which armadietto`. +> +> - Idéalement, exécutez votre stockage dans un conteneur ou sur une machine dédiée. + +
+ +### **Notes importantes** + +- RemoteStorage nécessite un domaine dédié, il faut donc en obtenir un et l'ajouter en utilisant le panneau d'administration de YunoHost. **Domaines -> Ajouter un domaine**. +- Comme RemoteStorage utilise le domaine complet et est installé à la racine, vous pouvez créer un sous-domaine tel que remote.domain.tld. +- N'oubliez pas de mettre à jour vos DNS si vous les gérez manuellement. + +- RemoteStorage nécessite des certificats SSL approuvés par le navigateur. Si vous disposez de certificats qui ne sont pas émis par [Let's Encrypt](https://letsencrypt.org/), installez-les manuellement comme d'habitude. + + +## TODO + +* Toute limitation ou contrainte connue ou tout élément ne fonctionnant pas, tel que (mais non limité à) : + * architectures non prises en charge ? + * L'authentification unique ou l'intégration LDAP ne fonctionnent pas ? + * etc... + +* D'autres informations que les gens devraient connaître, comme.. : + * toute étape spécifique à effectuer après l'installation (comme terminer manuellement l'installation, des identifiants d'administration spécifiques, ...) + * Comment configurer / administrer l'application si ce n'est pas évident. + * Spécificités, les choses à savoir ? \ No newline at end of file diff --git a/manifest.json b/manifest.json index 2a01911..fc9fb42 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "RemoteStorage server written for Node.js", "fr": "Serveur remoteStorage écrit pour node.js" }, - "version": "0.0.2-beta.10~ynh3", + "version": "0.0.2~ynh6", "url": "https://github.com/remotestorage/armadietto", "upstream": { "license": "MIT", diff --git a/scripts/backup b/scripts/backup index 11f4062..ca43193 100755 --- a/scripts/backup +++ b/scripts/backup @@ -49,6 +49,7 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="$datadir" +#================================================= # BACKUP THE ARMADIETTO SERVER #================================================= diff --git a/scripts/change_url b/scripts/change_url index e025f6d..5b25c6c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=2 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -37,7 +37,7 @@ 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=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=3 # Backup the current version of the app ynh_backup_before_upgrade @@ -72,7 +72,7 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" @@ -138,5 +138,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # END OF SCRIPT #================================================= - ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index e3b9c61..554118c 100755 --- a/scripts/install +++ b/scripts/install @@ -37,9 +37,10 @@ datadir="/home/yunohost.app/${app}/storage" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=2 final_path=/opt/yunohost/$app + test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Only on / directory @@ -65,7 +66,7 @@ ynh_app_setting_set --app=$app --key=is_signup --value=$is_signup #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +ynh_script_progression --message="Finding an available port..." --weight=2 # Find an available port port=$(ynh_find_port --port=8008) @@ -74,7 +75,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=4 +ynh_script_progression --message="Installing dependencies..." --weight=23 ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs @@ -100,7 +101,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user ynh_system_user_create --username=$app @@ -108,7 +109,7 @@ ynh_system_user_create --username=$app #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml" @@ -118,7 +119,7 @@ chown $app:$app "$final_path/config.yml" #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression --message="Configuring a systemd service..." --weight=3 # Create a dedicated systemd config ynh_add_systemd_config @@ -140,7 +141,7 @@ chown -R $app:www-data "$datadir" #================================================= # SETUP ARMADIETTO AS A SERVICE #================================================= -ynh_script_progression --message="Configuring armadietto as a service..." --weight=1 +ynh_script_progression --message="Creating a data directory..." --weight=1 # Define armadietto module path module_path="$node_version_path/$nodejs_version/lib/node_modules/armadietto/lib" @@ -184,12 +185,12 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Armadietto run a remotestorage server as service" --log="/var/log/$app/$app.log" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=2 # Make app public if necessary if [ $is_public -eq 1 ] diff --git a/scripts/remove b/scripts/remove index fecfbe5..beec3c8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME @@ -37,7 +37,7 @@ fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -53,7 +53,7 @@ ynh_remove_logrotate #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -80,7 +80,7 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=2 ynh_remove_nodejs --nodejs_version=$NODEJS_VERSION diff --git a/scripts/restore b/scripts/restore index 5e00d71..2d386d2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME @@ -43,7 +43,7 @@ test ! -d $final_path || ynh_die --message="There is already a directory: $final #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=4 +ynh_script_progression --message="Reinstalling dependencies..." --weight=21 ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs @@ -75,7 +75,7 @@ ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet @@ -120,9 +120,9 @@ chown -R $app:www-data "$final_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Armadietto run a remotestorage server as service" --log="/var/log/$app/$app.log" #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index 80bb70d..7684472 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,18 +20,21 @@ 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) -is_signup=$(ynh_app_setting_get --app=$app --key=signup) +is_signup=$(ynh_app_setting_get --app=$app --key=is_signup) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." --weight=1 + +upgrade_type=$(ynh_check_app_version_changed) 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 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 # Backup the current version of the app ynh_backup_before_upgrade @@ -56,18 +59,22 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +# Remove old log file +ynh_secure_remove --file="/var/log/$app/" + # # 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 final_path doesn't exist, create it #if [ -z "$final_path" ]; then # final_path=/var/www/$app @@ -114,16 +121,27 @@ ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path chmod 400 "$final_path/config.yml" chown $app:$app "$final_path/config.yml" +#================================================= +# CREATE DATA DIRECTORY +#================================================= +if [ -z "$datadir" ]; then + ynh_script_progression --message="Creating a data directory..." --weight=1 + + ynh_app_setting_set --app=$app --key=datadir --value=$datadir + + # Create app data folder + mkdir -p $datadir +fi + #================================================= # DEFINE ARMADIETTO OPTIONS & CREATE DATA DIRECTORY #================================================= -ynh_script_progression --message="Configuring armadietto as a service..." --weight=1 +ynh_script_progression --message="Configuring armadietto as a service..." --weight=2 # Define armadietto module path module_path="$node_version_path/$nodejs_version/lib/node_modules/armadietto/lib" ynh_add_config --template="../conf/server.js" --destination="$final_path/server.js" - chmod 400 "$final_path/server.js" chown $app:$app "$final_path/server.js" @@ -142,7 +160,12 @@ fi #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 +ynh_script_progression --message="Updating a configuration file..." --weight=2 + +ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml" + +chmod 400 "$final_path/config.yml" +chown $app:$app "$final_path/config.yml" ### Same as during install ### @@ -167,7 +190,7 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1 #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=3 # Create a dedicated systemd config ynh_add_systemd_config @@ -177,7 +200,7 @@ ynh_add_systemd_config #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=2 # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -197,19 +220,12 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +yunohost service add $app --description="Armadietto run a remotestorage server as service" --log="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload @@ -224,5 +240,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # END OF SCRIPT #================================================= - ynh_script_progression --message="Upgrade of $app completed" --last