1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/armadietto_ynh.git synced 2024-09-03 18:06:18 +02:00

Merge pull request #16 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-06-03 08:31:08 +02:00 committed by GitHub
commit 63d445c20c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 260 additions and 324 deletions

View file

@ -34,6 +34,7 @@ fi
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
@ -60,46 +61,45 @@ echo "${#assets[@]} available asset(s)"
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# 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
*"admin"*)
src="app"
;;
*"update"*)
src="app-upgrade"
;;
*)
src=""
;;
esac
# Assign the asset to a source file in conf/ directory
# 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
*"admin"*)
src="app"
;;
*"update"*)
src="app-upgrade"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
@ -107,11 +107,11 @@ SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
else
echo "... asset ignored"
fi
done

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Armadietto for YunoHost
[![Integration level](https://dash.yunohost.org/integration/armadietto.svg)](https://dash.yunohost.org/appci/app/armadietto) ![](https://ci-apps.yunohost.org/ci/badges/armadietto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/armadietto.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/armadietto.svg)](https://dash.yunohost.org/appci/app/armadietto) ![Working status](https://ci-apps.yunohost.org/ci/badges/armadietto.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/armadietto.maintain.svg)
[![Install Armadietto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=armadietto)
*[Lire ce readme en français.](./README_fr.md)*
@ -15,7 +15,6 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
[Armadietto](https://github.com/remotestorage/armadietto/) is a [remoteStorage](https://remotestorage.io) server written for Node.js.
Armadietto is maintained by the remoteStorage community, ([IRC](https://web.libera.chat/#remotestorage), [forums](https://community.remotestorage.io/)).
@ -27,8 +26,6 @@ Armadietto is maintained by the remoteStorage community, ([IRC](https://web.libe
> SHOULD expect that its APIs and storage schemas will change before it is
> labelled stable.
**Shipped version:** 0.1.5
### Installation option
User registration is not allowed out of the box.
@ -39,14 +36,11 @@ This option can be enabled in the configuration panel.
[Here](https://remotestorage.io/apps/) is a non-exhaustive list of apps that have integrated remoteStorage as a storage/sync option.
**Shipped version:** 0.0.7~ynh1
**Shipped version:** 0.1.5~ynh1
## Screenshots
![](./doc/screenshots/armadietto.png)
![Screenshot of Armadietto](./doc/screenshots/armadietto.png)
## Disclaimers / important information
@ -81,34 +75,23 @@ The Armadietto_ynh package is still under development, so you should expect some
- 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
* 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...
* 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?
## Documentation and resources
* Official app website: https://remotestorage.io/
* Upstream app code repository: https://github.com/remotestorage/armadietto
* YunoHost documentation for this app: https://yunohost.org/app_armadietto
* Report a bug: https://github.com/YunoHost-Apps/armadietto_ynh/issues
* Official app website: <https://remotestorage.io/>
* Upstream app code repository: <https://github.com/remotestorage/armadietto>
* YunoHost documentation for this app: <https://yunohost.org/app_armadietto>
* Report a bug: <https://github.com/YunoHost-Apps/armadietto_ynh/issues>
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/armadietto_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/armadietto_ynh/tree/testing --debug
or
sudo yunohost app upgrade armadietto -u https://github.com/YunoHost-Apps/armadietto_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,17 +1,20 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Armadietto pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/armadietto.svg)](https://dash.yunohost.org/appci/app/armadietto) ![](https://ci-apps.yunohost.org/ci/badges/armadietto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/armadietto.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/armadietto.svg)](https://dash.yunohost.org/appci/app/armadietto) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/armadietto.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/armadietto.maintain.svg)
[![Installer Armadietto avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=armadietto)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Armadietto 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.*
## Vue d'ensemble
[Armadietto](https://github.com/remotestorage/armadietto/) est un serveur [remoteStorage](https://remotestorage.io) écrit pour Node.js.
Armadietto est maintenu par la communauté remoteStorage, ([IRC](https://web.libera.chat/#remotestorage), [forums](https://community.remotestorage.io/)).
@ -23,8 +26,6 @@ Armadietto est maintenu par la communauté remoteStorage, ([IRC](https://web.lib
> 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
### Option d'installation
L'inscription des utilisateurs n'est pas autorisée par défault.
@ -34,13 +35,12 @@ Cette option peut être activée via le panneau de configutration.
[Cliquez ici](https://remotestorage.io/apps/) pour voir une liste non exhaustive d'applications ayant intégré remoteStorage comme option de stockage/synchronisation.
**Version incluse :** 0.0.7~ynh1
**Version incluse :** 0.1.5~ynh1
## Captures d'écran
![](./doc/screenshots/armadietto.png)
![Capture d'écran de Armadietto](./doc/screenshots/armadietto.png)
## Avertissements / informations importantes
@ -75,34 +75,23 @@ Le paquet Armadietto_ynh est toujours en cours de développement, vous devez don
- 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 ?
## Documentations et ressources
* Site officiel de l'app : https://remotestorage.io/
* Dépôt de code officiel de l'app : https://github.com/remotestorage/armadietto
* Documentation YunoHost pour cette app : https://yunohost.org/app_armadietto
* Signaler un bug : https://github.com/YunoHost-Apps/armadietto_ynh/issues
* Site officiel de l'app : <https://remotestorage.io/>
* Dépôt de code officiel de l'app : <https://github.com/remotestorage/armadietto>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_armadietto>
* Signaler un bug : <https://github.com/YunoHost-Apps/armadietto_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/armadietto_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/armadietto_ynh/tree/testing --debug
ou
sudo yunohost app upgrade armadietto -u https://github.com/YunoHost-Apps/armadietto_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -1,26 +1,21 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld"
path="/"
admin="armadietto"
language="fr"
is_public=1
is_signup=0
port="8008"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
# 0.0.2~ynh5
upgrade=1 from_commit=d185b84698a9f7e83eff6bf6dd5606f35282a536
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=

View file

@ -1,15 +1,15 @@
location __PATH__ {
proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host;
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Scheme https;
proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host;
proxy_buffering off;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Scheme https;
proxy_buffering off;
# Include SSOWAT user panel.
# include conf.d/yunohost_panel.conf.inc;
# Include SSOWAT user panel.
# include conf.d/yunohost_panel.conf.inc;
}

View file

@ -1,4 +1,3 @@
[Armadietto](https://github.com/remotestorage/armadietto/) is a [remoteStorage](https://remotestorage.io) server written for Node.js.
Armadietto is maintained by the remoteStorage community, ([IRC](https://web.libera.chat/#remotestorage), [forums](https://community.remotestorage.io/)).
@ -10,8 +9,6 @@ Armadietto is maintained by the remoteStorage community, ([IRC](https://web.libe
> SHOULD expect that its APIs and storage schemas will change before it is
> labelled stable.
**Shipped version:** 0.1.5
### Installation option
User registration is not allowed out of the box.
@ -20,4 +17,3 @@ This option can be enabled in the configuration panel.
### Application for remoteStorage
[Here](https://remotestorage.io/apps/) is a non-exhaustive list of apps that have integrated remoteStorage as a storage/sync option.

View file

@ -1,4 +1,3 @@
[Armadietto](https://github.com/remotestorage/armadietto/) est un serveur [remoteStorage](https://remotestorage.io) écrit pour Node.js.
Armadietto est maintenu par la communauté remoteStorage, ([IRC](https://web.libera.chat/#remotestorage), [forums](https://community.remotestorage.io/)).
@ -10,8 +9,6 @@ Armadietto est maintenu par la communauté remoteStorage, ([IRC](https://web.lib
> 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
### Option d'installation
L'inscription des utilisateurs n'est pas autorisée par défault.
@ -19,4 +16,4 @@ Cette option peut être activée via le panneau de configutration.
### Application pour remoteStorage
[Cliquez ici](https://remotestorage.io/apps/) pour voir une liste non exhaustive d'applications ayant intégré remoteStorage comme option de stockage/synchronisation.
[Cliquez ici](https://remotestorage.io/apps/) pour voir une liste non exhaustive d'applications ayant intégré remoteStorage comme option de stockage/synchronisation.

View file

@ -28,15 +28,3 @@ The Armadietto_ynh package is still under development, so you should expect some
- 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
* 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...
* 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?

View file

@ -28,16 +28,3 @@ Le paquet Armadietto_ynh est toujours en cours de développement, vous devez don
- 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 ?

View file

@ -6,7 +6,7 @@
"en": "A remoteStorage server running as a nodejs web service with systemd",
"fr": "Un serveur remoteStorage excécuté en tant que service web nodejs par systemd"
},
"version": "0.0.7~ynh1",
"version": "0.1.5~ynh1",
"url": "https://github.com/remotestorage/armadietto",
"upstream": {
"license": "MIT",
@ -27,7 +27,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -35,11 +35,7 @@
{
"name": "is_public",
"type": "boolean",
"default": true,
"help": {
"en": "Would you like to restrein the access to this web site?",
"fr": "Souhaitez-vous limiter l'accès à ce site web ?"
}
"default": true
},
{
"name": "is_signup",

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -47,13 +46,7 @@ ynh_backup --src_path="$final_path"
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir"
#=================================================
# BACKUP THE ARMADIETTO SERVER
#=================================================
ynh_backup --src_path="$final_path/server.js"
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
@ -61,6 +54,14 @@ ynh_backup --src_path="$final_path/server.js"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
@ -70,4 +71,5 @@ 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)."

View file

@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
new_path="/"
app=$YNH_APP_INSTANCE_NAME
@ -29,6 +29,11 @@ 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)
# Add settings here as needed by your application
port=$(ynh_app_setting_get --app=$app --key=port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
is_signup=$(ynh_app_setting_get --app=$app --key=is_signup)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
@ -37,6 +42,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
# 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"
@ -103,8 +109,19 @@ fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=2
domain=$new_domain
ynh_use_nodejs
# 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"
#=================================================
# GENERIC FINALISATION
@ -113,6 +130,7 @@ fi
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
@ -122,15 +140,8 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# RESTART ARMADIETTO
#=================================================
ynh_script_progression --message="Start armadietto web server..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -31,16 +30,12 @@ is_signup=$YNH_APP_ARG_IS_SIGNUP
app=$YNH_APP_INSTANCE_NAME
# Define app's data directory
datadir="/home/yunohost.app/${app}/storage"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
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"
# Register (book) web path
@ -54,7 +49,6 @@ 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=is_signup --value=$is_signup
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
#=================================================
# STANDARD MODIFICATIONS
@ -75,16 +69,27 @@ ynh_script_progression --message="Installing dependencies..." --weight=23
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CHECK AND CREATE FINAL_PATH
#=================================================
ynh_script_progression --message="Setting up and create final app path..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Create final_path
mkdir -p "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -94,35 +99,35 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
# SPECIFIC SETUP
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app
# INSTALL ARMADIETTO
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=3
ynh_script_progression --message="Install armadietto with npm..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
pushd $final_path
upstream_version=$(ynh_app_upstream_version)
ynh_npm -g i armadietto@$upstream_version
popd
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir="/home/yunohost.app/${app}/storage"
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
# Create app data folder
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
#=================================================
# SETUP ARMADIETTO AS A SERVICE
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring armadietto as a service..." --weight=2
ynh_script_progression --message="Adding a configuration file..." --weight=2
# Define armadietto module path
module_path="$node_version_path/$nodejs_version/lib/node_modules/armadietto/lib"
@ -133,13 +138,12 @@ chmod 400 "$final_path/server.js"
chown $app:$app "$final_path/server.js"
#=================================================
# INSTALL ARMADIETTO
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Install armadietto with npm..." --weight=1
ynh_script_progression --message="Configuring a systemd service..." --weight=3
pushd $final_path
ynh_npm -g i armadietto@0.1.5
popd
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
@ -151,16 +155,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Secure files and directories" --weight=1
# Set permissions to app files
chown -R $app:$app "$final_path"
chmod 0700 "$datadir"
chown $app:$app "$datadir"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -168,6 +162,14 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Armadietto run a remotestorage server as service" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# SETUP SSOWAT
#=================================================
@ -188,15 +190,8 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# START ARMADIETTO
#=================================================
ynh_script_progression --message="Start armadietto web server..." --weight=1
# Start a systemd service
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

View file

@ -82,6 +82,7 @@ ynh_remove_nginx_config
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=2
# Remove metapackage and its dependencies
ynh_remove_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
@ -97,4 +98,5 @@ ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -38,22 +37,15 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d "$final_path" || ynh_die --message="There is already a directory: $final_path "
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=21
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -63,7 +55,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
@ -72,6 +64,44 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=21
# Define and install dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
#=================================================
# INSTALL ARMADIETTO
#=================================================
ynh_script_progression --message="Install armadietto with npm..." --weight=1
pushd $final_path
upstream_version=$(ynh_app_upstream_version)
ynh_npm -g i armadietto@$upstream_version
popd
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -81,41 +111,11 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# RESTORE ARMADIETTO AS A SERVICE
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring armadietto as a service..." --weight=1
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="$final_path/server.js" --not_mandatory
ynh_restore_file --origin_path="$datadir" --not_mandatory
#=================================================
# REINSTALL ARMADIETTO
#=================================================
ynh_script_progression --message="REinstall armadietto with npm..." --weight=1
pushd $final_path
ynh_npm -g i armadietto@0.1.5
popd
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Secure files and directories" --weight=1
# Set permissions to app files
chown -R $app:$app "$final_path"
chmod 0700 $datadir
chown $app:$app $datadir
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -125,21 +125,23 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Armadietto run a remotestorage server as service" --log="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
# 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"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# START ARMADIETTO
#=================================================
ynh_script_progression --message="Start armadietto web server..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -17,6 +17,7 @@ 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)
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)
@ -37,6 +38,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# 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
}
@ -66,23 +68,25 @@ fi
# 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 [ -z "$datadir" ]; then
ynh_script_progression --message="Creating a data directory..." --weight=1
# If final_path doesn't exist, create it
#if [ -z "$final_path" ]; then
# final_path=/var/www/$app
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#fi
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
# Create app data folder
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
fi
#=================================================
# CREATE DEDICATED USER
@ -90,18 +94,28 @@ ynh_secure_remove --file="/var/log/$app/"
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
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CHECK AND CREATE FINAL_PATH
#=================================================
ynh_script_progression --message="Setting up and create final app path..." --weight=1
ynh_app_setting_set $app final_path $final_path
# Create final_path
mkdir -p "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -113,22 +127,23 @@ ynh_use_nodejs
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CREATE DATA DIRECTORY
# UPGRADE ARMADIETTO
#=================================================
if [ -z "$datadir" ]; then
ynh_script_progression --message="Creating a data directory..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrade armadietto with npm..." --weight=1
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
# Create app data folder
mkdir -p $datadir
pushd $final_path
upstream_version=$(ynh_app_upstream_version)
ynh_npm -g i armadietto@$upstream_version
popd
fi
#=================================================
# DEFINE ARMADIETTO OPTIONS & CREATE DATA DIRECTORY
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Configuring armadietto as a service..." --weight=2
ynh_script_progression --message="Updating a configuration file..." --weight=2
# Define armadietto module path
module_path="$node_version_path/$nodejs_version/lib/node_modules/armadietto/lib"
@ -138,18 +153,6 @@ ynh_add_config --template="../conf/server.js" --destination="$final_path/server.
chmod 400 "$final_path/server.js"
chown $app:$app "$final_path/server.js"
#=================================================
# UPGRADE ARMADIETTO
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrade armadietto with npm..." --weight=1
pushd $final_path
ynh_npm -g i armadietto@0.1.5
popd
fi
#=================================================
# SETUP SYSTEMD
#=================================================
@ -163,20 +166,10 @@ ynh_add_systemd_config
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=2
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=2
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Secure files and directories" --weight=1
# Set permissions to app files
chown -R $app:$app "$final_path"
chmod 0700 "$datadir"
chown $app:$app "$datadir"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -185,6 +178,13 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Armadietto run a remotestorage server as service" --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"
#=================================================
# RELOAD NGINX
#=================================================
@ -192,15 +192,8 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# RESTART ARMADIETTO
#=================================================
ynh_script_progression --message="Start armadietto web server..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last