Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from YunoHost-Apps/testing
Browse files Browse the repository at this point in the history
Fix #21
  • Loading branch information
yalh76 committed Jun 7, 2022
2 parents 88e894a + 098454e commit fe40bff
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 117 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It shall NOT be edited by hand.

# Droppy for YunoHost

[![Integration level](https://dash.yunohost.org/integration/droppy.svg)](https://dash.yunohost.org/appci/app/droppy) ![](https://ci-apps.yunohost.org/ci/badges/droppy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/droppy.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/droppy.svg)](https://dash.yunohost.org/appci/app/droppy) ![Working status](https://ci-apps.yunohost.org/ci/badges/droppy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/droppy.maintain.svg)
[![Install Droppy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=droppy)

*[Lire ce readme en français.](./README_fr.md)*
Expand All @@ -20,11 +20,9 @@ Droppy is a self-hosted file storage server with a web interface and capabilitie

**Shipped version:** 12.2.0~ynh10



## Screenshots

![](./doc/screenshots/screenshot.png)
![Screenshot of Droppy](./doc/screenshots/screenshot.png)

## Disclaimers / important information

Expand All @@ -38,19 +36,20 @@ Shared files are stored in the following directory: `/home/yunohost.app/droppy/f

## Documentation and resources

* Upstream app code repository: https://github.com/silverwind/droppy
* YunoHost documentation for this app: https://yunohost.org/app_droppy
* Report a bug: https://github.com/YunoHost-Apps/droppy_ynh/issues
* Upstream app code repository: <https://github.com/silverwind/droppy>
* YunoHost documentation for this app: <https://yunohost.org/app_droppy>
* Report a bug: <https://github.com/YunoHost-Apps/droppy_ynh/issues>

## Developer info

Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/droppy_ynh/tree/testing).

To try the testing branch, please proceed like that.
```

``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
or
sudo yunohost app upgrade droppy -u https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
```

**More info regarding app packaging:** https://yunohost.org/packaging_apps
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
23 changes: 13 additions & 10 deletions README_fr.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<!--
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.
-->

# Droppy pour YunoHost

[![Niveau d'intégration](https://dash.yunohost.org/integration/droppy.svg)](https://dash.yunohost.org/appci/app/droppy) ![](https://ci-apps.yunohost.org/ci/badges/droppy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/droppy.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/droppy.svg)](https://dash.yunohost.org/appci/app/droppy) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/droppy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/droppy.maintain.svg)
[![Installer Droppy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=droppy)

*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*

> *Ce package vous permet d'installer Droppy 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.*
Expand All @@ -16,11 +20,9 @@ Droppy est un serveur de stockage de fichiers auto-hébergé avec une interface

**Version incluse :** 12.2.0~ynh10



## Captures d'écran

![](./doc/screenshots/screenshot.png)
![Capture d'écran de Droppy](./doc/screenshots/screenshot.png)

## Avertissements / informations importantes

Expand All @@ -33,19 +35,20 @@ Les fichiers partagés sont stockés dans le répertoire suivant : `/home/yunoho

## Documentations et ressources

* Dépôt de code officiel de l'app : https://github.com/silverwind/droppy
* Documentation YunoHost pour cette app : https://yunohost.org/app_droppy
* Signaler un bug : https://github.com/YunoHost-Apps/droppy_ynh/issues
* Dépôt de code officiel de l'app : <https://github.com/silverwind/droppy>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_droppy>
* Signaler un bug : <https://github.com/YunoHost-Apps/droppy_ynh/issues>

## Informations pour les développeurs

Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/droppy_ynh/tree/testing).

Pour essayer la branche testing, procédez comme suit.
```

``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
ou
sudo yunohost app upgrade droppy -u https://github.com/YunoHost-Apps/droppy_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>
4 changes: 3 additions & 1 deletion check_process
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; Checks
pkg_linter=1
Expand All @@ -13,8 +12,11 @@
setup_public=1
upgrade=1
#upgrade=1 from_commit=cf621e81a3df37b77cdc97a305e10dfb27631c6a
# 12.2.0~ynh10
upgrade=1 from_commit=88e894a01858a723ea62b154103867cafb49dfa8
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Expand Down
7 changes: 4 additions & 3 deletions conf/systemd.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ Description=Droppy: self-hosted file storage server
After=network.target

[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__
WorkingDirectory=__FINALPATH__/
Environment="NODE_ENV=production"
Environment="PATH=__ENV_PATH__"
Environment="__YNH_NODE_LOAD_PATH__"
ExecStart= __FINALPATH__/droppy.js start -c __FINALPATH__/config -f /home/yunohost.app/__APP__/files
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=always
Expand All @@ -16,4 +17,4 @@ StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
Expand Down
11 changes: 6 additions & 5 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -42,16 +43,16 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"

#=================================================
# BACKUP THE NGINX CONFIGURATION
# BACKUP THE DATA DIR
#=================================================

ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="$data_path" --is_big

#=================================================
# BACKUP THE DATA DIR
# BACKUP THE NGINX CONFIGURATION
#=================================================

ynh_backup --src_path="$data_path" --is_big
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"

#=================================================
# SPECIFIC BACKUP
Expand Down
7 changes: 4 additions & 3 deletions scripts/change_url
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)

#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up $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=1

# 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
Expand Down
60 changes: 28 additions & 32 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_script_progression --message="Finding an available port..." --weight=2

# Find an available port
port=$(ynh_find_port --port=8989)
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port

#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=2

# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version

#=================================================
Expand All @@ -73,7 +72,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Configuring system user..." --weight=1

# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
Expand All @@ -82,7 +81,12 @@ ynh_script_progression --message="Setting up source files..." --weight=5

ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path
ynh_setup_source --dest_dir="$final_path"
mkdir -p $final_path/config

chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"

#=================================================
# NGINX CONFIGURATION
Expand All @@ -94,57 +98,47 @@ ynh_add_nginx_config

#=================================================
# SPECIFIC SETUP
#==============================================
# INSTALL DROPPY
#==============================================
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=26
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=26

pushd "$final_path"
ynh_use_nodejs
ynh_exec_warn_less $ynh_npm install
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
popd

#=================================================
# CREATE DIRECTORY FOR DATA AND CONFIG
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating the data directory..." --weight=1
ynh_script_progression --message="Creating a data directory..." --weight=1

# Define app's data directory
data_path=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=data_path --value=$data_path

# Create datadir folder
mkdir -p $data_path

# Give permission to the datadir
chmod 750 "$data_path"
chmod -R o-rwx "$data_path"
chown -R $app:www-data "$data_path"
chown -R $app:$app "$data_path"

#=================================================
# SETUP SYSTEMD
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1

env_path="$PATH"
ynh_add_systemd_config

#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1

# Create config folder
mkdir -p $final_path/config
ynh_script_progression --message="Adding a configuration file..." --weight=1

ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json"

chmod 600 "$final_path/config/config.json"
chown $app:$app "$final_path/config/config.json"

chmod 755 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app: "$final_path"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1

# Create a dedicated systemd config
ynh_add_systemd_config

#=================================================
# GENERIC FINALIZATION
Expand Down Expand Up @@ -176,9 +170,11 @@ ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1

# Make app public if necessary or protect it
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi

Expand Down
18 changes: 10 additions & 8 deletions scripts/remove
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path)
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================

# 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=1
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
fi

Expand All @@ -41,13 +42,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config

#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1

ynh_remove_nodejs

#=================================================
# REMOVE APP MAIN DIR
#=================================================
Expand All @@ -66,6 +60,7 @@ then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$data_path"
fi

#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
Expand All @@ -74,6 +69,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=1

ynh_remove_nodejs

#=================================================
# GENERIC FINALIZATION
#=================================================
Expand Down

0 comments on commit fe40bff

Please sign in to comment.