1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/isso_ynh.git synced 2024-09-03 19:35:55 +02:00

Merge pull request #2 from YunoHost-Apps/testing

Testing
This commit is contained in:
Navan Chauhan 2022-08-13 21:58:23 -04:00 committed by GitHub
commit f70eeed104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 139 additions and 117 deletions

23
LICENSE
View file

@ -1,4 +1,21 @@
File containing the license of your package. MIT License
More information here: Copyright (c) 2022 Navan Chauhan
https://yunohost.org/packaging_apps_guidelines#yep-1-3
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,84 +1,74 @@
# Packaging an app, starting from this example
* Copy this app before working on it, using the ['Use this template'](https://github.com/YunoHost/example_ynh/generate) button on the Github repo.
* Edit the `manifest.json` with app specific info.
* Edit the `install`, `upgrade`, `remove`, `backup`, and `restore` scripts, and any relevant conf files in `conf/`.
* Using the [script helpers documentation.](https://yunohost.org/packaging_apps_helpers)
* Add a `LICENSE` file for the package.
* Edit `doc/DISCLAIMER*.md`
* The `README.md` files are to be automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
---
<!-- <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator 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. It shall NOT be edited by hand.
--> -->
# Example app for YunoHost # Isso for YunoHost
[![Integration level](https://dash.yunohost.org/integration/example.svg)](https://dash.yunohost.org/appci/app/example) ![Working status](https://ci-apps.yunohost.org/ci/badges/example.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/example.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/isso.svg)](https://dash.yunohost.org/appci/app/isso) ![Working status](https://ci-apps.yunohost.org/ci/badges/isso.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/isso.maintain.svg)
[![Install Example app with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=example) [![Install Isso with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=isso)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Example app quickly and simply on a YunoHost server. > *This package allows you to install Isso quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Isso *Ich schrei sonst* is a lightweight commenting server written in
Python and JavaScript. It aims to be a drop-in replacement for
[Disqus](http://disqus.com).
### Features ### Features
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ; - **Comments written in Markdown**
- Laboris nisi ut aliquip ex ea commodo consequat ; Users can edit or delete own comments (within 15 minutes by default).
- Duis aute irure dolor in reprehenderit in voluptate ; Comments in moderation queue are not publicly visible before activation.
- Velit esse cillum dolore eu fugiat nulla pariatur ; - **SQLite backend**
- Excepteur sint occaecat cupidatat non proident, sunt in culpa." *Because comments are not Big Data.*
- **Disqus & WordPress Import**
You can migrate your Disqus/WordPress comments without any hassle.
- **Configurable JS client**
Embed a single JS file, 65kB (20kB gzipped) and you are done.
**Shipped version:** 0.13.0~ynh1
**Shipped version:** 1.0~ynh1 **Demo:** https://isso-comments.de
**Demo:** https://demo.example.com
## Screenshots ## Screenshots
![Screenshot of Example app](./doc/screenshots/example.jpg) ![Screenshot of Isso](./doc/screenshots/example.jpg)
## Disclaimers / important information ## Disclaimers / important information
* Any known limitations, constrains or stuff not working, such as (but not limited to): * Limitations
* requiring a full dedicated domain ? * Requires a dedicated domain
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as: * Extra information
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...) * The admin interface for the app is `https://yourdomain.tld/admin`
* how to configure / administrate the application if it ain't obvious * One app instance can only be installed for one domain
* upgrade process / specificities / things to be aware of ? * Please do not add a trailing `/` in the target_domain
* security considerations ?
## Documentation and resources ## Documentation and resources
* Official app website: <https://example.com> * Official app website: <https://isso-comments.de>
* Official user documentation: <https://yunohost.org/apps> * Official user documentation: <https://isso-comments.de/docs/reference/client-config/>
* Official admin documentation: <https://yunohost.org/packaging_apps> * Official admin documentation: <https://isso-comments.de/docs/reference/server-config/>
* Upstream app code repository: <https://some.forge.com/example/example> * Upstream app code repository: <https://github.com/posativ/isso>
* YunoHost documentation for this app: <https://yunohost.org/app_example> * YunoHost documentation for this app: <https://yunohost.org/app_isso>
* Report a bug: <https://github.com/YunoHost-Apps/example_ynh/issues> * Report a bug: <https://github.com/YunoHost-Apps/isso_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/example_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/isso_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` bash ``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/isso_ynh/tree/testing --debug
or or
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app upgrade isso -u https://github.com/YunoHost-Apps/isso_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

@ -3,71 +3,72 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
It shall NOT be edited by hand. It shall NOT be edited by hand.
--> -->
# Exemple d'app pour YunoHost # Isso pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/example.svg)](https://dash.yunohost.org/appci/app/example) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/example.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/example.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/isso.svg)](https://dash.yunohost.org/appci/app/isso) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/isso.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/isso.maintain.svg)
[![Installer Example app avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=example) [![Installer Isso avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=isso)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Example app rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Isso 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.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble ## Vue d'ensemble
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Isso *Ich schrei sonst* is a lightweight commenting server written in
Python and JavaScript. It aims to be a drop-in replacement for
[Disqus](http://disqus.com).
### Features ### Features
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ; - **Comments written in Markdown**
- Laboris nisi ut aliquip ex ea commodo consequat ; Users can edit or delete own comments (within 15 minutes by default).
- Duis aute irure dolor in reprehenderit in voluptate ; Comments in moderation queue are not publicly visible before activation.
- Velit esse cillum dolore eu fugiat nulla pariatur ; - **SQLite backend**
- Excepteur sint occaecat cupidatat non proident, sunt in culpa." *Because comments are not Big Data.*
- **Disqus & WordPress Import**
You can migrate your Disqus/WordPress comments without any hassle.
- **Configurable JS client**
Embed a single JS file, 65kB (20kB gzipped) and you are done.
**Version incluse :** 0.13.0~ynh1
**Version incluse :** 1.0~ynh1 **Démo :** https://isso-comments.de
**Démo :** https://demo.example.com
## Captures d'écran ## Captures d'écran
![Capture d'écran de Example app](./doc/screenshots/example.jpg) ![Capture d'écran de Isso](./doc/screenshots/example.jpg)
## Avertissements / informations importantes ## Avertissements / informations importantes
* Any known limitations, constrains or stuff not working, such as (but not limited to): * Limitations
* requiring a full dedicated domain ? * Requires a dedicated domain
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as: * Extra information
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...) * The admin interface for the app is `https://yourdomain.tld/admin`
* how to configure / administrate the application if it ain't obvious * One app instance can only be installed for one domain
* upgrade process / specificities / things to be aware of ? * Please do not add a trailing `/` in the target_domain
* security considerations ?
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : <https://example.com> * Site officiel de l'app : <https://isso-comments.de>
* Documentation officielle utilisateur : <https://yunohost.org/apps> * Documentation officielle utilisateur : <https://isso-comments.de/docs/reference/client-config/>
* Documentation officielle de l'admin : <https://yunohost.org/packaging_apps> * Documentation officielle de l'admin : <https://isso-comments.de/docs/reference/server-config/>
* Dépôt de code officiel de l'app : <https://some.forge.com/example/example> * Dépôt de code officiel de l'app : <https://github.com/posativ/isso>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_example> * Documentation YunoHost pour cette app : <https://yunohost.org/app_isso>
* Signaler un bug : <https://github.com/YunoHost-Apps/example_ynh/issues> * Signaler un bug : <https://github.com/YunoHost-Apps/isso_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/example_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/isso_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
``` bash ``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/isso_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade example -u https://github.com/YunoHost-Apps/example_ynh/tree/testing --debug sudo yunohost app upgrade isso -u https://github.com/YunoHost-Apps/isso_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,7 +1,7 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/" path="/admin" (PATH)
is_public=1 is_public=1
admin="john" admin="john"
password="1Strong-Password" password="1Strong-Password"
@ -12,7 +12,7 @@
setup_sub_dir=0 setup_sub_dir=0
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=0
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=CommitHash upgrade=1 from_commit=CommitHash

View file

@ -8,3 +8,13 @@ location __PATH__/ {
# Include SSOWAT user panel. # Include SSOWAT user panel.
# include conf.d/yunohost_panel.conf.inc; # include conf.d/yunohost_panel.conf.inc;
} }
location = / {
if ($is_args = "") {
return 301 /js/embed.min.js;
}
proxy_pass http://localhost:__PORT__;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}

View file

@ -7,8 +7,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
Environment="ISSO_SETTINGS=__FINALPATH__/isso.cfg" ExecStart=__FINALPATH__/venv/bin/isso -c __FINALPATH__/isso.cfg run
ExecStart=__FINALPATH__/venv/bin/gunicorn -b localhost:__PORT__ -w 4 --preload isso.run
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit

View file

@ -5,7 +5,7 @@
#================================================= #=================================================
# dependencies used by the app (must be on a single line) # dependencies used by the app (must be on a single line)
pkg_dependencies="python3-setuptools python3-virtualenv python3-dev" pkg_dependencies="git curl python3 python3-pip python3-venv libpq-dev libsasl2-dev python3-dev libssl-dev libffi-dev python3-cffi"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -37,7 +37,7 @@ adminmail=$(ynh_user_get_info --username=$admin --key=mail)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --time --weight=1 ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -48,7 +48,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --time --weight=1 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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
@ -62,7 +62,7 @@ ynh_app_setting_set --app=$app --key=adminmail --value=$adminmail
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --time --weight=1 ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port # Find an available port
port=$(ynh_find_port --port=8095) port=$(ynh_find_port --port=8095)
@ -71,14 +71,14 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --time --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --time --weight=1 ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
@ -86,7 +86,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# Setup Final Path # Setup Final Path
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --time --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
mkdir -p $final_path mkdir -p $final_path
@ -99,7 +99,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
@ -110,13 +110,16 @@ ynh_add_nginx_config
pushd $final_path pushd $final_path
ynh_exec_as $app python3 -m venv $final_path/venv ynh_exec_as $app python3 -m venv $final_path/venv
ynh_exec_as $app "$final_path/venv/bin/pip" install --upgrade pip
ynh_exec_as $app "$final_path/venv/bin/pip" install --upgrade setuptools
ynh_exec_as $app "$final_path/venv/bin/pip" install --upgrade MarkupSafe
ynh_exec_as $app "$final_path/venv/bin/pip" install isso gunicorn ynh_exec_as $app "$final_path/venv/bin/pip" install isso gunicorn
popd popd
#================================================= #=================================================
# CREATE DATA DIRECTORY # CREATE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Creating a data directory..." --time --weight=1 ynh_script_progression --message="Creating a data directory..." --weight=2
datadir=/home/yunohost.app/$app datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir ynh_app_setting_set --app=$app --key=datadir --value=$datadir
@ -130,7 +133,7 @@ chown -R $app:www-data "$datadir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --time --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="isso.cfg" --destination="$final_path/isso.cfg" ynh_add_config --template="isso.cfg" --destination="$final_path/isso.cfg"
@ -140,7 +143,7 @@ chown $app:$app "$final_path/isso.cfg"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
@ -150,7 +153,7 @@ ynh_add_systemd_config
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --time --weight=1 ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
@ -158,14 +161,14 @@ ynh_use_logrotate
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Isso - a commenting server" --log="/var/log/$app/$app.log" yunohost service add $app --description="Isso - a commenting server" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
@ -173,7 +176,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --time --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
@ -192,7 +195,7 @@ ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -200,4 +203,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --time --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -30,14 +30,14 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # 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 if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --time --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app yunohost service remove $app
fi fi
#================================================= #=================================================
# STOP AND REMOVE SERVICE # STOP AND REMOVE SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
@ -45,7 +45,7 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1 ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
@ -53,7 +53,7 @@ ynh_remove_logrotate
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --time --weight=1 ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -65,14 +65,14 @@ ynh_secure_remove --file="$final_path"
# Remove the data directory if --purge option is used # Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ] if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then then
ynh_script_progression --message="Removing app data directory..." --time --weight=1 ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir" ynh_secure_remove --file="$datadir"
fi fi
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -80,7 +80,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --time --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
@ -91,7 +91,7 @@ ynh_remove_app_dependencies
if yunohost firewall list | grep -q "\- $port$" if yunohost firewall list | grep -q "\- $port$"
then then
ynh_script_progression --message="Closing port $port..." --time --weight=1 ynh_script_progression --message="Closing port $port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port ynh_exec_warn_less yunohost firewall disallow TCP $port
fi fi
@ -100,7 +100,7 @@ fi
#================================================= #=================================================
# REMOVE VARIOUS FILES # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing various files..." --time --weight=1 ynh_script_progression --message="Removing various files..." --weight=2
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
@ -110,7 +110,7 @@ ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app
@ -119,4 +119,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --time --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -105,6 +105,9 @@ systemctl enable $app.service --quiet
#================================================= #=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1 ynh_script_progression --message="Restoring the logrotate configuration..." --time --weight=1
mkdir -p "/var/log/$app"
chown -R $app: "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================

View file

@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
targetdomain=$(ynh_app_setting_get --app=$app --key=targetdomain) targetdomain=$(ynh_app_setting_get --app=$app --key=targetdomain)
adminmail=$(ynh_app_setting_get --app=$app --key=adminmail) adminmail=$(ynh_app_setting_get --app=$app --key=adminmail)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
@ -104,8 +105,6 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --time --weight=1 ynh_script_progression --message="Updating a configuration file..." --time --weight=1
ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
ynh_add_config --template="isso.cfg" --destination="$final_path/isso.cfg" ynh_add_config --template="isso.cfg" --destination="$final_path/isso.cfg"
chmod 400 "$final_path/isso.cfg" chmod 400 "$final_path/isso.cfg"