mirror of
https://github.com/YunoHost-Apps/dato_ynh.git
synced 2024-09-03 18:16:33 +02:00
commit
93a73b4c28
13 changed files with 247 additions and 266 deletions
|
@ -1,12 +1,9 @@
|
|||
# See here for more information
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
;; Test without autosync
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/" (PATH)
|
||||
admin="john" (USER)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
domain="domain.tld"
|
||||
path="/"
|
||||
admin="john"
|
||||
is_public=1
|
||||
autosynchronize=0
|
||||
couch_url="none"
|
||||
couch_admin_name="none"
|
||||
|
@ -22,6 +19,8 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 1.5.11~ynh2
|
||||
upgrade=1 from_commit=b127adc6bf773afd1bc2ee7cead36c91c4fded60
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=1
|
||||
|
@ -29,3 +28,6 @@
|
|||
;;; Options
|
||||
Email=squeak@eauchat.org
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=b127adc6bf773afd1bc2ee7cead36c91c4fded60
|
||||
name=1.5.11~ynh2.
|
||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
35
doc/DISCLAIMER.md
Normal file
35
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
||||
* For now, dato needs a full domain, it doesn't support being set to a subpath.
|
||||
* LDAP is not supported, but dato has it's own user's control system, so it can be used publicly, or restricted to some users when autosynchronization is enabled.
|
||||
|
||||
## Configuration
|
||||
|
||||
To configure dato, you can edit the `config/public.js` file in the app directory that should be in `/opt/yunohost/APPID/` where `APPID` is `dato` if it's the first installed instance, `dato__2`, `dato__3`... for additional instances.
|
||||
You can also make modifications in `config/private.js`, but be sure to know what you're doing when doing so.
|
||||
|
||||
|
||||
## Autosynchronization
|
||||
|
||||
By default all data you create with dato is stored only in your browser. Users can manually enable per-database synchronization with any remote couch server, but this process is not obvious to users. Therefore dato provide an autosynchronization mechanism.
|
||||
To enable it, you need to setup a couchdb server (you can do this using the [couchdb yunohost package](https://github.com/YunoHost-Apps/couchdb_ynh)). You should do this before installing dato.
|
||||
Then when installing dato, set the url to your couchdb server when prompted (you will also need to fill your couchdb admin password, and info about the dato admin user to create). Dato will automatically setup the dato administrator account in your couchdb server. You can then easily add users from the user interface, as specified below.
|
||||
|
||||
If you want to allow both a free usage of the app by anyone, and autosynchronization for some users, you can install the dato package multiple times with different setups.
|
||||
|
||||
|
||||
## Adding users
|
||||
|
||||
If you setup autosynchronization, users will need an account to use the app. Dato doesn't support LDAP for the moment, so you will need to add users in it's own database.
|
||||
To add a user to dato, just visit the `/users/` page (e.g. https://dato.yourdomain.tld/users/), create a new user, then don't forget to click on "roles" under the user's name, and add the role `dato`.
|
||||
If you want a user to have administration rights (= to have the power to add/remove users) you can give that user the `dato-admin` role.
|
||||
|
||||
Also, if you need, you can make use of the password reset feature to allow users to modify their passwords, you will just need to send them the generated password reset link.
|
||||
|
||||
|
||||
## A note about dato
|
||||
|
||||
Please be aware that dato is a Progressive Web App. In a nutshell, this means that browsers cache the whole app, so it doesn't have to be requested to the server every time a user is visiting it.
|
||||
This lowers solicitation of the server, and also allow users to use dato offline.
|
||||
|
||||
When the app is upgraded, the user's browser will automatically detect that there is a new version, and propose to reload the page to update. However, sometimes it seems a bit random how browsers notice the new version, so if you want to make sure you're using the latest version, click on the "?" button (top-right in the web interface), and choose "credits" to verify the version you're using.
|
||||
You can also force reloading the app from the server opening "about:serviceworkers" in your browser and unregistering the worker for the domain in which you installed dato.
|
26
doc/DISCLAIMER_fr.md
Normal file
26
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
* Limitations
|
||||
* Pour le moment, dato a besoin d'un domaine/sous-domaine complet et ne peut être installé dans un sous-chemin.
|
||||
* LDAP n'est pas supporté, mais dato contient son propre mécanisme de gestion des utilisateurs, et permet de rendre l'application soit disponible à tous, soit restreinte aux utilisateurs choisis quand l'autosynchronisation est activée.
|
||||
|
||||
## Configuration
|
||||
|
||||
Cette application peut être personnalisée en modifiant le fichier `config/public.js` situé dans `/opt/yunohost/APPID/` (`APPID` devrait-être `dato` pour une première instance et puis, `dato__2`, `dato__3`... pour les suivantes).
|
||||
Il est aussi possible de modifier `config/private.js`, mais à vos risques et périls.
|
||||
|
||||
|
||||
## Ajouter des utilisateurs
|
||||
|
||||
Si vous activez l'autosynchronisation, les utilisateurs auront besoin d'un compte pour utiliser l'application. Dato ne supporte pas LDAP pour le moment, vous devrez donc ajouter des utilisateurs séparément dans sa base de données.
|
||||
Pour ajouter un utilisateur, il suffit de visiter la page `/users/` (https://dato.yourdomain.tld/users/), créer un nouvel utilisateur, et ne pas oublier de cliquer sur "roles" et d'ajouter le rôle `dato`.
|
||||
Si vous voulez donner le droit à un utilisateur d'administrer (= d'ajouter/supprimer des utilisateurs), il suffit de lui donner additionnellement, le rôle `dato-admin`.
|
||||
|
||||
Si besoin, vous pouvez créer des liens pour permettre à un utilisateur de modifier son mot de passe. Il suffira alors d'envoyer ce lien manuellement à l'utilisateur.
|
||||
|
||||
|
||||
## Note sur dato
|
||||
|
||||
Dato est une application web progressive (PWA). En deux mots, cela veut dire que les navigateurs gardent en cache l'application entière, afin de ne pas avoir à la demander au serveur à chaque visite.
|
||||
Cela permet de moins soliciter le serveur, et d'utiliser l'application en l'absence de connexion internet.
|
||||
|
||||
Quand l'application est mise à jour, le navigateur des utilisateurs détecte automatiquement la nouvelle version et propose de recharcher la page pour mettre à jour l'application. Cependant, certains navigateurs ne semblent pas toujours se rendre compte qu'une nouvelle version est disponible instantanément. Pour vérifier la version que vous utilisez, vous pouvez cliquer sur "?" (en haut à droite dans l'interface de dato), et choisir "crédit" pour y trouver le numéro de version actuellement installé.
|
||||
Vous pouvez aussi forcer une mise à jour de l'application depuis le serveur en ouvrant la page "about:serviceworker" dans votre navigateur, et en cliquant sur le bouton "unregister" du service du domaine sur lequel vous avez installé dato.
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 544 KiB |
260
manifest.json
260
manifest.json
|
@ -1,133 +1,131 @@
|
|||
{
|
||||
"name": "Dato",
|
||||
"id": "dato",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Store all kinds of data with an extremely customizable interface.",
|
||||
"fr": "Stockez tous types de données avec une interface complètement customizable."
|
||||
},
|
||||
"version": "1.5.11~ynh2",
|
||||
"url": "https://squeak.eauchat.org/dato",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "Squeak",
|
||||
"email": "squeak@eauchat.org",
|
||||
"url": "https://squeak.eauchat.org"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain name for dato",
|
||||
"fr": "Choisissez un nom de domaine pour dato"
|
||||
},
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "Will users need to have a yunohost account to use dato? If you choose to set autosynchronization to true, then dato contains it's own login system, so you probably don't need to make it private.",
|
||||
"fr": "Les utilisateurs devront-ils avoir un compte pour utiliser dato ? Si vous activez l'autosynchronisation, dato contient son propre système de login, ce n'est donc probablement pas nécessaire de la rendre privée."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "autosynchronize",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Do you want to autosynchronize users databases?",
|
||||
"fr": "Voulez vous activer l'autosynchronisation des bases de données des utilisateurs ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "If you activate autosynchronization, to use dato, people will need to have a dato-specific account on your server. To enable this, you need a couchdb server, you can install one with the couchdb yunohost package (you should do this before proceeding to dato installation).",
|
||||
"fr": "Si vous activez l'autosynchronisation, pour utiliser dato, les utilisateurs devront avoir un compte specifique à dato sur votre serveur. Pour activer cette option, vous devez avoir un server couchdb, vous pouvez en installer un en utilisant le packet yunohost couchdb (vous devez avoir couchdb installé avant d'installer dato)."
|
||||
},
|
||||
"default" : false
|
||||
},
|
||||
{
|
||||
"name": "autosync_info",
|
||||
"type": "display_text",
|
||||
"ask": {
|
||||
"en": "All the following options are useful only if you chose to enable autosynchronization. You can skip them all if you didn't.",
|
||||
"fr": "Les options qui suivent ne sont utiles que si vous avez choisi d'activer l'autosynchronisation. Vous pouvez toutes les ignorer si ce n'est pas le cas."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "couch_url",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "What is the url of your couchdb server (only if autosynchronization is enabled).",
|
||||
"fr": "Quelle est l'addresse de votre serveur couchdb (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"example": "https://couch.domain.tld",
|
||||
"optional": true,
|
||||
"default" : "none"
|
||||
},
|
||||
{
|
||||
"name": "couch_admin_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Please specify the username of the administrator of your couchdb instance (only if autosynchronization is enabled). If you didn't customize it, it should be called 'admin'.",
|
||||
"fr": "Entrez le nom de l'administrateur de votre serveur couchdb (nécessaire uniquement si l'autosynchronisation a été activée). Si vous ne l'avez pas modifié, ce devrait être 'admin'."
|
||||
},
|
||||
"example": "admin",
|
||||
"optional": true,
|
||||
"default" : "admin"
|
||||
},
|
||||
{
|
||||
"name": "couch_admin_password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Please enter the password of your couchdb administrator (only if autosynchronization is enabled).",
|
||||
"fr": "Entrez le mot de passe de l'administrateur de votre serveur couchdb (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"name": "couch_datoadmin_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Please choose the username of the dato admin user to create (only if autosynchronization is enabled).",
|
||||
"fr": "Choisissez le nom de l'administrateur de dato qui va être créé (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"example": "dato-admin",
|
||||
"optional": true,
|
||||
"default": "none"
|
||||
},
|
||||
{
|
||||
"name": "couch_datoadmin_password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Please choose the password to use for the dato admin user to create (only if autosynchronization is enabled).",
|
||||
"fr": "Choisissez le mot de passe de l'administrateur de dato qui va être créé (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"name": "admin_email",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "If you want the dato administrator email to be displayed in login page, so that users can contact you to create accounts... you can set your email here. Otherwise leave this empty. (only useful if autosynchronization is enabled)",
|
||||
"fr": "Si tu souhaites que l'email de l'administrateur de dato soit visible sur la page de login, afin que les utilisateurs puissent le contacter pour des demandes de compte... tu peux le spécifier ici. Sinon, laisser ce champ vide. (utile uniquement si l'autosynchronisation a été activée)"
|
||||
},
|
||||
"example": "datoadmin((at))domain.tld",
|
||||
"optional": true,
|
||||
"default" : ""
|
||||
}
|
||||
]
|
||||
}
|
||||
"name": "Dato",
|
||||
"id": "dato",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Store all kinds of data with an extremely customizable interface.",
|
||||
"fr": "Stockez tous types de données avec une interface complètement customizable."
|
||||
},
|
||||
"version": "1.5.11~ynh2",
|
||||
"url": "https://squeak.eauchat.org/dato",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"demo": "https://publicdato.eauchat.org/",
|
||||
"admindoc": "https://squeak.eauchat.org/dato/",
|
||||
"code": "https://framagit.org/squeak/dato"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "Squeak",
|
||||
"email": "squeak@eauchat.org",
|
||||
"url": "https://squeak.eauchat.org"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "Will users need to have a yunohost account to use dato? If you choose to set autosynchronization to true, then dato contains it's own login system, so you probably don't need to make it private.",
|
||||
"fr": "Les utilisateurs devront-ils avoir un compte pour utiliser dato ? Si vous activez l'autosynchronisation, dato contient son propre système de login, ce n'est donc probablement pas nécessaire de la rendre privée."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "autosynchronize",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Do you want to autosynchronize users databases?",
|
||||
"fr": "Voulez vous activer l'autosynchronisation des bases de données des utilisateurs ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "If you activate autosynchronization, to use dato, people will need to have a dato-specific account on your server. To enable this, you need a couchdb server, you can install one with the couchdb yunohost package (you should do this before proceeding to dato installation).",
|
||||
"fr": "Si vous activez l'autosynchronisation, pour utiliser dato, les utilisateurs devront avoir un compte specifique à dato sur votre serveur. Pour activer cette option, vous devez avoir un server couchdb, vous pouvez en installer un en utilisant le packet yunohost couchdb (vous devez avoir couchdb installé avant d'installer dato)."
|
||||
},
|
||||
"default" : false
|
||||
},
|
||||
{
|
||||
"name": "autosync_info",
|
||||
"type": "display_text",
|
||||
"ask": {
|
||||
"en": "All the following options are useful only if you chose to enable autosynchronization. You can skip them all if you didn't.",
|
||||
"fr": "Les options qui suivent ne sont utiles que si vous avez choisi d'activer l'autosynchronisation. Vous pouvez toutes les ignorer si ce n'est pas le cas."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "couch_url",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "What is the url of your couchdb server (only if autosynchronization is enabled).",
|
||||
"fr": "Quelle est l'addresse de votre serveur couchdb (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"example": "https://couch.domain.tld",
|
||||
"optional": true,
|
||||
"default" : "none"
|
||||
},
|
||||
{
|
||||
"name": "couch_admin_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Please specify the username of the administrator of your couchdb instance (only if autosynchronization is enabled). If you didn't customize it, it should be called 'admin'.",
|
||||
"fr": "Entrez le nom de l'administrateur de votre serveur couchdb (nécessaire uniquement si l'autosynchronisation a été activée). Si vous ne l'avez pas modifié, ce devrait être 'admin'."
|
||||
},
|
||||
"example": "admin",
|
||||
"optional": true,
|
||||
"default" : "admin"
|
||||
},
|
||||
{
|
||||
"name": "couch_admin_password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Please enter the password of your couchdb administrator (only if autosynchronization is enabled).",
|
||||
"fr": "Entrez le mot de passe de l'administrateur de votre serveur couchdb (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"name": "couch_datoadmin_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Please choose the username of the dato admin user to create (only if autosynchronization is enabled).",
|
||||
"fr": "Choisissez le nom de l'administrateur de dato qui va être créé (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"example": "dato-admin",
|
||||
"optional": true,
|
||||
"default": "none"
|
||||
},
|
||||
{
|
||||
"name": "couch_datoadmin_password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Please choose the password to use for the dato admin user to create (only if autosynchronization is enabled).",
|
||||
"fr": "Choisissez le mot de passe de l'administrateur de dato qui va être créé (nécessaire uniquement si l'autosynchronisation a été activée)."
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"name": "admin_email",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "If you want the dato administrator email to be displayed in login page, so that users can contact you to create accounts... you can set your email here. Otherwise leave this empty. (only useful if autosynchronization is enabled)",
|
||||
"fr": "Si tu souhaites que l'email de l'administrateur de dato soit visible sur la page de login, afin que les utilisateurs puissent le contacter pour des demandes de compte... tu peux le spécifier ici. Sinon, laisser ce champ vide. (utile uniquement si l'autosynchronisation a été activée)"
|
||||
},
|
||||
"example": "datoadmin((at))domain.tld",
|
||||
"optional": true,
|
||||
"default" : ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -37,11 +36,6 @@ autosynchronize=$(ynh_app_setting_get --app=$app --key=autosynchronize)
|
|||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
|
||||
### to be backuped and not an actual copy of any file. The actual backup that
|
||||
### creates and fill the archive with the files happens in the core after this
|
||||
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -54,13 +48,6 @@ ynh_backup --src_path="$final_path"
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# #=================================================
|
||||
# # BACKUP FAIL2BAN CONFIGURATION
|
||||
# #=================================================
|
||||
#
|
||||
# ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
# ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
|
|
|
@ -30,7 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=10
|
||||
|
||||
|
@ -111,7 +111,7 @@ fi
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting dato app service and building pages..." --weight=60
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=60
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
|
|
|
@ -14,10 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
# to handle ynh_systemd_action problems
|
||||
ynh_clean_check_starting
|
||||
### 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
|
||||
ynh_abort_if_errors
|
||||
|
@ -26,12 +23,12 @@ ynh_abort_if_errors
|
|||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/" # not customizable, so not using: path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# autosynchronization variables
|
||||
autosynchronize=$YNH_APP_ARG_AUTOSYNCHRONIZE
|
||||
couch_url=$YNH_APP_ARG_COUCH_URL
|
||||
|
@ -97,20 +94,23 @@ ynh_script_progression --message="Installing dependencies..." --weight=6
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing NodeJS..." --weight=15
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from conf/app.src
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
|
@ -121,14 +121,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -150,7 +142,7 @@ popd
|
|||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERATE CONFIG FILES
|
||||
|
@ -227,25 +219,11 @@ yunohost service add $app --description="Data storage with a convenient and flex
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting dato app service and building pages..." --weight=60
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=60
|
||||
|
||||
# Start a systemd service (increased timeout, because on some systems the pages could take quite some time to build?)
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
|
||||
#
|
||||
# if [[ $autosynchronize == true ]]; then
|
||||
# # Create a dedicated Fail2Ban config
|
||||
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
# fi
|
||||
#
|
||||
# TODO: would be nice to setup fail2ban, but don't know how to make it work to check logs from systemd
|
||||
# tried `--logpath="systemd"` but didn't work
|
||||
# if enabled, should also enable corresponding parts in remove, restore, backup and upgrade scripts
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
|
|
@ -48,14 +48,8 @@ ynh_remove_systemd_config
|
|||
ynh_script_progression --message="Removing dependencies..." --weight=13
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NodeJS version for dato..." --weight=4
|
||||
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
@ -81,22 +75,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
|
|||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
# #=================================================
|
||||
# # REMOVE FAIL2BAN CONFIGURATION
|
||||
# #=================================================
|
||||
# ynh_script_progression --message="Removing Fail2ban configuration..." --weight=1
|
||||
#
|
||||
# # Remove the dedicated Fail2Ban config
|
||||
# ynh_remove_fail2ban_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
@ -115,6 +93,14 @@ fi
|
|||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
@ -49,16 +48,10 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -67,6 +60,13 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
|
|||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
@ -76,15 +76,6 @@ chown -R root: $final_path
|
|||
[ -d "$final_path/dist" ] || mkdir "$final_path/dist"
|
||||
chown -R $app:$app $final_path/dist $final_path/global $final_path/config
|
||||
|
||||
# #=================================================
|
||||
# # RESTORE FAIL2BAN CONFIGURATION
|
||||
# #=================================================
|
||||
# ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=2
|
||||
#
|
||||
# ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
||||
# ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
||||
# ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -95,11 +86,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
|||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# REINSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing NodeJS..." --weight=15
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -29,13 +29,8 @@ admin_email=$(ynh_app_setting_get --app=$app --key=admin_email)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
### This helper will compare the version of the currently installed app and the version of the upstream package.
|
||||
### $upgrade_type can have 2 different values
|
||||
### - UPGRADE_APP if the upstream app version has changed
|
||||
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
|
@ -46,6 +41,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
|
||||
}
|
||||
|
@ -61,20 +57,28 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
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 --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
# Regenerate config files removed in upgrade
|
||||
ynh_script_progression --message="Regenerating dato config files..." --weight=3
|
||||
dato_setup_config_files
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -92,21 +96,8 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# UPGRADE NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing NodeJS..." --weight=15
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
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 --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
@ -127,7 +118,7 @@ popd
|
|||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -162,14 +153,6 @@ ynh_script_progression --message="Starting dato app service and building pages..
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
# #=================================================
|
||||
# # UPGRADE FAIL2BAN
|
||||
# #=================================================
|
||||
# ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=2
|
||||
#
|
||||
# # Create a dedicated Fail2Ban config
|
||||
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue