mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
Manifest v2
This commit is contained in:
parent
1dd5f23786
commit
e288f029a9
24 changed files with 371 additions and 1016 deletions
|
@ -1,29 +0,0 @@
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld"
|
|
||||||
is_public=1
|
|
||||||
admin="john"
|
|
||||||
password="1Strong-Password"
|
|
||||||
name="My_Pleroma"
|
|
||||||
registration=0
|
|
||||||
cache=1
|
|
||||||
size="5g"
|
|
||||||
; Checks
|
|
||||||
pkg_linter=1
|
|
||||||
setup_sub_dir=0
|
|
||||||
setup_root=1
|
|
||||||
setup_nourl=0
|
|
||||||
setup_private=1
|
|
||||||
setup_public=1
|
|
||||||
upgrade=1
|
|
||||||
# 2.4.1~ynh1
|
|
||||||
upgrade=1 from_commit=e6d9935af254018baf326281662c55407170694d
|
|
||||||
# 2.4.3~ynh1
|
|
||||||
upgrade=1 from_commit=ba16bc8bee7715c479a7ee575ec5f7d9970a84f8
|
|
||||||
backup_restore=1
|
|
||||||
multi_instance=0
|
|
||||||
port_already_use=0
|
|
||||||
change_url=1
|
|
||||||
;;; Options
|
|
||||||
Email=
|
|
||||||
Notification=none
|
|
|
@ -1,6 +0,0 @@
|
||||||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/241073/artifacts/download?file_type=archive
|
|
||||||
SOURCE_SUM=ce5b861a19a756d3ea26b6e1708c1be954108823d644b1c19036e992c6a6267e
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=zip
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
|
@ -1,6 +0,0 @@
|
||||||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/241077/artifacts/download?file_type=archive
|
|
||||||
SOURCE_SUM=6841a8d258683a70ba8b4466e502022eda865ddfae1ded415a5d1317f29fae16
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=zip
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
|
@ -1,6 +0,0 @@
|
||||||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/241075/artifacts/download?file_type=archive
|
|
||||||
SOURCE_SUM=ff588d370b11939150bd46353274d4b8f879dcfdd87a43eca1bb6fc0a21eec0a
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=zip
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
|
@ -1,2 +1 @@
|
||||||
proxy_cache_path /tmp/__APP__-media-cache levels=1:2 keys_zone=__APP___media_cache:10m max_size=__SIZE__ inactive=720m use_temp_path=off;
|
proxy_cache_path /tmp/__APP__-media-cache levels=1:2 keys_zone=__APP___media_cache:10m max_size=__SIZE__ inactive=720m use_temp_path=off;
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,12 @@ Environment="MIX_ENV=prod"
|
||||||
|
|
||||||
; Make sure that all paths fit your installation.
|
; Make sure that all paths fit your installation.
|
||||||
; Path to the home directory of the user running the Pleroma service.
|
; Path to the home directory of the user running the Pleroma service.
|
||||||
Environment="HOME=__FINALPATH__/live/"
|
Environment="HOME=__INSTALL_DIR__/live/"
|
||||||
; Path to the folder containing the Pleroma installation.
|
; Path to the folder containing the Pleroma installation.
|
||||||
WorkingDirectory=__FINALPATH__/live/
|
WorkingDirectory=__INSTALL_DIR__/live/
|
||||||
; Path to the Pleroma binary.
|
; Path to the Pleroma binary.
|
||||||
ExecStart=__FINALPATH__/live/bin/pleroma start
|
ExecStart=__INSTALL_DIR__/live/bin/pleroma start
|
||||||
ExecStop=__FINALPATH__/live/bin/pleroma stop
|
ExecStop=__INSTALL_DIR__/live/bin/pleroma stop
|
||||||
|
|
||||||
; Some security directives.
|
; Some security directives.
|
||||||
; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops.
|
; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops.
|
||||||
|
|
|
@ -14,3 +14,33 @@ Some information, for all intents and purposes, on the differences between a dir
|
||||||
- The installation of Pleroma with Yunohost is a so-called OTP installation (and not MIX, i.e. from the sources). Have this in mind, as the administration _commands_ are not the same in either case.
|
- The installation of Pleroma with Yunohost is a so-called OTP installation (and not MIX, i.e. from the sources). Have this in mind, as the administration _commands_ are not the same in either case.
|
||||||
|
|
||||||
- All commands must be run as the `pleroma` user, who is _not_ part of Yunohost `admin` group, it’s not possible to invoque these commands directly with `sudo`.
|
- All commands must be run as the `pleroma` user, who is _not_ part of Yunohost `admin` group, it’s not possible to invoque these commands directly with `sudo`.
|
||||||
|
|
||||||
|
Connect with SSH to your Yunohost server as YNH admin user.
|
||||||
|
|
||||||
|
For the commands syntax, have in mind the specificities of [Yunohost Pleroma install](./doc/yunohost.md).
|
||||||
|
|
||||||
|
## Administration tasks
|
||||||
|
|
||||||
|
### Adding users
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user new <userName> <userEmail>"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Password reset
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user reset_password <userName>"
|
||||||
|
```
|
||||||
|
|
||||||
|
This will generate a **password reset link** that you can then send to the user.
|
||||||
|
|
||||||
|
### Moderators
|
||||||
|
|
||||||
|
You can make users **moderators**. They will then be able to _delete any post_.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user set <userName> --admin"
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: `--admin` option will _make the user moderator_ and `--no-admin` will _take away_ the moderator privileges from the user.
|
|
@ -9,8 +9,37 @@ Quelques informations, à toutes fins utiles, sur les différences entre une ins
|
||||||
| Fichier de configuration | `/etc/pleroma/config.exs` | `/etc/pleroma/config.exs` |
|
| Fichier de configuration | `/etc/pleroma/config.exs` | `/etc/pleroma/config.exs` |
|
||||||
| Ligne de commandes | `/bin/pleroma_ctl` | `/var/www/pleroma/live/bin/pleroma_ctl` |
|
| Ligne de commandes | `/bin/pleroma_ctl` | `/var/www/pleroma/live/bin/pleroma_ctl` |
|
||||||
|
|
||||||
## A noter
|
## À noter
|
||||||
|
|
||||||
- L’installation de Pleroma avec Yunohost est une installation dite OTP (et non MIX, c’est à dire à partir des sources). Information à mémoriser, dans la mesure où les commandes d’administration ne sont pas les mêmes dans l’un ou l’autre cas.
|
- L’installation de Pleroma avec Yunohost est une installation dite OTP (et non MIX, c’est à dire à partir des sources). Information à mémoriser, dans la mesure où les commandes d’administration ne sont pas les mêmes dans l’un ou l’autre cas.
|
||||||
|
|
||||||
- Toutes les commandes doivent être exécutées en tant qu’utilisateur `pleroma`, qui n’est _pas_ membre du groupe `admin` de Yunohost, celle-ci ne peuvent donc être invoquées directement avec `sudo`.
|
- Toutes les commandes doivent être exécutées en tant qu’utilisateur `pleroma`, qui n’est _pas_ membre du groupe `admin` de Yunohost, celle-ci ne peuvent donc être invoquées directement avec `sudo`.
|
||||||
|
|
||||||
|
## Tâches d’administration
|
||||||
|
|
||||||
|
Se connecter avec SSH à votre serveur Yunohost avec le compte admin (nous parlons ici de l’admin YNH pas de l’admin de Pleroma).
|
||||||
|
Pour la syntaxe des commandes, garder en tête les spécificités d’une installations de [Pleroma avec Yunohost](./doc/yunohost_fr.md).
|
||||||
|
|
||||||
|
### Ajouter un utilisateur ou utilisatrice
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user new <userName> <userEmail>"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changer de mot de passe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user reset_password <userName>"
|
||||||
|
```
|
||||||
|
|
||||||
|
Ceci générera un **lien de réinitialisation** (URL) du mot de passe, que vous pouvez envoyer à l’utilisateur ou utilisatrice.
|
||||||
|
|
||||||
|
### Modérateurs
|
||||||
|
|
||||||
|
Vous pouvez donner à des utilisateurs ou utilisatrices les droits de **modération**. Ils ou elles pourront alors _supprimer_ n’importe quel billet publié par n’importe quel autre compte.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user set <userName> --admin"
|
||||||
|
```
|
||||||
|
|
||||||
|
Note : l’option `--admin` donne au compte _les droits de moderation_ et avec l’option `--no-admin` à l’inverse on _enlève_ les privilèges de modération de celui-ci.
|
|
@ -1,38 +0,0 @@
|
||||||
## Limitations
|
|
||||||
|
|
||||||
- **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld
|
|
||||||
- **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**.
|
|
||||||
- This package is currently set to **single-instance** that means you can run a **single Pleroma instance** on a **single server**.
|
|
||||||
- The admin **password** entered when installing must **not** contain **special characters**. (See [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
|
|
||||||
- LDAP supported but HTTP auth not.
|
|
||||||
|
|
||||||
## Admin Tasks
|
|
||||||
|
|
||||||
Connect with SSH to your Yunohost server as YNH admin user.
|
|
||||||
For the commands syntax, have in mind the specificities of [Yunohost Pleroma install](./doc/yunohost.md).
|
|
||||||
|
|
||||||
|
|
||||||
### Adding users
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user new <userName> <userEmail>"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Password reset
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user reset_password <userName>"
|
|
||||||
```
|
|
||||||
|
|
||||||
This will generate a **password reset link** that you can then send to the user.
|
|
||||||
|
|
||||||
### Moderators
|
|
||||||
|
|
||||||
You can make users **moderators**. They will then be able to _delete any post_.
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user set <userName> --admin"
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: `--admin` option will _make the user moderator_ and `--no-admin` will _take away_ the moderator privileges from the user.
|
|
|
@ -1,37 +0,0 @@
|
||||||
## Limitations
|
|
||||||
|
|
||||||
- Pleroma doit impérativement s’installer sur son propre **nom de domaine dédié** (ou sous-domaine), par ex. pleroma.domain.tld
|
|
||||||
- Pleroma nécessite par ailleurs un **certificat SSL** valide activé sur ce domaine. Yunohost peut installer et configurer un **certificat Letsencrypt** pour le domaine depuis l’interface d'administration de Yunohost ou avec la ligne de commande.
|
|
||||||
- Ce paquet est actuellement configuré pour une **instance unique**, c’est-à-dire que l’on ne peut installer _qu’une seule instance_ de Pleroma sur un même serveur Yunohost.
|
|
||||||
- Le **mot de passe** saisi durant l’installation ne doit _en aucun cas_ contenir de **caractères spéciaux**. (Voir [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
|
|
||||||
- L’authentification LDAP fonctionne, mais pas `HTTP auth` en revanche.
|
|
||||||
|
|
||||||
## Tâches d’administration
|
|
||||||
|
|
||||||
Se connecter avec SSH à votre serveur Yunohost avec le compte admin (nous parlons ici de l’admin YNH pas de l’admin de Pleroma).
|
|
||||||
Pour la syntaxe des commandes, garder en tête les spécificités d’une installations de [Pleroma avec Yunohost](./doc/yunohost_fr.md).
|
|
||||||
|
|
||||||
|
|
||||||
### Ajouter un utilisateur ou utilisatrice
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user new <userName> <userEmail>"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Changer de mot de passe
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user reset_password <userName>"
|
|
||||||
```
|
|
||||||
|
|
||||||
Ceci générera un **lien de réinitialisation** (URL) du mot de passe, que vous pouvez envoyer à l’utilisateur ou utilisatrice.
|
|
||||||
|
|
||||||
### Modérateurs
|
|
||||||
|
|
||||||
Vous pouvez donner à des utilisateurs ou utilisatrices les droits de **modération**. Ils ou elles pourront alors _supprimer_ n’importe quel billet publié par n’importe quel autre compte.
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo su pleroma -s $SHELL -lc "/var/www/pleroma/live/bin/pleroma_ctl user set <userName> --admin"
|
|
||||||
```
|
|
||||||
|
|
||||||
Note : l’option `--admin` donne au compte _les droits de moderation_ et avec l’option `--no-admin` à l’inverse on _enlève_ les privilèges de modération de celui-ci.
|
|
6
doc/PRE_INSTALL.md
Normal file
6
doc/PRE_INSTALL.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
- **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld
|
||||||
|
- **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**.
|
||||||
|
- This package is currently set to **single-instance** that means you can run a **single Pleroma instance** on a **single server**.
|
||||||
|
- The admin **password** entered when installing must **not** contain **special characters**. (See [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
|
6
doc/PRE_INSTALL_fr.md
Normal file
6
doc/PRE_INSTALL_fr.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
- Pleroma doit impérativement s’installer sur son propre **nom de domaine dédié** (ou sous-domaine), par ex. pleroma.domain.tld
|
||||||
|
- Pleroma nécessite par ailleurs un **certificat SSL** valide activé sur ce domaine. Yunohost peut installer et configurer un **certificat Letsencrypt** pour le domaine depuis l’interface d'administration de Yunohost ou avec la ligne de commande.
|
||||||
|
- Ce paquet est actuellement configuré pour une **instance unique**, c’est-à-dire que l’on ne peut installer _qu’une seule instance_ de Pleroma sur un même serveur Yunohost.
|
||||||
|
- Le **mot de passe** saisi durant l’installation ne doit _en aucun cas_ contenir de **caractères spéciaux**. (Voir [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
|
100
manifest.json
100
manifest.json
|
@ -1,100 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Pleroma",
|
|
||||||
"id": "pleroma",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "Federated social networking server built on open protocols",
|
|
||||||
"fr": "Serveur de réseautage social fédéré basé sur des protocoles ouverts"
|
|
||||||
},
|
|
||||||
"version": "2.5.5~ynh1",
|
|
||||||
"url": "https://pleroma.social/",
|
|
||||||
"upstream": {
|
|
||||||
"license": "AGPL-3.0-only",
|
|
||||||
"website": "https://pleroma.social/",
|
|
||||||
"admindoc": "https://docs.pleroma.social/",
|
|
||||||
"code": "https://git.pleroma.social/pleroma/pleroma/"
|
|
||||||
},
|
|
||||||
"license": "AGPL-3.0-only",
|
|
||||||
"maintainer": [
|
|
||||||
{
|
|
||||||
"name": "Anmol Sharma",
|
|
||||||
"email": "anmol@datamol.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "yalh76"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 4.3.1.8"
|
|
||||||
},
|
|
||||||
"multi_instance": false,
|
|
||||||
"services": [
|
|
||||||
"nginx"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install": [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_public",
|
|
||||||
"type": "boolean",
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"type": "password"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": "string",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose a name for your Pleroma instance",
|
|
||||||
"fr": "Choisissez un nom pour votre instance Pleroma"
|
|
||||||
},
|
|
||||||
"example": "My_Pleroma",
|
|
||||||
"default": "My_Pleroma"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "registration",
|
|
||||||
"type": "boolean",
|
|
||||||
"ask": {
|
|
||||||
"en": "Should registration be open to users who do not have a YunoHost account on the system?",
|
|
||||||
"fr": "L'inscription doit-elle être ouverte aux utilisateurs qui n'ont pas de compte YunoHost sur le système ?"
|
|
||||||
},
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "cache",
|
|
||||||
"type": "boolean",
|
|
||||||
"ask": {
|
|
||||||
"en": "Enable media-cache for your instance",
|
|
||||||
"fr": "Activer le cache média pour votre instance"
|
|
||||||
},
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "size",
|
|
||||||
"type": "string",
|
|
||||||
"ask": {
|
|
||||||
"en": "Select the cache size. If you did not enabled media-cache in above option then this option will have no effect",
|
|
||||||
"fr": "Sélectionner la taille du cache. Si vous n'avez pas activé le cache média ci-dessus, cette option n'aura aucun effet"
|
|
||||||
},
|
|
||||||
"choices": [
|
|
||||||
"2g",
|
|
||||||
"5g",
|
|
||||||
"10g",
|
|
||||||
"20g",
|
|
||||||
"40g",
|
|
||||||
"80g"
|
|
||||||
],
|
|
||||||
"default": "5g"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
115
manifest.toml
Normal file
115
manifest.toml
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||||
|
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "pleroma"
|
||||||
|
name = "Pleroma"
|
||||||
|
description.en = "Federated social networking server built on open protocols"
|
||||||
|
description.fr = "Serveur de réseautage social fédéré basé sur des protocoles ouverts"
|
||||||
|
|
||||||
|
version = "2.5.5~ynh1"
|
||||||
|
|
||||||
|
maintainers = ["Anmol Sharma", "yalh76"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "AGPL-3.0-only"
|
||||||
|
website = "https://pleroma.social/"
|
||||||
|
admindoc = "https://docs.pleroma.social/"
|
||||||
|
code = "https://git.pleroma.social/pleroma/pleroma/"
|
||||||
|
cpe = "cpe:2.3:a:kpherox:pleroma"
|
||||||
|
fund = "https://liberapay.com/Pleroma-euro/"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">=11.2"
|
||||||
|
architectures = ["amd64", "armhf", "arm64"]
|
||||||
|
multi_instance = false
|
||||||
|
ldap = true
|
||||||
|
sso = false
|
||||||
|
disk = "200M"
|
||||||
|
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "visitors"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
type = "user"
|
||||||
|
|
||||||
|
[install.password]
|
||||||
|
type = "password"
|
||||||
|
|
||||||
|
[install.name]
|
||||||
|
ask.en = "Choose a name for your Pleroma instance"
|
||||||
|
ask.fr = "Choisissez un nom pour votre instance Pleroma"
|
||||||
|
type = "string"
|
||||||
|
example = "My_Pleroma"
|
||||||
|
default = "My_Pleroma"
|
||||||
|
|
||||||
|
[install.registration]
|
||||||
|
ask.en = "Should registration be open to users who do not have a YunoHost account on the system?"
|
||||||
|
ask.fr = "L'inscription doit-elle être ouverte aux utilisateurs qui n'ont pas de compte YunoHost sur le système ?"
|
||||||
|
type = "boolean"
|
||||||
|
default = false
|
||||||
|
|
||||||
|
[install.cache]
|
||||||
|
ask.en = "Enable media-cache for your instance"
|
||||||
|
ask.fr = "Activer le cache média pour votre instance"
|
||||||
|
type = "boolean"
|
||||||
|
default = true
|
||||||
|
|
||||||
|
[install.size]
|
||||||
|
ask.en = "Select the cache size. If you did not enabled media-cache in above option then this option will have no effect"
|
||||||
|
ask.fr = "Sélectionner la taille du cache. Si vous n'avez pas activé le cache média ci-dessus, cette option n'aura aucun effet"
|
||||||
|
type = "select"
|
||||||
|
choices = ["2g", "5g", "10g", "20g", "40g", "80g"]
|
||||||
|
default = "5g"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.sources.main]
|
||||||
|
amd64.url = "https://git.pleroma.social/pleroma/pleroma/-/jobs/241073/artifacts/download?file_type=archive"
|
||||||
|
amd64.sha256 = "ce5b861a19a756d3ea26b6e1708c1be954108823d644b1c19036e992c6a6267e"
|
||||||
|
|
||||||
|
armhf.url = "https://git.pleroma.social/pleroma/pleroma/-/jobs/241075/artifacts/download?file_type=archive"
|
||||||
|
armhf.sha256 = "ff588d370b11939150bd46353274d4b8f879dcfdd87a43eca1bb6fc0a21eec0a"
|
||||||
|
|
||||||
|
arm64.url = "https://git.pleroma.social/pleroma/pleroma/-/jobs/241077/artifacts/download?file_type=archive"
|
||||||
|
arm64.sha256 = "6841a8d258683a70ba8b4466e502022eda865ddfae1ded415a5d1317f29fae16"
|
||||||
|
|
||||||
|
format = "zip"
|
||||||
|
extract = true
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
subdirs = [
|
||||||
|
"uploads", "static", "static/emoji",
|
||||||
|
]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
main.default = 8095
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = [
|
||||||
|
"curl",
|
||||||
|
"unzip",
|
||||||
|
"libncurses5",
|
||||||
|
"imagemagick",
|
||||||
|
"ffmpeg",
|
||||||
|
"exiftool",
|
||||||
|
"libimage-exiftool-perl",
|
||||||
|
"postgresql",
|
||||||
|
"postgresql-contrib",
|
||||||
|
]
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
type = "postgresql"
|
|
@ -4,13 +4,15 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app (must be on a single line)
|
|
||||||
pkg_dependencies="curl unzip libncurses5 postgresql postgresql-contrib imagemagick ffmpeg exiftool libimage-exiftool-perl"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
boolstr() {
|
||||||
|
bool=("false" "true")
|
||||||
|
echo "${bool[$1]}"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,29 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
cache=$(ynh_app_setting_get --app=$app --key=cache)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,37 +19,23 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
ynh_backup --src_path="/etc/nginx/conf.d/$app-cache.conf" --not_mandatory
|
||||||
if [ $cache -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$app-cache.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC BACKUP
|
|
||||||
#=================================================
|
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/$app/"
|
ynh_backup --src_path="/etc/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,62 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
|
||||||
new_path="/"
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# 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
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,36 +18,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
|
||||||
|
|
||||||
pkill -u $app || true
|
pkill -u "$app" || true
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
|
||||||
if [ $change_domain -eq 1 ]
|
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
|
@ -124,15 +46,7 @@ ynh_store_file_checksum --file="$config"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
260
scripts/install
260
scripts/install
|
@ -10,234 +10,117 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# INITIALIZE AND STORE SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
path="/"
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url="/"
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
|
||||||
name="${YNH_APP_ARG_NAME// /_}"
|
|
||||||
registration=$YNH_APP_ARG_REGISTRATION
|
|
||||||
cache=$YNH_APP_ARG_CACHE
|
|
||||||
size=$YNH_APP_ARG_SIZE
|
|
||||||
random_key=$(ynh_string_random --length=64)
|
random_key=$(ynh_string_random --length=64)
|
||||||
|
ynh_app_setting_set --app="$app" --key=random_key --value="$random_key"
|
||||||
signing_salt=$(ynh_string_random --length=8)
|
signing_salt=$(ynh_string_random --length=8)
|
||||||
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
|
ynh_app_setting_set --app="$app" --key=signing_salt --value="$signing_salt"
|
||||||
|
admin_email=$(ynh_user_get_info --username="$admin" --key="mail")
|
||||||
|
ynh_app_setting_set --app="$app" --key=admin_email --value="$admin_email"
|
||||||
|
|
||||||
## Bypass package_checker name not compatible with pleroma
|
## Bypass package_checker name not compatible with pleroma
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
|
||||||
admin="test"
|
admin="test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
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=admin --value=$admin
|
|
||||||
ynh_app_setting_set --app=$app --key=name --value=$name
|
|
||||||
ynh_app_setting_set --app=$app --key=registration --value=$registration
|
|
||||||
ynh_app_setting_set --app=$app --key=cache --value=$cache
|
|
||||||
ynh_app_setting_set --app=$app --key=size --value=$size
|
|
||||||
ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email
|
|
||||||
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
|
|
||||||
ynh_app_setting_set --app=$app --key=signing_salt --value=$signing_salt
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# FIND AND OPEN A PORT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
|
||||||
|
|
||||||
# Find an available port
|
|
||||||
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=1
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
|
||||||
db_user=$db_name
|
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database=$db_name
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
ynh_setup_source --dest_dir="$install_dir/live"
|
||||||
ynh_setup_source --dest_dir="$final_path/live" --source_id=$YNH_ARCH
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:$app "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# UPDATE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
ynh_script_progression --message="Configuring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
if [ $cache -eq 1 ]
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database="$db_name"
|
||||||
then
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name"
|
||||||
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database="$db_name"
|
||||||
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database="$db_name"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SYSTEM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
if [ "$cache" -eq 1 ]; then
|
||||||
ynh_add_config --template="../conf/cache.conf" --destination="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_add_config --template="../conf/cache.conf" --destination="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
|
|
||||||
cat ../conf/media.conf >> ../conf/nginx.conf
|
cat ../conf/media.conf >> ../conf/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
|
||||||
# CREATE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app
|
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
|
||||||
|
|
||||||
mkdir -p $datadir
|
|
||||||
mkdir -p "$datadir/uploads/"
|
|
||||||
mkdir -p "$datadir/static/"
|
|
||||||
mkdir -p "$datadir/static/emoji/"
|
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:$app "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADD A CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
||||||
|
|
||||||
config="/etc/$app/config.exs"
|
|
||||||
|
|
||||||
mkdir -p /etc/$app
|
|
||||||
chown $app:$app /etc/$app
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
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
|
||||||
|
yunohost service add "$app" --description="$app daemon for Pleroma"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MAKE SETUP
|
# MAKE SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Making setup..." --weight=1
|
ynh_script_progression --message="Making setup..." --weight=1
|
||||||
|
|
||||||
pushd $final_path/live
|
config="/etc/$app/config.exs"
|
||||||
#Generate instance
|
mkdir -p "/etc/$app"
|
||||||
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$final_path/live/bin/pleroma_ctl instance gen --force \
|
chown "$app:$app" "/etc/$app"
|
||||||
--output $config \
|
|
||||||
|
# Generate instance
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" -i \
|
||||||
|
"$install_dir/live/bin/pleroma_ctl" instance gen \
|
||||||
|
--force \
|
||||||
|
--output "$config" \
|
||||||
--output-psql /tmp/setup_db.psql \
|
--output-psql /tmp/setup_db.psql \
|
||||||
--domain $domain \
|
--domain "$domain" \
|
||||||
--instance-name \"$name\" \
|
--instance-name "$name" \
|
||||||
--admin-email $admin_email \
|
--admin-email "$admin_email" \
|
||||||
--notify-email $admin_email \
|
--notify-email "$admin_email" \
|
||||||
--dbhost localhost \
|
--dbhost localhost \
|
||||||
--dbname $db_name \
|
--dbname "$db_name" \
|
||||||
--dbuser $db_user \
|
--dbuser "$db_user" \
|
||||||
--dbpass $db_pwd \
|
--dbpass "$db_pwd" \
|
||||||
--rum N \
|
--rum N \
|
||||||
--indexable Y \
|
--indexable Y \
|
||||||
--db-configurable Y \
|
--db-configurable Y \
|
||||||
--uploads-dir $datadir/uploads \
|
--uploads-dir "$data_dir/uploads" \
|
||||||
--static-dir $datadir/static \
|
--static-dir "$data_dir/static" \
|
||||||
--listen-ip 127.0.0.1 \
|
--listen-ip 127.0.0.1 \
|
||||||
--listen-port $port \
|
--listen-port "$port" \
|
||||||
--strip-uploads-location Y \
|
--strip-uploads-location Y \
|
||||||
--read-uploads-description Y \
|
--read-uploads-description Y \
|
||||||
--anonymize-uploads Y \
|
--anonymize-uploads Y \
|
||||||
--dedupe-uploads Y"
|
--dedupe-uploads Y
|
||||||
popd
|
|
||||||
|
|
||||||
cat "../conf/ldap.exs" >> "$config"
|
cat "../conf/ldap.exs" >> "$config"
|
||||||
|
|
||||||
ynh_replace_string --match_string="config :pleroma, configurable_from_database: false" --replace_string="config :pleroma, configurable_from_database: true" --target_file="$config"
|
ynh_replace_string --target_file="$config" \
|
||||||
registration_bool_value=`(($registration)) && echo "true" || echo "false"`
|
--match_string="config :pleroma, configurable_from_database: false" \
|
||||||
ynh_replace_string --match_string="registrations_open: true" --replace_string="registrations_open: $registration_bool_value" --target_file="$config"
|
--replace_string="config :pleroma, configurable_from_database: true"
|
||||||
|
|
||||||
pushd $final_path/live
|
ynh_replace_string --target_file="$config" \
|
||||||
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$final_path/live/bin/pleroma_ctl migrate"
|
--match_string="registrations_open: true" \
|
||||||
|
--replace_string="registrations_open: $(boolstr "$registration")"
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
ynh_exec_warn_less ynh_exec_as "$app" -i "$install_dir/live/bin/pleroma_ctl" migrate
|
||||||
|
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
||||||
|
|
||||||
# Add user
|
# Add user
|
||||||
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$final_path/live/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y"
|
ynh_exec_warn_less ynh_exec_as "$app" -i "$install_dir/live/bin/pleroma_ctl" user new "$admin" "$admin_email" --password "$password" --moderator --admin -y
|
||||||
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path=systemd
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
|
|
||||||
popd
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum --file="$config"
|
ynh_store_file_checksum --file="$config"
|
||||||
|
|
||||||
chmod 400 "$config"
|
chmod 400 "$config"
|
||||||
chown $app:$app "$config"
|
chown "$app:$app" "$config"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="$app daemon for Pleroma"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -245,32 +128,7 @@ yunohost service add $app --description="$app daemon for Pleroma"
|
||||||
ynh_script_progression --message="Starting a systemd service..." --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=systemd --line_match="Access Pleroma.Web.Endpoint"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Everyone can access to the api part
|
|
||||||
# We don't want to display the tile in the sso so we put --show_tile="false"
|
|
||||||
# And we don't want that the YunoHost Admin can remove visitors group to this permission, so we put --protected="true"
|
|
||||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# POST INSTALL
|
# POST INSTALL
|
||||||
|
@ -278,7 +136,7 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
# Correct path to 'static dir' in DB
|
# Correct path to 'static dir' in DB
|
||||||
# This must be done when Pleroma is running (i.e. after install and start)
|
# This must be done when Pleroma is running (i.e. after install and start)
|
||||||
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$final_path/live/bin/pleroma_ctl config migrate_to_db"
|
ynh_exec_warn_less ynh_exec_as "$app" -i "$install_dir/live/bin/pleroma_ctl" config migrate_to_db
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
103
scripts/remove
103
scripts/remove
|
@ -10,118 +10,27 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# 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..." --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
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
|
|
||||||
|
|
||||||
pkill -u $app || true
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
|
||||||
|
pkill -u "$app" || true
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DATA DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the data directory if --purge option is used
|
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
|
||||||
ynh_secure_remove --file="$datadir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
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
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $port..." --weight=1
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing various files..." --weight=1
|
|
||||||
|
|
||||||
# Remove a directory securely
|
|
||||||
ynh_secure_remove --file="/etc/$app"
|
ynh_secure_remove --file="/etc/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
136
scripts/restore
136
scripts/restore
|
@ -10,113 +10,47 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading 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)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
cache=$(ynh_app_setting_get --app=$app --key=cache)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chown -R "$app:$app" "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:$app "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir
|
chown -R "$app:$app" "$data_dir"
|
||||||
mkdir -p "$datadir/uploads/"
|
|
||||||
mkdir -p "$datadir/static/"
|
|
||||||
mkdir -p "$datadir/static/emoji/"
|
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:$app "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
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"
|
|
||||||
|
|
||||||
if [ $cache -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$app-cache.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database="$db_name"
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name"
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database="$db_name"
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database="$db_name"
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --database=$db_name
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database=$db_name
|
|
||||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$app-cache.conf" --not_mandatory
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
|
systemctl enable "$app.service" --quiet
|
||||||
|
yunohost service add "$app" --description="$app daemon for Pleroma"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -124,36 +58,16 @@ ynh_script_progression --message="Restoring various files..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/$app/"
|
ynh_restore_file --origin_path="/etc/$app/"
|
||||||
chmod 400 "/etc/$app/config.exs"
|
chmod 400 "/etc/$app/config.exs"
|
||||||
chown $app:$app "/etc/$app/config.exs"
|
chown "$app:$app" "/etc/$app/config.exs"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
||||||
systemctl enable $app.service --quiet
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="$app daemon for Pleroma"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
242
scripts/upgrade
242
scripts/upgrade
|
@ -7,64 +7,8 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_package_version
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading 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)
|
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
admin_email=$(ynh_app_setting_get --app=$app --key=admin_email)
|
|
||||||
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
|
||||||
name=$(ynh_app_setting_get --app=$app --key=name)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
cache=$(ynh_app_setting_get --app=$app --key=cache)
|
|
||||||
size=$(ynh_app_setting_get --app=$app --key=size)
|
|
||||||
registration=$(ynh_app_setting_get --app=$app --key=registration)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Checking version..." --weight=1
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION NUMBER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Checking version number..." --weight=1
|
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
|
||||||
sleep 60
|
|
||||||
fi
|
|
||||||
abort_if_up_to_date
|
|
||||||
# previous function is what defines 'version', more precisely the 'previous version'
|
|
||||||
previous_version="${version}"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,8 +18,8 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
|
||||||
|
|
||||||
if ynh_version_gt "${previous_version}" "1.1.1~ynh1" ; then
|
if ynh_compare_current_package_version --comparison gt --version "1.1.1~ynh1"; then
|
||||||
pkill -u $app || true
|
pkill -u "$app" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -83,158 +27,90 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
if [ -n "${psql_db:-}" ]; then
|
||||||
if ynh_legacy_permissions_exists; then
|
ynh_app_setting_delete --app="$app" --key=psql_db
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a permission if needed
|
|
||||||
if ! ynh_permission_exists --permission="api"; then
|
|
||||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
|
||||||
if [ -z "$db_name" ]; then
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If db_user doesn't exist, create it
|
|
||||||
if [ -z "$db_user" ]; then
|
|
||||||
db_user=$db_name
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If db_pwd doesn't exist, create it
|
|
||||||
if [ -z "$db_pwd" ]; then
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
|
||||||
ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Switch variables name
|
|
||||||
psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
|
|
||||||
|
|
||||||
if [ -n "$psql_db" ]
|
|
||||||
then
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
|
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|
||||||
ynh_app_setting_delete --app=$app --key=psql_db
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Close a port
|
# Close a port
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"; then
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $port..."
|
ynh_script_progression --message="Closing port $port..."
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
ynh_exec_warn_less yunohost firewall disallow TCP "$port"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove old repository
|
# Remove old repository
|
||||||
ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list"
|
||||||
apt-key del A14F4FCA
|
apt-key del A14F4FCA
|
||||||
|
|
||||||
# Switch to $final_path/live
|
# Switch to $install_dir/live
|
||||||
if [ ! -d "$final_path/live" ]; then
|
if [ ! -d "$install_dir/live" ]; then
|
||||||
mv $final_path/$app $final_path/live
|
mv "$install_dir/$app" "$install_dir/live"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE TO OTP RELEASE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
config="/etc/$app/config.exs"
|
config="/etc/$app/config.exs"
|
||||||
|
|
||||||
|
# if ynh_compare_current_package_version --comparison gt --version "1.1.1~ynh1"; then
|
||||||
if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then
|
if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then
|
||||||
ynh_script_progression --message="Upgrading to OTP release..." --weight=1
|
ynh_script_progression --message="Upgrading to OTP release..." --weight=1
|
||||||
|
|
||||||
# Define app's data directory
|
# Give permission to the data_dir
|
||||||
datadir="/home/yunohost.app/${app}"
|
chown -R "$app":"$app" "$data_dir"
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value="$datadir"
|
|
||||||
|
|
||||||
# Create app folders
|
rsync -a "$install_dir/live/uploads/" "$data_dir/uploads/"
|
||||||
mkdir -p "$datadir/"
|
if [ -d "$install_dir/live/instance/static/" ]; then
|
||||||
mkdir -p "$datadir/uploads/"
|
rsync -a "$install_dir/live/instance/static/" "$data_dir/static/"
|
||||||
mkdir -p "$datadir/static/"
|
|
||||||
mkdir -p "$datadir/static/emoji/"
|
|
||||||
|
|
||||||
# Give permission to the datadir
|
|
||||||
chown -R "$app":"$app" "$datadir"
|
|
||||||
|
|
||||||
rsync -a "$final_path/live/uploads/" "$datadir/uploads/"
|
|
||||||
if [ -d "$final_path/live/instance/static/" ]; then
|
|
||||||
rsync -a "$final_path/live/instance/static/" "$datadir/static/"
|
|
||||||
fi
|
fi
|
||||||
|
rsync -a "$install_dir/live/priv/static/emoji/" "$data_dir/static/emoji/"
|
||||||
|
|
||||||
rsync -a "$final_path/live/priv/static/emoji/" "$datadir/static/emoji/"
|
mkdir -p "/etc/$app"
|
||||||
|
chown -R "$app" "/etc/$app"
|
||||||
mkdir -p /etc/$app
|
mv "$install_dir/live/config/prod.secret.exs" "$config"
|
||||||
chown -R $app /etc/$app
|
ynh_replace_string --target_file="$config" \
|
||||||
mv $final_path/live/config/prod.secret.exs $config
|
--match_string="use Mix.Config" \
|
||||||
ynh_replace_string --match_string="use Mix.Config" --replace_string="import Config" --target_file="$config"
|
--replace_string="import Config"
|
||||||
echo "config :pleroma, :instance, static_dir: \"/home/yunohost.app/$app/static\"" >> $config
|
echo "config :pleroma, :instance, static_dir: \"/home/yunohost.app/$app/static\"" >> "$config"
|
||||||
echo "config :pleroma, Pleroma.Uploaders.Local, uploads: \"/home/yunohost.app/$app/uploads\"" >> $config
|
echo "config :pleroma, Pleroma.Uploaders.Local, uploads: \"/home/yunohost.app/$app/uploads\"" >> "$config"
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$config"
|
ynh_backup_if_checksum_is_different --file="$config"
|
||||||
|
|
||||||
ynh_secure_remove --file="$final_path/live"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if ynh_compare_current_package_version --comparison gt --version "2.0.5~ynh1"; then
|
||||||
if ynh_version_gt "2.0.5~ynh1" "${previous_version}" ; then
|
if ynh_version_gt "2.0.5~ynh1" "${previous_version}" ; then
|
||||||
cat "../conf/ldap.exs" >> "$config"
|
cat "../conf/ldap.exs" >> "$config"
|
||||||
ynh_replace_string --match_string="config :pleroma, configurable_from_database: false" --replace_string="config :pleroma, configurable_from_database: true" --target_file="$config"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ynh_version_gt "2.4.4~ynh2" "${previous_version}"; then
|
ynh_replace_string --target_file="$config" \
|
||||||
registration_bool_value=`(($registration)) && echo "true" || echo "false"`
|
--match_string="config :pleroma, configurable_from_database: false" \
|
||||||
ynh_replace_string --match_string='registrations_open: true' --replace_string="registrations_open: $registration_bool_value" --target_file="$config"
|
--replace_string="config :pleroma, configurable_from_database: true"
|
||||||
fi
|
|
||||||
|
ynh_replace_string --target_file="$config" \
|
||||||
|
--match_string='registrations_open: true' \
|
||||||
|
--replace_string="registrations_open: $(boolstr "$registration")"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
ynh_setup_source --dest_dir="$install_dir/live" --full_replace
|
||||||
then
|
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
|
||||||
|
|
||||||
ynh_secure_remove --file="$final_path/live"
|
chown -R "$app:$app" "$install_dir"
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
ynh_setup_source --dest_dir="$final_path/live" --source_id=$YNH_ARCH
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:$app "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
if [ "$cache" -eq 1 ]; then
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
if [ $cache -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_add_config --template="../conf/cache.conf" --destination="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_add_config --template="../conf/cache.conf" --destination="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
|
|
||||||
cat ../conf/media.conf >> ../conf/nginx.conf
|
cat ../conf/media.conf >> ../conf/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
ynh_add_systemd_config
|
||||||
|
yunohost service add "$app" --description="$app daemon for Pleroma"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -242,9 +118,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Making upgrade..." --weight=1
|
ynh_script_progression --message="Making upgrade..." --weight=1
|
||||||
|
|
||||||
pushd $final_path/live
|
ynh_exec_warn_less ynh_exec_as "$app" -i "$install_dir/live/bin/pleroma_ctl" migrate
|
||||||
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$final_path/live/bin/pleroma_ctl migrate"
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
|
@ -256,38 +130,14 @@ config="/etc/$app/config.exs"
|
||||||
ynh_backup_if_checksum_is_different --file="$config"
|
ynh_backup_if_checksum_is_different --file="$config"
|
||||||
|
|
||||||
chmod 400 "$config"
|
chmod 400 "$config"
|
||||||
chown $app:$app "$config"
|
chown "$app:$app" "$config"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="$app daemon for Pleroma"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Access Pleroma.Web.Endpoint"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
read_json () {
|
|
||||||
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
|
|
||||||
}
|
|
||||||
|
|
||||||
read_manifest () {
|
|
||||||
if [ -f '../manifest.json' ] ; then
|
|
||||||
read_json '../manifest.json' "$1"
|
|
||||||
else
|
|
||||||
read_json '../settings/manifest.json' "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
abort_if_up_to_date () {
|
|
||||||
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
|
|
||||||
last_version=$(read_manifest 'version')
|
|
||||||
if [ "${version}" = "${last_version}" ] && [ "$YNH_APP_UPGRADE_TYPE" != "UPGRADE_FORCED" ]; then
|
|
||||||
ynh_print_info "Up-to-date, nothing to do"
|
|
||||||
ynh_die "" 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_version_gt ()
|
|
||||||
{
|
|
||||||
dpkg --compare-versions "$1" gt "$2"
|
|
||||||
}
|
|
8
tests.toml
Normal file
8
tests.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||||
|
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
test_upgrade_from.e6d9935af254018baf326281662c55407170694d.name = "2.4.1"
|
||||||
|
test_upgrade_from.ba16bc8bee7715c479a7ee575ec5f7d9970a84f8.name = "2.4.3"
|
Loading…
Add table
Reference in a new issue