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

Merge pull request #169 from YunoHost-Apps/testing

Composer helpers are now official in v4.2 + Apply example_ynh
This commit is contained in:
tituspijean 2021-05-16 17:01:37 +02:00 committed by GitHub
commit 41f6aa3846
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 394 additions and 336 deletions

View file

@ -1,46 +1,55 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *Otherwise, the issue may be due to Flarum itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
### Describe the bug
*A clear and concise description of what the bug is.*
**Versions**
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install flarum
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
**Expected behavior**
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -1,43 +0,0 @@
---
name: Bug report
about: Create a report to help us debug
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *If the issue is about logging in and out of the forum, it is most likely due to the SSOwat extension. Please post the issue on its [repository](https://github.com/tituspijean/flarum-ext-auth-ssowat/issue).*
- *Otherwise, the issue may be due to Flarum itself. Refer to its [forum](https://discuss.flarum.org) for help.*
- *If you have a doubt, post here, we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
*A clear and concise description of what the bug is.*
**Versions**
- YunoHost version:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install flarum
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
4. *See error*
**Expected behavior**
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

105
README.md
View file

@ -1,46 +1,60 @@
---
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Flarum for YunoHost
[![Integration level](https://dash.yunohost.org/integration/flarum.svg)](https://dash.yunohost.org/appci/app/flarum) ![](https://ci-apps.yunohost.org/ci/badges/flarum.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/flarum.maintain.svg)
[![Install Flarum with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=flarum)
[![Integration level](https://dash.yunohost.org/integration/flarum.svg)](https://dash.yunohost.org/appci/app/flarum) ![](https://ci-apps.yunohost.org/ci/badges/flarum.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/flarum.maintain.svg)
[![Install flarum with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=flarum)
> *This package allows you to install Flarum quickly and simply on a YunoHost server.
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install flarum quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
[Flarum](http://flarum.org/), an open-source forum software, packaged for [YunoHost](https://yunohost.org/), a self-hosting server operating server.
**Shipped version:** 0.1.0-beta.16
Next-generation forum made simple.
**Shipped version:** 0.1.0.16~ynh4
**Demo:** https://discuss.flarum.org/d/21101-demos-come-to-flarum
## Screenshots
![](https://flarum.org/assets/img/home-screenshot.png)
## Features
![](./doc/screenshots/beta16.jpg)
- All Flarum features, see its [documentation](http://flarum.org/docs/)
- LDAP integration through a [dedicated extension](https://github.com/tituspijean/flarum-ext-auth-ldap).
## Installation
This Flarum package can be installed through:
- YunoHost's webadmin, in the Community listing
- YunoHost's CLI: `yunohost app install https://github.com/YunoHost-Apps/flarum_ynh`.
Required parameters are:
- `domain`
- `path`
- `admin`, among the YunoHosts users
- `public`, *true* by default, for guests to read the forum
- `title` of the forum
- `language` can be English `en` (by default), French `fr`, and German `de`. Other languages are installable after installation like any other extensions
## Disclaimers / important information
### Installing
- The installation requires at least 1GB of free memory. A swap file of this size will be created if needed.
- You can select the default language (among English `en` by default, French `fr`, and German `de`). Other languages can be added after installation like any other extension.
### Using
After installation, simply open your browser to Flarum's page. First loading may be a bit longer as assets are generated.
## Upgrading
This app allows your YunoHost users to log in with a [dedicated LDAP extension](https://github.com/tituspijean/flarum-ext-auth-ldap). By default, the standard logging method is hidden.
To allow non-YunoHost users to log in, the LDAP extension setting is in the admin panel.
Note that all third-party extensions are removed upon upgrading.
### Upgrading
## Adding extensions after installation
Note that, for the moment, all third-party extensions are removed upon upgrading.
### Adding extensions
Flarum does not offer to install extensions from its admin panel yet, so you need to use the command line.
Replace `flarum` with your app ID in case of multiple installations.
Replace `vendor/extension` with the appropriate names. Read the extension documentation if it requires additional steps.
@ -52,57 +66,32 @@ cd /var/www/$app
sudo -u $app php7.3 composer.phar require vendor/extension
```
## Troubleshooting
#### Troubleshooting
### `Low memory` errors
A swapfile will enable your system to extend its limited memory through its disk capacity. The following commands will create a 1 GB swapfile.
```
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```
Then add this line in `/etc/fstab`:
```
/swapfile none swap sw 0 0
```
Reboot the system and try the installation again.
### `Timeout` errors
##### `Timeout` errors
Some users have reported a successful installation, but get a blank page due to a `timeout` on a PHP script that prepares the forum assests (`Minify.php`, notably).
In `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, you can increase the `max_execution_time` and `max_input_time` limits (both values are in seconds if nothing is specified).
Reload PHP-FPM with `sudo service php*php_version*-fpm reload`.
### Upload limit
##### Upload limit
If you are facing an error while uploading large files into the forum, PHP may be limiting file upload.
In `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, you can uncomment (remove `;` at the beginning of the line) and increase the values of `upload_max_filesize` and `post_max_size` (both values are in bytes).
Reload PHP-FPM with `sudo service php*php_version*-fpm reload`.
## Documentation
* Official documentation: https://flarum.org/docs/
## YunoHost specific features
## Documentation and resources
#### Supported architectures
* Official app website: https://flarum.org
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/flarum%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/flarum/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/flarum%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/flarum/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/flarum_ynh/issues
* App website: https://flarum.org/
* Upstream app repository: https://github.com/flarum/flarum
* YunoHost website: https://yunohost.org/
---
* Official admin documentation: https://docs.flarum.org
* Upstream app code repository: https://github.com/flarum/flarum
* YunoHost documentation for this app: https://yunohost.org/app_flarum
* Report a bug: https://github.com/YunoHost-Apps/flarum_ynh/issues
## Developer info
@ -114,3 +103,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/flarum_ynh/tree/testi
or
sudo yunohost app upgrade flarum -u https://github.com/YunoHost-Apps/flarum_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

100
README_fr.md Normal file
View file

@ -0,0 +1,100 @@
# Flarum pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/flarum.svg)](https://dash.yunohost.org/appci/app/flarum) ![](https://ci-apps.yunohost.org/ci/badges/flarum.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/flarum.maintain.svg)
[![Installer flarum avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=flarum)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install flarum quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Vue d'ensemble
Un forum de nouvelle génération, simplement.
**Version incluse:** 0.1.0.16~ynh4
**Démo:** https://discuss.flarum.org/d/21101-demos-come-to-flarum
## Captures d'écran
![](./doc/screenshots/beta16.jpg)
## Avertissements / informations importantes
### Installation
- L'installation nécessite au moins 1 Go de mémoire vive libre. Un fichier *swap* de cette taille sera créé si nécessaire.
- Vous pouvez sélectionner la langue par défaut dans les paramètres d'installation (parmi l'anglais `en`, le français `fr` et l'allemand `de`). Les autres langues sont installables comme n'importe quelle autre extension.
### Utilisation
Après l'installation, ouvrez simplement votre navigateur à la page de Flarum. Le premier chargement peut être un peu retardé par la génération du cache.
Cette app permet à vos utilisateurs enregistrés dans YunoHost de se connecter avec une [extension LDAP dédiée](https://github.com/tituspijean/flarum-ext-auth-ldap). Par défaut, la méthode de connexion standard est cachée.
Pour permettre à des utilisateurs non-YunoHost de se connecter, référez-vous au menu de configuration de l'extension LDAP dans le panneau d'administration de Flarum.
### Mise à jour
Notez que, pour le moment, toute extension tierce est désinstallée lors d'une mise à jour.
Leurs données et paramètres restent dans la base de donnée de Flarum, seule une réinstallation est nécessaire.
### Ajouter des extensions
Flarum ne permet pas encore d'installer des extensions depuis son interface d'administration ; vous devrez donc utiliser la ligne de commande.
Remplacez `flarum` par l'ID de votre app en cas de multiple installations.
Remplacez `vendor/extension` par les noms adéquats. Référez-vous à la documentation de l'extension pour vérifier qu'elle ne nécessite pas de configuration supplémentaire.
```bash
sudo su
app=flarum
cd /var/www/$app
sudo -u $app php7.3 composer.phar require vendor/extension
```
#### Dépannage
##### Erreurs de `timeout`
Quelques utilisateurs rapportent qu'ils font fassent à une page blanche due à une erreur de `timeout` dans un script PHP qui prépare le cache (`Minify.php`, notamment).
Dans `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, vous pouvez augmenter les limites `max_execution_time` et `max_input_time` (les deux valeurs sont en secondes si vous ne précisez pas d'unité).
Rechargez PHP-FPM avec `sudo service php*php_version*-fpm reload`.
##### Limite de téléversement
Si vous avez une erreur lors du chargement de gros fichiers dans le forum, PHP pourrait être en train de limiter les téléversements.
Dans `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, vous pouvez décommenter (enlevez `;` au début de la ligne) et augmenter les valeurs de `upload_max_filesize` de `post_max_size` (les deux valeurs sont en octets).
Rechargez PHP-FPM avec `sudo service php*php_version*-fpm reload`.
## Documentations et ressources
* Site official de l'app : https://flarum.org
* Documentation officielle de l'admin: https://docs.flarum.org
* Dépôt de code officiel de l'app: https://github.com/flarum/flarum
* Documentation YunoHost pour cette app: https://yunohost.org/app_flarum
* Signaler un bug: https://github.com/YunoHost-Apps/flarum_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/flarum_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/flarum_ynh/tree/testing --debug
or
sudo yunohost app upgrade flarum -u https://github.com/YunoHost-Apps/flarum_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications:** https://yunohost.org/packaging_apps

View file

@ -1,17 +1,12 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
domain="domain.tld"
path="/path"
admin="john"
language="fr"
is_public=1 (PUBLIC|public=1|private=0)
is_public=1
password="pass"
port="666" (PORT)
port="666"
title="Forum"
; Checks
pkg_linter=1
@ -21,7 +16,9 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=0d30809a2903544a660635f62a25bc6057ea2f15
# upgrade=1 from_commit=0d30809a2903544a660635f62a25bc6057ea2f15
# upgrade=1 from_commit=0175b7a3b0a551e14f39c65290d194ccc71cd6ee
# upgrade=1 from_commit=70e962faa875070b0fcc29f45cc70e2a51de76a6
backup_restore=1
multi_instance=1
port_already_use=0
@ -33,3 +30,9 @@ Notification=none
; commit=0d30809a2903544a660635f62a25bc6057ea2f15
name=2021-02-19 0.1.0.14~ynh2
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&title=Forum&
; commit=0175b7a3b0a551e14f39c65290d194ccc71cd6ee
name=2021-03-21 0.1.0.14~ynh3
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=PASSWORD&language=fr&is_public=1&title=Forum&
; commit=70e962faa875070b0fcc29f45cc70e2a51de76a6
name=2021-05-06 0.1.0.16~ynh2
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=PASSWORD&language=fr&is_public=1&title=Forum&

45
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,45 @@
### Installing
- The installation requires at least 1GB of free memory. A swap file of this size will be created if needed.
- You can select the default language (among English `en` by default, French `fr`, and German `de`). Other languages can be added after installation like any other extension.
### Using
After installation, simply open your browser to Flarum's page. First loading may be a bit longer as assets are generated.
This app allows your YunoHost users to log in with a [dedicated LDAP extension](https://github.com/tituspijean/flarum-ext-auth-ldap). By default, the standard logging method is hidden.
To allow non-YunoHost users to log in, the LDAP extension setting is in the admin panel.
### Upgrading
Note that, for the moment, all third-party extensions are removed upon upgrading.
### Adding extensions
Flarum does not offer to install extensions from its admin panel yet, so you need to use the command line.
Replace `flarum` with your app ID in case of multiple installations.
Replace `vendor/extension` with the appropriate names. Read the extension documentation if it requires additional steps.
```bash
sudo su
app=flarum
cd /var/www/$app
sudo -u $app php7.3 composer.phar require vendor/extension
```
#### Troubleshooting
##### `Timeout` errors
Some users have reported a successful installation, but get a blank page due to a `timeout` on a PHP script that prepares the forum assests (`Minify.php`, notably).
In `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, you can increase the `max_execution_time` and `max_input_time` limits (both values are in seconds if nothing is specified).
Reload PHP-FPM with `sudo service php*php_version*-fpm reload`.
##### Upload limit
If you are facing an error while uploading large files into the forum, PHP may be limiting file upload.
In `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, you can uncomment (remove `;` at the beginning of the line) and increase the values of `upload_max_filesize` and `post_max_size` (both values are in bytes).
Reload PHP-FPM with `sudo service php*php_version*-fpm reload`.

46
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,46 @@
### Installation
- L'installation nécessite au moins 1 Go de mémoire vive libre. Un fichier *swap* de cette taille sera créé si nécessaire.
- Vous pouvez sélectionner la langue par défaut dans les paramètres d'installation (parmi l'anglais `en`, le français `fr` et l'allemand `de`). Les autres langues sont installables comme n'importe quelle autre extension.
### Utilisation
Après l'installation, ouvrez simplement votre navigateur à la page de Flarum. Le premier chargement peut être un peu retardé par la génération du cache.
Cette app permet à vos utilisateurs enregistrés dans YunoHost de se connecter avec une [extension LDAP dédiée](https://github.com/tituspijean/flarum-ext-auth-ldap). Par défaut, la méthode de connexion standard est cachée.
Pour permettre à des utilisateurs non-YunoHost de se connecter, référez-vous au menu de configuration de l'extension LDAP dans le panneau d'administration de Flarum.
### Mise à jour
Notez que, pour le moment, toute extension tierce est désinstallée lors d'une mise à jour.
Leurs données et paramètres restent dans la base de donnée de Flarum, seule une réinstallation est nécessaire.
### Ajouter des extensions
Flarum ne permet pas encore d'installer des extensions depuis son interface d'administration ; vous devrez donc utiliser la ligne de commande.
Remplacez `flarum` par l'ID de votre app en cas de multiple installations.
Remplacez `vendor/extension` par les noms adéquats. Référez-vous à la documentation de l'extension pour vérifier qu'elle ne nécessite pas de configuration supplémentaire.
```bash
sudo su
app=flarum
cd /var/www/$app
sudo -u $app php7.3 composer.phar require vendor/extension
```
#### Dépannage
##### Erreurs de `timeout`
Quelques utilisateurs rapportent qu'ils font fassent à une page blanche due à une erreur de `timeout` dans un script PHP qui prépare le cache (`Minify.php`, notamment).
Dans `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, vous pouvez augmenter les limites `max_execution_time` et `max_input_time` (les deux valeurs sont en secondes si vous ne précisez pas d'unité).
Rechargez PHP-FPM avec `sudo service php*php_version*-fpm reload`.
##### Limite de téléversement
Si vous avez une erreur lors du chargement de gros fichiers dans le forum, PHP pourrait être en train de limiter les téléversements.
Dans `/etc/php/*php_version*/fpm/pool.d/*app_id*.conf`, vous pouvez décommenter (enlevez `;` au début de la ligne) et augmenter les valeurs de `upload_max_filesize` de `post_max_size` (les deux valeurs sont en octets).
Rechargez PHP-FPM avec `sudo service php*php_version*-fpm reload`.

BIN
doc/screenshots/beta16.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View file

@ -7,15 +7,22 @@
"fr": "Un forum de nouvelle génération, simplement.",
"de": "Forum der nächsten Generation leicht gemacht."
},
"version": "0.1.0.16~ynh2",
"version": "0.1.0.16~ynh4",
"url": "http://flarum.org/",
"upstream": {
"license": "MIT",
"website": "https://flarum.org",
"demo": "https://discuss.flarum.org/d/21101-demos-come-to-flarum",
"admindoc": "https://docs.flarum.org",
"code": "https://github.com/flarum/flarum"
},
"license": "MIT",
"maintainer": {
"name": "tituspijean",
"email": "tituspijean@outlook.com"
},
"requirements": {
"yunohost": ">= 4.1.7"
"yunohost": ">= 4.2.0"
},
"multi_instance": true,
"services": [

View file

@ -1,18 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -10,7 +10,6 @@ swap_needed=1024
YNH_PHP_VERSION="7.3"
YNH_COMPOSER_VERSION="2.0.13"
extra_php_dependencies="php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo-mysql php${YNH_PHP_VERSION}-tokenizer php${YNH_PHP_VERSION}-zip"
# Version numbers

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
true
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

View file

@ -30,9 +30,9 @@ 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)..."
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -40,7 +40,7 @@ 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
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -67,23 +67,23 @@ fi
#=================================================
# 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
# Change the path in the nginx config file
# 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
# 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
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
@ -117,7 +117,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -1,61 +0,0 @@
#!/bin/bash
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
# Declare the actual composer version to use.
# A packager willing to use another version of composer can override the variable into its _common.sh.
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
# Execute a command with Composer
#
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
# | arg: -c, --composerversion - Composer version to install
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vwac
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion
local workdir
local install_args
local composerversion
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer."
# install dependencies
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to install core dependencies with Composer."
}

View file

@ -1,14 +0,0 @@
#!/bin/bash
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}

View file

@ -7,8 +7,6 @@
#=================================================
source _common.sh
source experimental_helpers/ynh_exec_as
source experimental_helpers/ynh_composer
source experimental_helpers/ynh_add_swap
source /usr/share/yunohost/helpers
@ -17,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
true
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -71,6 +69,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=2
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 MYSQL DATABASE
#=================================================
@ -91,29 +97,24 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config
# 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
# Adding it to www-data group
usermod -a -G www-data $app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring php-fpm..."
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated php-fpm config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -142,16 +143,6 @@ ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_p
# Update and download dependencies
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"update\"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app:www-data $final_path
chmod -R ug+rw,o-rwx $final_path
chmod -R ug+x $final_path/flarum
#=================================================
# FLARUM POST-INSTALL
#=================================================
@ -162,7 +153,7 @@ ynh_add_config --template="../conf/configuration.yml" --destination="$final_path
# Execute post-installation
pushd $final_path
exec_as $app php$phpversion -d $final_path -d memory_limit=-1 flarum install -f configuration.yml
ynh_exec_as $app php$phpversion -d $final_path -d memory_limit=-1 flarum install -f configuration.yml
# Delete configuration.yml as it contains sensitive data
ynh_secure_remove --file="$final_path/configuration.yml"
popd
@ -208,20 +199,20 @@ ynh_use_logrotate
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
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"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -51,17 +51,17 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated php-fpm config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source ../settings/scripts/experimental_helpers/ynh_add_swap
source /usr/share/yunohost/helpers
@ -15,13 +15,16 @@ 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..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -47,17 +50,10 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the nginx configuration..."
ynh_script_progression --message="Restoring the NGINX 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,19 +63,20 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring user rights..."
ynh_script_progression --message="Restoring the app main directory..." --weight=1
# Set right permissions
chown -R $app:www-data $final_path
chmod -R ug+rw,o-rwx $final_path
chmod -R ug+x $final_path/flarum
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -105,13 +102,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# ADD SWAP
#=================================================
@ -119,12 +109,19 @@ ynh_script_progression --message="Adding swap..."
ynh_add_swap --size=$swap_needed
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -7,8 +7,6 @@
#=================================================
source _common.sh
source experimental_helpers/ynh_exec_as
source experimental_helpers/ynh_composer
source experimental_helpers/ynh_add_swap
source /usr/share/yunohost/helpers
@ -37,6 +35,22 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# 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
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -78,21 +92,13 @@ if [ ! -z "$ssowat_extension" ]; then
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
ynh_script_progression --message="Making sure dedicated system user exists..." --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
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -126,12 +132,16 @@ then
ynh_secure_remove --file="$tmpdir"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -141,16 +151,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=2
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# 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
# Adding it to www-data group
usermod -a -G www-data $app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -188,8 +188,8 @@ then
ynh_script_progression --message="Upgrading Flarum and its extensions..." --weight=1
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update\"
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_path --commands=\"require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies\"
exec_as $app php$phpversion flarum migrate
exec_as $app php$phpversion flarum cache:clear
ynh_exec_as $app php$phpversion flarum migrate
ynh_exec_as $app php$phpversion flarum cache:clear
popd
fi
@ -197,7 +197,7 @@ fi
# FLARUM EXTENSIONS
#=================================================
if ! exec_as $app php$phpversion flarum info | grep -q "tituspijean-auth-ldap" | grep -q $ldap_version;
if ! ynh_exec_as $app php$phpversion flarum info | grep -q "tituspijean-auth-ldap" | grep -q $ldap_version;
then
# Install and activate the LDAP auth extension
activate_flarum_extension $db_name "tituspijean-auth-ldap"
@ -227,7 +227,7 @@ ynh_print_info "You may need to manually enable your language extension in Flaru
# Clear cache
pushd $final_path
exec_as $app php$phpversion flarum cache:clear
ynh_exec_as $app php$phpversion flarum cache:clear
popd
# Save version settings
@ -235,6 +235,8 @@ ynh_app_setting_set $app project_version $project_version
ynh_app_setting_set $app core_version $core_version
ynh_app_setting_set $app ldap_version $ldap_version
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
@ -243,22 +245,10 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app:www-data $final_path
chmod -R ug+rw,o-rwx $final_path
chmod -R ug+x $final_path/flarum
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload