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

Merge branch 'testing' into bookworm

This commit is contained in:
Éric Gaspar 2024-05-25 09:56:37 +02:00
commit 5a84c84aaf
12 changed files with 447 additions and 379 deletions

8
ALL_README.md Normal file
View file

@ -0,0 +1,8 @@
# All available README files by language
- [Read the README in English](README.md)
- [Lea el README en español](README_es.md)
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -1,5 +1,5 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
N.B.: This README was automatically generated by <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
It shall NOT be edited by hand.
-->
@ -9,10 +9,10 @@ It shall NOT be edited by hand.
[![Install Discourse with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Lire ce readme en français.](./README_fr.md)*
*[Read this README in other languages.](./ALL_README.md)*
> *This package allows you to install Discourse 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.*
> *This package allows you to install Discourse 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
@ -41,9 +41,9 @@ To learn more about the philosophy and goals of the project, [visit **discourse.
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
To try the testing branch, please proceed like that.
To try the `testing` branch, please proceed like that:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug

55
README_es.md Normal file
View file

@ -0,0 +1,55 @@
<!--
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
No se debe editar a mano.
-->
# Discourse para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg)
[![Instalar Discourse con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Leer este README en otros idiomas.](./ALL_README.md)*
> *Este paquete le permite instalarDiscourse rapidamente y simplement en un servidor YunoHost.*
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
## Descripción general
[Discourse](http://www.discourse.org) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a:
- mailing list
- discussion forum
- long-form chat room
To learn more about the philosophy and goals of the project, [visit **discourse.org**](http://www.discourse.org).
**Versión actual:** 2.8.14~ynh3
**Demo:** <https://try.discourse.org>
## Capturas
![Captura de Discourse](./doc/screenshots/screenshot.png)
## Documentaciones y recursos
- Sitio web oficial: <http://Discourse.org>
- Repositorio del código fuente oficial de la aplicación : <https://github.com/discourse/discourse>
- Catálogo YunoHost: <https://apps.yunohost.org/app/discourse>
- Reportar un error: <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## Información para desarrolladores
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing
Para probar la rama `testing`, sigue asÍ:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
o
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>

55
README_eu.md Normal file
View file

@ -0,0 +1,55 @@
<!--
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
EZ editatu eskuz.
-->
# Discourse YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg)
[![Instalatu Discourse YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
> *Pakete honek Discourse YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
## Aurreikuspena
[Discourse](http://www.discourse.org) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a:
- mailing list
- discussion forum
- long-form chat room
To learn more about the philosophy and goals of the project, [visit **discourse.org**](http://www.discourse.org).
**Paketatutako bertsioa:** 2.8.14~ynh3
**Demoa:** <https://try.discourse.org>
## Pantaila-argazkiak
![Discourse(r)en pantaila-argazkia](./doc/screenshots/screenshot.png)
## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala: <http://Discourse.org>
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/discourse/discourse>
- YunoHost Denda: <https://apps.yunohost.org/app/discourse>
- Eman errore baten berri: <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## Garatzaileentzako informazioa
Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
`testing` abarra probatzeko, ondorengoa egin:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
edo
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**Informazio gehiago aplikazioaren paketatzeari buruz:** <https://yunohost.org/packaging_apps>

View file

@ -1,6 +1,6 @@
<!--
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.
Nota bene: ce README est automatiquement généré par <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Il NE doit PAS être modifié à la main.
-->
# Discourse pour YunoHost
@ -9,10 +9,10 @@ It shall NOT be edited by hand.
[![Installer Discourse avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Read this readme in english.](./README.md)*
*[Lire le README dans d'autres langues.](./ALL_README.md)*
> *Ce package vous permet dinstaller Discourse rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
> *Ce package vous permet dinstaller Discourse rapidement et simplement sur un serveur YunoHost.*
> *Si vous navez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment linstaller et en profiter.*
## Vue densemble
@ -26,7 +26,16 @@ Pour en savoir plus sur la philosophie et les objectifs du projet, [visitez **di
**Version incluse :** 2.8.14~ynh3
**Démo :** <https://try.discourse.org>
- liste de diffusion
- forum de discussion
- salle de discussion longue durée
Pour en savoir plus sur la philosophie et les objectifs du projet, [visitez **discourse.org**](http://www.discourse.org).
**Version incluse:** 2.8.14~ynh3
**Démo:** <https://try.discourse.org>
## Captures décran
@ -34,16 +43,16 @@ Pour en savoir plus sur la philosophie et les objectifs du projet, [visitez **di
## Documentations et ressources
- Site officiel de lapp : <http://Discourse.org>
- Dépôt de code officiel de lapp : <https://github.com/discourse/discourse>
- YunoHost Store : <https://apps.yunohost.org/app/discourse>
- Signaler un bug : <https://github.com/YunoHost-Apps/discourse_ynh/issues>
- Site officiel de lapp: <http://Discourse.org>
- Dépôt de code officiel de lapp: <https://github.com/discourse/discourse>
- YunoHost Store: <https://apps.yunohost.org/app/discourse>
- Signaler un bug: <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
Pour essayer la branche `testing`, procédez comme suit:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
@ -51,4 +60,4 @@ ou
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications:** <https://yunohost.org/packaging_apps>

55
README_gl.md Normal file
View file

@ -0,0 +1,55 @@
<!--
NOTA: Este README foi creado automáticamente por <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
NON debe editarse manualmente.
-->
# Discourse para YunoHost
[![Nivel de integración](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg)
[![Instalar Discourse con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Le este README en outros idiomas.](./ALL_README.md)*
> *Este paquete permíteche instalar Discourse de xeito rápido e doado nun servidor YunoHost.*
> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.*
## Vista xeral
[Discourse](http://www.discourse.org) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a:
- mailing list
- discussion forum
- long-form chat room
To learn more about the philosophy and goals of the project, [visit **discourse.org**](http://www.discourse.org).
**Versión proporcionada:** 2.8.14~ynh3
**Demo:** <https://try.discourse.org>
## Capturas de pantalla
![Captura de pantalla de Discourse](./doc/screenshots/screenshot.png)
## Documentación e recursos
- Web oficial da app: <http://Discourse.org>
- Repositorio de orixe do código: <https://github.com/discourse/discourse>
- Tenda YunoHost: <https://apps.yunohost.org/app/discourse>
- Informar dun problema: <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## Info de desenvolvemento
Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
Para probar a rama `testing`, procede deste xeito:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
ou
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**Máis info sobre o empaquetado da app:** <https://yunohost.org/packaging_apps>

128
README_it.md Normal file
View file

@ -0,0 +1,128 @@
<<<<<<<< HEAD:doc/ADMIN.md
## Multi-user support
========
<!--
N.B.: Questo README è stato automaticamente generato da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
NON DEVE essere modificato manualmente.
-->
# Discourse per YunoHost
[![Livello di integrazione](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg)
[![Installa Discourse con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Leggi questo README in altre lingue.](./ALL_README.md)*
> *Questo pacchetto ti permette di installare Discourse su un server YunoHost in modo semplice e veloce.*
> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.*
## Panoramica
Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more!
**Versione pubblicata:** 2.8.14~ynh2
**Prova:** <https://try.discourse.org>
## Screenshot
![Screenshot di Discourse](./doc/screenshots/screenshot.png)
## Attenzione/informazioni importanti
## Disclaimer
>>>>>>>> testing:README_it.md
Supported, with LDAP (no SSO).
![Login Popup](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/login.png)
Default administrator and YunoHost users must login using LDAP:
* click on the "with LDAP" button
* use your YunoHost credentials
When disabling Local Login and other authentication services, clicking the `Login` or `Sign Up` button will directly bring up the LDAP Login popup.
![Disable Local](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/disable_local.png)
![LDAP Login Popup](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/ldap_popup.png)
## Configuration
Use the admin panel of your Discourse to configure this app.
### Configuring "Reply-By-Email"
* You should create a dedicated Yunohost user for Discourse whose mailbox will be used by the Discourse application. You can do this with `yunohost user create response`, for example. You should ensure that the email address is configured to be on your Discourse domain.
* You should then configure your Discourse `/var/www/discourse/config/discourse.conf` file with the correct SMTP configuration values. Please see [this comment](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) for an explanation of what values to change. Please be aware, when you update the application, you will have to re-apply this configuration.
* You must enable the Pop3 configuration for Dovecot. See [this thread](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) on how to do that. You can validate your configuration with `systemctl restart dovecot && dovecot -n`. Don't forget to open the ports you need (`995` is the default). You can validate that with `nmap -p 995 yunohostdomain.org`.
* You should then configure the Pop3 polling in the Discourse admin interface. Please see [this comment](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) for how to do so. You will need to follow step 5 in that comment. You can specify your main Yunohost domain for the `pop3_polling_host`.
You should now be able to start testing. Try using the `/admin/email` "Send Test Email" and then view the "Sent" or "Skipped" etc. tabs. You should see a report on what happened with the email. You may also want to look in `/var/www/discourse/log/production.log` as well as `/var/www/mail.err`. You should perhaps also use [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) or another Yunohost email client application to quickly test that both your user and the dedicated Yunohost Discourse user (`response@...`) is receiving mail.
### "Reply-By-Email" and mail forwarding
If you use the administration UI in YunoHost to setup a mail forwarding address for your users then you may face the problem whereby your users are replying by email from the forwarded email address and the Discourse software is not able to understand how to receive that email.
For example, your user has email address `foo@myyunohostdomain.org` and all mail is forwarded to `foo@theirexternalmail.com`. Discourse receives replies from `foo@theirexternalmail.com` but cannot understand how to deliver this to the user account with `foo@myyunohostdomain.org` configured.
Their is on-going work to allow for [multiple email addresses for one user](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) in Discourse development but at current major version (2.3 as of 2019-08-06), there is no web interface for this functionality. It is possible to set it up via the command-line interface but it is **experimental** and you should not undertake this work unless you take some time to understand what it is you are going to do.
Here's how to setup a secondary mail address for a user account:
```bash
cd /var/www/discourse
RAILS_ENV=production /opt/rbenv/versions/2.7.1/bin/bundle exec rails c
UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com")
```
### LDAP integration
* LDAP integration: on the login pop-up, you can choose "Login with LDAP" and use your YunoHost credentials
![Login Popup](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/login.png)
Default administrator and YunoHost users must login using LDAP:
* click on the "with LDAP" button
* use your YunoHost credentials
When disabling Local Login and other authentication services, clicking the `Login` or `Sign Up` button will directly bring up the LDAP Login popup.
![Disable Local](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/disable_local.png)
![LDAP Login Popup](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/ldap_popup.png)
### Installing plugins
```bash
cd /var/www/discourse
sudo -i -u discourse RAILS_ENV=production bin/rake --trace plugin:install repo=https://github.com/discourse/discourse-solved (for example)
sudo -i -u discourse RAILS_ENV=production bin/rake --trace assets:precompile
systemctl restart discourse
```
## Documentazione e risorse
- Sito web ufficiale dellapp: <http://Discourse.org>
- Repository upstream del codice dellapp: <https://github.com/discourse/discourse>
- Store di YunoHost: <https://apps.yunohost.org/app/discourse>
- Segnala un problema: <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## Informazioni per sviluppatori
Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
Per provare la branch di `testing`, si prega di procedere in questo modo:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
o
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**Maggiori informazioni riguardo il pacchetto di questapp:** <https://yunohost.org/packaging_apps>

55
README_zh_Hans.md Normal file
View file

@ -0,0 +1,55 @@
<!--
注意:此 README 由 <https://github.com/YunoHost/apps/tree/master/tools/readme_generator> 自动生成
请勿手动编辑。
-->
# YunoHost 上的 Discourse
[![集成程度](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![工作状态](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg)
[![使用 YunoHost 安装 Discourse](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[阅读此 README 的其它语言版本。](./ALL_README.md)*
> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Discourse。*
> *如果您还没有 YunoHost请参阅[指南](https://yunohost.org/install)了解如何安装它。*
## 概况
[Discourse](http://www.discourse.org) is the 100% open source discussion platform built for the next decade of the Internet. Use it as a:
- mailing list
- discussion forum
- long-form chat room
To learn more about the philosophy and goals of the project, [visit **discourse.org**](http://www.discourse.org).
**分发版本:** 2.8.14~ynh3
**演示:** <https://try.discourse.org>
## 截图
![Discourse 的截图](./doc/screenshots/screenshot.png)
## 文档与资源
- 官方应用网站: <http://Discourse.org>
- 上游应用代码库: <https://github.com/discourse/discourse>
- YunoHost 商店: <https://apps.yunohost.org/app/discourse>
- 报告 bug <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## 开发者信息
请向 [`testing` 分支](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing) 发送拉取请求。
如要尝试 `testing` 分支,请这样操作:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**有关应用打包的更多信息:** <https://yunohost.org/packaging_apps>

View file

@ -1,4 +1,38 @@
<<<<<<<< HEAD:doc/ADMIN.md
## Multi-user support
========
<!--
N.B.: Questo README è stato automaticamente generato da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
NON DEVE essere modificato manualmente.
-->
# Discourse per YunoHost
[![Livello di integrazione](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg)
[![Installa Discourse con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse)
*[Leggi questo README in altre lingue.](./ALL_README.md)*
> *Questo pacchetto ti permette di installare Discourse su un server YunoHost in modo semplice e veloce.*
> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.*
## Panoramica
Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more!
**Versione pubblicata:** 2.8.14~ynh2
**Prova:** <https://try.discourse.org>
## Screenshot
![Screenshot di Discourse](./doc/screenshots/screenshot.png)
## Attenzione/informazioni importanti
## Disclaimer
>>>>>>>> testing:README_it.md
Supported, with LDAP (no SSO).
@ -71,3 +105,24 @@ sudo -i -u discourse RAILS_ENV=production bin/rake --trace plugin:install repo=h
sudo -i -u discourse RAILS_ENV=production bin/rake --trace assets:precompile
systemctl restart discourse
```
## Documentazione e risorse
- Sito web ufficiale dellapp: <http://Discourse.org>
- Repository upstream del codice dellapp: <https://github.com/discourse/discourse>
- Store di YunoHost: <https://apps.yunohost.org/app/discourse>
- Segnala un problema: <https://github.com/YunoHost-Apps/discourse_ynh/issues>
## Informazioni per sviluppatori
Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing).
Per provare la branch di `testing`, si prega di procedere in questo modo:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
o
sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug
```
**Maggiori informazioni riguardo il pacchetto di questapp:** <https://yunohost.org/packaging_apps>

View file

@ -19,7 +19,7 @@ code = "https://github.com/discourse/discourse"
cpe = "cpe:2.3:a:discourse:discourse"
[integration]
yunohost = ">= 11.2"
yunohost = ">=11.2.12"
architectures = "all"
multi_instance = true
ldap = true

View file

@ -123,360 +123,3 @@ ynh_maintenance_mode_OFF () {
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
#=================================================
# RUBY HELPER
#=================================================
ynh_ruby_try_bash_extension() {
if [ -x src/configure ]; then
src/configure && make -C src || {
ynh_print_info --message="Optional bash extension failed to build, but things will still work normally."
}
fi
}
rbenv_install_dir="/opt/rbenv"
ruby_version_path="$rbenv_install_dir/versions"
# RBENV_ROOT is the directory of rbenv, it needs to be loaded as a environment variable.
export RBENV_ROOT="$rbenv_install_dir"
export rbenv_root="$rbenv_install_dir"
ruby_dependencies=""
build_ruby_dependencies="libjemalloc-dev curl build-essential libreadline-dev zlib1g-dev libsqlite3-dev libssl-dev libxml2-dev libxslt-dev autoconf automake bison libtool"
pkg_dependencies="$pkg_dependencies $ruby_dependencies"
build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies"
# Load the version of Ruby for an app, and set variables.
#
# ynh_use_ruby has to be used in any app scripts before using Ruby for the first time.
# This helper will provide alias and variables to use in your scripts.
#
# To use gem or Ruby, use the alias `ynh_gem` and `ynh_ruby`
# Those alias will use the correct version installed for the app
# For example: use `ynh_gem install` instead of `gem install`
#
# With `sudo` or `ynh_exec_as`, use instead the fallback variables `$ynh_gem` and `$ynh_ruby`
# And propagate $PATH to sudo with $ynh_ruby_load_path
# Exemple: `ynh_exec_as $app $ynh_ruby_load_path $ynh_gem install`
#
# $PATH contains the path of the requested version of Ruby.
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
# in $PATH for an usage into a separate script.
# Exemple: $ynh_ruby_load_path $install_dir/script_that_use_gem.sh`
#
#
# Finally, to start a Ruby service with the correct version, 2 solutions
# Either the app is dependent of Ruby or gem, but does not called it directly.
# In such situation, you need to load PATH
# `Environment="__YNH_RUBY_LOAD_PATH__"`
# `ExecStart=__INSTALL_DIR__/my_app`
# You will replace __YNH_RUBY_LOAD_PATH__ with $ynh_ruby_load_path
#
# Or Ruby start the app directly, then you don't need to load the PATH variable
# `ExecStart=__YNH_RUBY__ my_app run`
# You will replace __YNH_RUBY__ with $ynh_ruby
#
#
# one other variable is also available
# - $ruby_path: The absolute path to Ruby binaries for the chosen version.
#
# usage: ynh_use_ruby
#
# Requires YunoHost version 3.2.2 or higher.
ynh_use_ruby () {
ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version)
# Get the absolute path of this version of Ruby
ruby_path="$ruby_version_path/$YNH_APP_INSTANCE_NAME/bin"
# Allow alias to be used into bash script
shopt -s expand_aliases
# Create an alias for the specific version of Ruby and a variable as fallback
ynh_ruby="$ruby_path/ruby"
alias ynh_ruby="$ynh_ruby"
# And gem
ynh_gem="$ruby_path/gem"
alias ynh_gem="$ynh_gem"
# Load the path of this version of Ruby in $PATH
if [[ :$PATH: != *":$ruby_path"* ]]; then
PATH="$ruby_path:$PATH"
fi
# Create an alias to easily load the PATH
ynh_ruby_load_path="PATH=$PATH"
# Sets the local application-specific Ruby version
pushd $install_dir
$rbenv_install_dir/bin/rbenv local $ruby_version
popd
}
# Install a specific version of Ruby
#
# ynh_install_ruby will install the version of Ruby provided as argument by using rbenv.
#
# This helper creates a /etc/profile.d/rbenv.sh that configures PATH environment for rbenv
# for every LOGIN user, hence your user must have a defined shell (as opposed to /usr/sbin/nologin)
#
# Don't forget to execute ruby-dependent command in a login environment
# (e.g. sudo --login option)
# When not possible (e.g. in systemd service definition), please use direct path
# to rbenv shims (e.g. $RBENV_ROOT/shims/bundle)
#
# usage: ynh_install_ruby --ruby_version=ruby_version
# | arg: -v, --ruby_version= - Version of ruby to install.
#
# Requires YunoHost version 3.2.2 or higher.
ynh_install_ruby () {
# Declare an array to define the options of this helper.
local legacy_args=v
local -A args_array=( [v]=ruby_version= )
local ruby_version
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Load rbenv path in PATH
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
# Remove /usr/local/bin in PATH in case of Ruby prior installation
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
# Move an existing Ruby binary, to avoid to block rbenv
test -x /usr/bin/ruby && mv /usr/bin/ruby /usr/bin/ruby_rbenv
# Install or update rbenv
rbenv="$(command -v rbenv $rbenv_install_dir/bin/rbenv | grep "$rbenv_install_dir/bin/rbenv" | head -1)"
if [ -n "$rbenv" ]; then
ynh_print_info --message="rbenv already seems installed in \`$rbenv'."
pushd "${rbenv%/*/*}"
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/rbenv.git"; then
ynh_print_info --message="Trying to update with git..."
git pull -q --tags origin master
ynh_ruby_try_bash_extension
else
ynh_print_info --message="Reinstalling rbenv with git..."
cd ..
ynh_secure_remove --file=$rbenv_install_dir
mkdir -p $rbenv_install_dir
cd $rbenv_install_dir
git init -q
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
git checkout -q -b master origin/master
ynh_ruby_try_bash_extension
rbenv=$rbenv_install_dir/bin/rbenv
fi
popd
else
ynh_print_info --message="Installing rbenv with git..."
mkdir -p $rbenv_install_dir
pushd $rbenv_install_dir
git init -q
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
git checkout -q -b master origin/master
ynh_ruby_try_bash_extension
rbenv=$rbenv_install_dir/bin/rbenv
popd
fi
ruby_build="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-install rbenv-install | head -1)"
if [ -n "$ruby_build" ]; then
ynh_print_info --message="\`rbenv install' command already available in \`$ruby_build'."
pushd "${ruby_build%/*/*}"
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/ruby-build.git"; then
ynh_print_info --message="Trying to update rbenv with git..."
git pull -q origin master
fi
popd
else
ynh_print_info --message="Installing ruby-build with git..."
mkdir -p "${rbenv_install_dir}/plugins"
git clone -q https://github.com/rbenv/ruby-build.git "${rbenv_install_dir}/plugins/ruby-build"
fi
rbenv_alias="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-alias rbenv-alias | head -1)"
if [ -n "$rbenv_alias" ]; then
ynh_print_info --message="\`rbenv alias' command already available in \`$rbenv_alias'."
pushd "${rbenv_alias%/*/*}"
if git remote -v 2>/dev/null | grep "https://github.com/tpope/rbenv-aliases.git"; then
ynh_print_info --message="Trying to update rbenv-aliases with git..."
git pull -q origin master
fi
popd
else
ynh_print_info --message="Installing rbenv-aliases with git..."
mkdir -p "${rbenv_install_dir}/plugins"
git clone -q https://github.com/tpope/rbenv-aliases.git "${rbenv_install_dir}/plugins/rbenv-aliase"
fi
rbenv_latest="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-latest rbenv-latest | head -1)"
if [ -n "$rbenv_latest" ]; then
ynh_print_info --message="\`rbenv latest' command already available in \`$rbenv_latest'."
pushd "${rbenv_latest%/*/*}"
if git remote -v 2>/dev/null | grep "https://github.com/momo-lab/xxenv-latest.git"; then
ynh_print_info --message="Trying to update xxenv-latest with git..."
git pull -q origin master
fi
popd
else
ynh_print_info --message="Installing xxenv-latest with git..."
mkdir -p "${rbenv_install_dir}/plugins"
git clone -q https://github.com/momo-lab/xxenv-latest.git "${rbenv_install_dir}/plugins/xxenv-latest"
fi
# Enable caching
mkdir -p "${rbenv_install_dir}/cache"
# Create shims directory if needed
mkdir -p "${rbenv_install_dir}/shims"
# Restore /usr/local/bin in PATH
PATH=$CLEAR_PATH
# And replace the old Ruby binary
test -x /usr/bin/ruby_rbenv && mv /usr/bin/ruby_rbenv /usr/bin/ruby
# Install the requested version of Ruby
local final_ruby_version=$(rbenv latest --print $ruby_version)
if ! [ -n "$final_ruby_version" ]; then
final_ruby_version=$ruby_version
fi
ynh_print_info --message="Installing Ruby-$final_ruby_version"
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version > /dev/null 2>&1
# Store ruby_version into the config of this app
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
# Remove app virtualenv
if `rbenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1`
then
rbenv alias $YNH_APP_INSTANCE_NAME --remove
fi
# Create app virtualenv
rbenv alias $YNH_APP_INSTANCE_NAME $final_ruby_version
# Cleanup Ruby versions
ynh_cleanup_ruby
# Set environment for Ruby users
cat > /etc/profile.d/rbenv.sh <<EOF
#rbenv
export RBENV_ROOT=$rbenv_install_dir
export PATH="$rbenv_install_dir/bin:$PATH"
eval "\$(rbenv init -)"
#rbenv
EOF
# Load the environment
eval "$(rbenv init -)"
}
# Remove the version of Ruby used by the app.
#
# This helper will also cleanup Ruby versions
#
# usage: ynh_remove_ruby
ynh_remove_ruby () {
local ruby_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=ruby_version)
# Load rbenv path in PATH
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
# Remove /usr/local/bin in PATH in case of Ruby prior installation
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
rbenv alias $YNH_APP_INSTANCE_NAME --remove
# Remove the line for this app
ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=ruby_version
# Cleanup Ruby versions
ynh_cleanup_ruby
}
# Remove no more needed versions of Ruby used by the app.
#
# This helper will check what Ruby version are no more required,
# and uninstall them
# If no app uses Ruby, rbenv will be also removed.
#
# usage: ynh_cleanup_ruby
ynh_cleanup_ruby () {
# List required Ruby versions
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
local required_ruby_versions=""
for installed_app in $installed_apps
do
local installed_app_ruby_version=$(ynh_app_setting_get --app=$installed_app --key="ruby_version")
if [[ $installed_app_ruby_version ]]
then
required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}"
fi
done
# Remove no more needed Ruby versions
local installed_ruby_versions=$(rbenv versions --bare --skip-aliases | grep -Ev '/')
for installed_ruby_version in $installed_ruby_versions
do
if ! `echo ${required_ruby_versions} | grep "${installed_ruby_version}" 1>/dev/null 2>&1`
then
ynh_print_info --message="Removing of Ruby-$installed_ruby_version"
$rbenv_install_dir/bin/rbenv uninstall --force $installed_ruby_version
fi
done
# If none Ruby version is required
if [[ ! $required_ruby_versions ]]
then
# Remove rbenv environment configuration
ynh_print_info --message="Removing of rbenv-$rbenv_version"
ynh_secure_remove --file="$rbenv_install_dir"
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
fi
}
#=================================================
# REDIS HELPERS
#=================================================
# get the first available redis database
#
# usage: ynh_redis_get_free_db
# | returns: the database number to use
ynh_redis_get_free_db() {
local result max db
result=$(redis-cli INFO keyspace)
# get the num
max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
db=0
# default Debian setting is 15 databases
for i in $(seq 0 "$max")
do
if ! echo "$result" | grep -q "db$i"
then
db=$i
break 1
fi
db=-1
done
test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
echo "$db"
}
# Create a master password and set up global settings
# Please always call this script in install and restore scripts
#
# usage: ynh_redis_remove_db database
# | arg: database - the database to erase
ynh_redis_remove_db() {
local db=$1
redis-cli -n "$db" flushall
}

View file

@ -56,6 +56,7 @@ fi
#=================================================
ynh_script_progression --message="Upgrading Ruby..."
ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version"
ynh_use_ruby
ynh_script_progression --message="Upgrading NodeJS..."
@ -83,12 +84,13 @@ ynh_setup_source --dest_dir="$install_dir" --full_replace=1 \
--keep="config/discourse.conf plugins_old public/uploads public/backups log"
# Restore all non-core plugins
for plugin_dir in "$install_dir/plugins"/*; do
for plugin_dir in "$install_dir/plugins_old"/*; do
plugin_name=$(basename "$plugin_dir")
if [ ! -d "$install_dir/plugins/$plugin_name" ]; then
mv "$plugin_dir" "$install_dir/plugins/$plugin_name"
fi
done
ynh_secure_remove --file="$install_dir/plugins_old"
# Install LDAP plugin
@ -126,6 +128,9 @@ echo "svgo: false" | ynh_exec_as "$app" tee "$install_dir/.image_optim.yml" >/de
#=================================================
ynh_script_progression --message="Setting up Unicorn..."
# Do it after setup_source because .ruby-version is stored in cwd
ynh_use_ruby
# Make a backup of the original config file if modified
unicorn_config_file="$install_dir/config/unicorn.conf.rb"
ynh_backup_if_checksum_is_different "$unicorn_config_file"
@ -135,7 +140,7 @@ pushd "$install_dir"
# Install bundler, a gems installer
ynh_gem install bundler
# Install without documentation
echo "gem: --no-ri --no-rdoc" | ynh_exec_as "$app" "$install_dir/.gemrc" >/dev/null
echo "gem: --no-ri --no-rdoc" | ynh_exec_as "$app" tee "$install_dir/.gemrc" >/dev/null
popd
# Specific actions on ARM architecture