mirror of
https://github.com/YunoHost-Apps/discourse_ynh.git
synced 2024-09-03 18:26:18 +02:00
Merge branch 'patch' into 2.7.8-with-config
This commit is contained in:
commit
4df5715207
13 changed files with 490 additions and 398 deletions
49
README.md
49
README.md
|
@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Discussion platform
|
||||
|
||||
**Shipped version:** 2.7.7~ynh1
|
||||
**Shipped version:** 2.7.8~ynh1
|
||||
|
||||
**Demo:** https://try.discourse.org
|
||||
|
||||
|
@ -27,44 +27,17 @@ Discussion platform
|
|||
|
||||
## Disclaimers / important information
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This package installs Discourse without Docker, for several reasons (mostly to support ARM architecture and low-profile servers, to mutualize nginx/postgresql/redis services and to simplify e-mail setup).
|
||||
As stated by the Discourse team:
|
||||
> The only officially supported installs of Discourse are [Docker](https://www.docker.io/) based. You must have SSH access to a 64-bit Linux server **with Docker support**. We regret that we cannot support any other methods of installation including cpanel, plesk, webmin, etc.
|
||||
|
||||
So please have this in mind when considering asking for Discourse support.
|
||||
|
||||
Moreover, you should have in mind Discourse [hardware requirements](https://github.com/discourse/discourse/blob/master/docs/INSTALL.md#hardware-requirements):
|
||||
- modern single core CPU, dual core recommended
|
||||
- 1 GB RAM minimum (with swap)
|
||||
- 64 bit Linux compatible with Docker
|
||||
- 10 GB disk space minimum
|
||||
|
||||
Finally, if installing on a low-end ARM device (e.g. Raspberry Pi):
|
||||
- installation can last up to 3 hours,
|
||||
- first access right after installation could take a couple of minutes.
|
||||
|
||||
## Overview
|
||||
[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).
|
||||
|
||||
## 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 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 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`.
|
||||
|
||||
|
@ -72,9 +45,9 @@ You should now be able to start testing. Try using the `/admin/email` "Send Test
|
|||
|
||||
### "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.
|
||||
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.
|
||||
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.
|
||||
|
||||
|
@ -82,20 +55,16 @@ 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
|
||||
$ RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails c
|
||||
$ UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com")
|
||||
```
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
* Integration with YunoHost users and SSO:
|
||||
* LDAP integration: on the login pop-up, you can choose "Login with LDAP" and use your YunoHost credentials
|
||||
* private mode: Forum only accessible by YunoHost users
|
||||
* public mode: Visible by anyone
|
||||
Discourse can now receive mail from `foo@theirexternalmail.com` and give it to the user account with mail address `foo@myyunohostdomain.org`.
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
Supported, with LDAP (no SSO).
|
||||
Supported, with LDAP and SSO.
|
||||
|
||||
|
||||

|
||||
|
||||
|
|
97
README_fr.md
97
README_fr.md
|
@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Plateforme de discussion
|
||||
|
||||
**Version incluse :** 2.7.7~ynh1
|
||||
**Version incluse :** 2.7.8~ynh1
|
||||
|
||||
**Démo :** https://try.discourse.org
|
||||
|
||||
|
@ -49,32 +49,31 @@ Enfin, si vous installez sur un appareil ARM bas de gamme (par exemple Raspberry
|
|||
- 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).
|
||||
|
||||
## Configuration
|
||||
|
||||
Utilisez le panneau d'administration de votre Discourse pour configurer cette application.
|
||||
|
||||
### Configuration de "Répondre par e-mail"
|
||||
### Configuration de "Répondre par email"
|
||||
|
||||
* Vous devez créer un utilisateur Yunohost dédié pour Discourse dont la boîte aux lettres sera utilisée par l'application Discourse. Vous pouvez le faire avec `yunohost user create response`, par exemple. Vous devez vous assurer que l'adresse e-mail est configurée pour être sur votre domaine Discourse.
|
||||
* Vous devez créer un utilisateur YunoHost dédié pour *Discourse* dont la boîte aux lettres sera utilisée par l'application. Vous pouvez le faire avec `yunohost user create response`, par exemple. Vous devez vous assurer que l'adresse email est configurée pour être sur votre domaine *Discourse*.
|
||||
|
||||
* Vous devez ensuite configurer votre fichier Discourse `/var/www/discourse/config/discourse.conf` avec les valeurs de configuration SMTP correctes. Veuillez consulter [ce commentaire](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) pour une explication des valeurs à modifier. Attention, lors de la mise à jour de l'application, vous devrez réappliquer cette configuration.
|
||||
* Vous devez ensuite configurer votre fichier de configuration `/var/www/discourse/config/discourse.conf` avec les valeurs de configuration SMTP correctes. Veuillez consulter [ce commentaire](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) pour une explication des valeurs à modifier. Attention, lors de la mise à jour de l'application, vous devrez réappliquer cette configuration.
|
||||
|
||||
* Vous devez activer la configuration Pop3 pour Dovecot. Voir [ce fil](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) pour savoir comment procéder. Vous pouvez valider votre configuration avec `systemctl restart dovecot && dovecot -n`. N'oubliez pas d'ouvrir les ports dont vous avez besoin ('995' est la valeur par défaut). Vous pouvez valider cela avec `nmap -p 995 yunohostdomain.org`.
|
||||
* Vous devez activer la configuration POP3 pour *Dovecot*. Voir [ce fil](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) pour savoir comment procéder. Vous pouvez valider votre configuration avec `systemctl restart dovecot && dovecot -n`. N'oubliez pas d'ouvrir les ports dont vous avez besoin (`995` est la valeur par défaut). Vous pouvez valider cela avec `nmap -p 995 domain.ltd`.
|
||||
|
||||
* Vous devez ensuite configurer le sondage Pop3 dans l'interface d'administration de Discourse. Veuillez consulter [ce commentaire](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) pour savoir comment procéder. Vous devrez suivre l'étape 5 de ce commentaire. Vous pouvez spécifier votre domaine Yunohost principal pour le `pop3_polling_host`.
|
||||
* Vous devez ensuite configurer le sondage Pop3 dans l'interface d'administration de *Discourse*. Veuillez consulter [ce commentaire](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) pour savoir comment procéder. Vous devrez suivre l'étape 5 de ce commentaire. Vous pouvez spécifier votre domaine Yunohost principal pour le `pop3_polling_host`.
|
||||
|
||||
Vous devriez maintenant pouvoir commencer à tester. Essayez d'utiliser le `/admin/email` « Envoyer un e-mail de test », puis affichez les onglets « Envoyé » ou « Ignoré », etc. Vous devriez voir un rapport sur ce qui s'est passé avec l'e-mail. Vous pouvez également regarder dans `/var/www/discourse/log/production.log` ainsi que `/var/www/mail.err`. Vous devriez peut-être également utiliser [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) ou une autre application client de messagerie Yunohost pour tester rapidement que votre utilisateur et l'utilisateur dédié Yunohost Discourse (`response@...` ) reçoit du courrier.
|
||||
Vous devriez maintenant pouvoir commencer à tester. Essayez d'utiliser le `/admin/email` « Envoyer un email de test », puis affichez les onglets « Envoyé » ou « Ignoré », etc. Vous devriez voir un rapport sur ce qui s'est passé avec l'email. Vous pouvez également regarder dans `/var/www/discourse/log/production.log` ainsi que `/var/www/mail.err`. Vous devriez peut-être également utiliser [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) ou une autre application client de messagerie YunoHost pour tester rapidement que votre utilisateur et l'utilisateur dédié YunoHost *Discourse* (`response@...`) reçoit du courrier.
|
||||
|
||||
### "Réponse par e-mail" et transfert de courrier
|
||||
### "Réponse par email" et transfert de courrier
|
||||
|
||||
Si vous utilisez l'interface utilisateur d'administration de YunoHost pour configurer une adresse de transfert de courrier pour vos utilisateurs, vous risquez de rencontrer le problème selon lequel vos utilisateurs répondent par e-mail à partir de l'adresse e-mail transférée et le logiciel Discourse n'est pas capable de comprendre comment recevoir cet e-mail.
|
||||
Si vous utilisez l'interface utilisateur d'administration de YunoHost pour configurer une adresse de transfert de courrier pour vos utilisateurs, vous risquez de rencontrer le problème selon lequel vos utilisateurs répondent par email à partir de l'adresse e-mail transférée et le logiciel *Discourse* n'est pas en mesure de comprendre comment recevoir cet email.
|
||||
|
||||
Par exemple, votre utilisateur a l'adresse e-mail "foo@myyunohostdomain.org" et tout le courrier est transféré à "foo@theirexternalmail.com". Discourse reçoit des réponses de `foo@theirexternalmail.com` mais ne peut pas comprendre comment les envoyer au compte utilisateur avec `foo@myyunohostdomain.org` configuré.
|
||||
Par exemple, votre utilisateur a l'adresse email "foo@myyunohostdomain.org" et tout le courrier est transféré à `foo@theirexternalmail.com`. *Discourse* reçoit des réponses de `foo@theirexternalmail.com` mais ne peut pas comprendre comment les envoyer au compte utilisateur avec `foo@myyunohostdomain.org` configuré.
|
||||
|
||||
Leur travail est en cours pour permettre [plusieurs adresses e-mail pour un utilisateur](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) dans le développement de discours mais dans la version majeure actuelle (2.3 au 06-08-2019), il n'y a pas d'interface Web pour cette fonctionnalité. Il est possible de le configurer via l'interface de ligne de commande mais c'est **expérimental** et vous ne devriez pas entreprendre ce travail à moins de prendre le temps de comprendre ce que vous allez faire.
|
||||
Leur travail est en cours pour permettre [plusieurs adresses email pour un utilisateur](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) dans le développement de *Discours* mais dans la version majeure actuelle (2.3 au 06-08-2019), il n'y a pas d'interface Web pour cette fonctionnalité. Il est possible de le configurer via l'interface de ligne de commande mais c'est **expérimental** et vous ne devriez pas entreprendre ce travail à moins de prendre le temps de comprendre ce que vous allez faire.
|
||||
|
||||
Voici comment configurer une adresse e-mail secondaire pour un compte utilisateur :
|
||||
Voici comment configurer une adresse email secondaire pour un compte utilisateur :
|
||||
|
||||
```bash
|
||||
$ cd /var/www/discours
|
||||
|
@ -82,79 +81,11 @@ $ RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails c
|
|||
$ UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com")
|
||||
```
|
||||
|
||||
## Fonctionnalités spécifiques à YunoHost
|
||||
|
||||
* Intégration avec les utilisateurs YunoHost et SSO :
|
||||
* Intégration LDAP : dans la pop-up de connexion, vous pouvez choisir "Se connecter avec LDAP" et utiliser vos identifiants YunoHost
|
||||
* mode privé : Forum uniquement accessible ## Disclaimer
|
||||
|
||||
Ce package installe Discourse sans Docker, pour plusieurs raisons (principalement pour prendre en charge l'architecture ARM et les serveurs discrets, pour mutualiser les services nginx/postgresql/redis et pour simplifier la configuration de la messagerie).
|
||||
Comme indiqué par l'équipe Discourse :
|
||||
> Les seules installations officiellement prises en charge de Discourse sont basées sur [Docker](https://www.docker.io/). Vous devez avoir un accès SSH à un serveur Linux 64 bits **avec prise en charge Docker**. Nous regrettons de ne pouvoir prendre en charge aucune autre méthode d'installation, notamment cpanel, plesk, webmin, etc.
|
||||
|
||||
Veuillez donc avoir cela à l'esprit lorsque vous envisagez de demander de l'aide à Discourse.
|
||||
|
||||
De plus, vous devriez avoir à l'esprit Discourse [exigences matérielles](https://github.com/discourse/discourse/blob/master/docs/INSTALL.md#hardware-requirements) :
|
||||
- CPU monocœur moderne, double cœur recommandé
|
||||
- 1 Go de RAM minimum (avec swap)
|
||||
- Linux 64 bits compatible avec Docker
|
||||
- 10 Go d'espace disque minimum
|
||||
|
||||
Enfin, si vous installez sur un appareil ARM bas de gamme (par exemple Raspberry Pi) :
|
||||
- l'installation peut durer jusqu'à 3 heures,
|
||||
- le premier accès juste après l'installation peut prendre quelques minutes.
|
||||
|
||||
## Aperçu
|
||||
[Discourse](http://www.discourse.org) est la plate-forme de discussion 100% open source conçue pour la prochaine décennie d'Internet. Utilisez-le comme :
|
||||
|
||||
- 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).
|
||||
|
||||
## Configuration
|
||||
|
||||
Utilisez le panneau d'administration de votre Discourse pour configurer cette application.
|
||||
|
||||
### Configuration de "Répondre par e-mail"
|
||||
|
||||
* Vous devez créer un utilisateur Yunohost dédié pour Discourse dont la boîte aux lettres sera utilisée par l'application Discourse. Vous pouvez le faire avec `yunohost user create response`, par exemple. Vous devez vous assurer que l'adresse e-mail est configurée pour être sur votre domaine Discourse.
|
||||
|
||||
* Vous devez ensuite configurer votre fichier Discourse `/var/www/discourse/config/discourse.conf` avec les valeurs de configuration SMTP correctes. Veuillez consulter [ce commentaire](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) pour une explication des valeurs à modifier. Attention, lors de la mise à jour de l'application, vous devrez réappliquer cette configuration.
|
||||
|
||||
* Vous devez activer la configuration Pop3 pour Dovecot. Voir [ce fil](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) pour savoir comment procéder. Vous pouvez valider votre configuration avec `systemctl restart dovecot && dovecot -n`. N'oubliez pas d'ouvrir les ports dont vous avez besoin ('995' est la valeur par défaut). Vous pouvez valider cela avec `nmap -p 995 yunohostdomain.org`.
|
||||
|
||||
* Vous devez ensuite configurer le sondage Pop3 dans l'interface d'administration de Discourse. Veuillez consulter [ce commentaire](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) pour savoir comment procéder. Vous devrez suivre l'étape 5 de ce commentaire. Vous pouvez spécifier votre domaine Yunohost principal pour le `pop3_polling_host`.
|
||||
|
||||
Vous devriez maintenant pouvoir commencer à tester. Essayez d'utiliser le `/admin/email` « Envoyer un e-mail de test », puis affichez les onglets « Envoyé » ou « Ignoré », etc. Vous devriez voir un rapport sur ce qui s'est passé avec l'e-mail. Vous pouvez également regarder dans `/var/www/discourse/log/production.log` ainsi que `/var/www/mail.err`. Vous devriez peut-être également utiliser [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) ou une autre application client de messagerie Yunohost pour tester rapidement que votre utilisateur et l'utilisateur dédié Yunohost Discourse (`response@...` ) reçoit du courrier.
|
||||
|
||||
### "Réponse par e-mail" et transfert de courrier
|
||||
|
||||
Si vous utilisez l'interface utilisateur d'administration de YunoHost pour configurer une adresse de transfert de courrier pour vos utilisateurs, vous risquez de rencontrer le problème selon lequel vos utilisateurs répondent par e-mail à partir de l'adresse e-mail transférée et le logiciel Discourse n'est pas capable de comprendre comment recevoir cet e-mail.
|
||||
|
||||
Par exemple, votre utilisateur a l'adresse e-mail "foo@myyunohostdomain.org" et tout le courrier est transféré à "foo@theirexternalmail.com". Discourse reçoit des réponses de `foo@theirexternalmail.com` mais ne peut pas comprendre comment les envoyer au compte utilisateur avec `foo@myyunohostdomain.org` configuré.
|
||||
|
||||
Leur travail est en cours pour permettre [plusieurs adresses e-mail pour un utilisateur](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) dans le développement de discours mais dans la version majeure actuelle (2.3 au 06-08-2019), il n'y a pas d'interface Web pour cette fonctionnalité. Il est possible de le configurer via l'interface de ligne de commande mais c'est **expérimental** et vous ne devriez pas entreprendre ce travail à moins de prendre le temps de comprendre ce que vous allez faire.
|
||||
|
||||
Voici comment configurer une adresse e-mail secondaire pour un compte utilisateur :
|
||||
|
||||
```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")
|
||||
```
|
||||
|
||||
## Fonctionnalités spécifiques à YunoHost
|
||||
|
||||
* Intégration avec les utilisateurs YunoHost et SSO :
|
||||
* Intégration LDAP : dans la pop-up de connexion, vous pouvez choisir "Se connecter avec LDAP" et utiliser vos identifiants YunoHost
|
||||
* mode privé : Forum accessible uniquement par les utilisateurs de YunoHost
|
||||
* mode public : Visible par tous
|
||||
*Discourse* peut maintenant recevoir du courrier de `foo@theirexternalmail.com` et le donner au compte utilisateur avec l'adresse email `foo@myyunohostdomain.org`.
|
||||
|
||||
#### Prise en charge multi-utilisateurs
|
||||
|
||||
Pris en charge, avec LDAP (pas de SSO).
|
||||
Pris en charge, avec LDAP et SSO.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -13,16 +13,14 @@
|
|||
setup_public=1
|
||||
upgrade=1
|
||||
# 2.6.1~ynh2
|
||||
upgrade=1 from_commit=c626379c98bb7f052061446cd152e4406979d49d
|
||||
upgrade=1 from_commit=c626379c98bb7f052061446cd152e4406979d49d
|
||||
backup_restore=1
|
||||
# Activate multi-instance test only if you have more than 2Gb RAM!
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=c626379c98bb7f052061446cd152e4406979d49d
|
||||
name=2.6.1~ynh2
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&
|
||||
name=Skip ci check memory
|
||||
|
|
338
conf/discourse_defaults.conf
Normal file
338
conf/discourse_defaults.conf
Normal file
|
@ -0,0 +1,338 @@
|
|||
#
|
||||
# DO NOT EDIT THIS FILE
|
||||
# If you need to make changes create a file called discourse.conf in this directory with your changes
|
||||
# On import this file will be imported using ERB
|
||||
#
|
||||
|
||||
# Discourse supports multiple mechanisms for production config.
|
||||
#
|
||||
# 1. You can do nothing and get these defaults (not recommended, you should at least set hostname)
|
||||
# 2. You can copy this file to config/discourse.conf and amend with your settings
|
||||
# 3. You can pass in config from your environment, all the settings below are available.
|
||||
# Append DISCOURSE_ and upper case the setting in ENV. For example:
|
||||
# to pass in db_timeout of 200 you would use DISCOURSE_DB_TIMEOUT=200
|
||||
|
||||
# All settings apply to production only
|
||||
|
||||
# connection pool size, sidekiq is set to 5, allowing an extra 3 for bg threads
|
||||
db_pool = 8
|
||||
|
||||
# ActiveRecord connection pool timeout in milliseconds
|
||||
db_timeout = 5000
|
||||
|
||||
# Database connection timeout in seconds
|
||||
db_connect_timeout = 5
|
||||
|
||||
# socket file used to access db
|
||||
db_socket =
|
||||
|
||||
# host address for db server
|
||||
# This is set to blank so it tries to use sockets first
|
||||
db_host =
|
||||
|
||||
# host address for db server when taking a backup via `pg_dump`
|
||||
# Defaults to `db_host` if not configured
|
||||
db_backup_host =
|
||||
|
||||
# port running db server, no need to set it
|
||||
db_port =
|
||||
|
||||
# db server port to use when taking a backup via `pg_dump`
|
||||
db_backup_port = 5432
|
||||
|
||||
# database name running discourse
|
||||
db_name = __DB_NAME__
|
||||
|
||||
# username accessing database
|
||||
db_username = __DB_NAME__
|
||||
|
||||
# password used to access the db
|
||||
db_password = __DB_PWD__
|
||||
|
||||
# Disallow prepared statements
|
||||
# see: https://github.com/rails/rails/issues/21992
|
||||
db_prepared_statements = false
|
||||
|
||||
# host address for db replica server
|
||||
db_replica_host =
|
||||
|
||||
# port running replica db server, defaults to 5432 if not set
|
||||
db_replica_port =
|
||||
|
||||
db_advisory_locks = true
|
||||
|
||||
# hostname running the forum
|
||||
hostname = "__DOMAIN__"
|
||||
|
||||
# backup hostname mainly for cdn use
|
||||
backup_hostname =
|
||||
|
||||
# address of smtp server used to send emails
|
||||
smtp_address = localhost
|
||||
|
||||
# port of smtp server used to send emails
|
||||
smtp_port = 25
|
||||
|
||||
# domain passed to smtp server
|
||||
smtp_domain = __DOMAIN__
|
||||
|
||||
# username for smtp server
|
||||
smtp_user_name =
|
||||
|
||||
# password for smtp server
|
||||
smtp_password =
|
||||
|
||||
# smtp authentication mechanism
|
||||
smtp_authentication = plain
|
||||
|
||||
# enable TLS encryption for smtp connections
|
||||
smtp_enable_start_tls = false
|
||||
|
||||
# mode for verifying smtp server certificates
|
||||
# to disable, set to 'none'
|
||||
smtp_openssl_verify_mode =
|
||||
|
||||
# force implicit TLS as per RFC 8314 3.3
|
||||
smtp_force_tls = false
|
||||
|
||||
# load MiniProfiler in production, to be used by developers
|
||||
load_mini_profiler = false
|
||||
|
||||
# Every how many requests should MP profile a request (aka take snapshot)
|
||||
# Default is never
|
||||
mini_profiler_snapshots_period = 0
|
||||
|
||||
# specify the URL of the destination that MiniProfiler should ship snapshots to
|
||||
# mini_profiler_snapshots_transport_auth_key is required as well
|
||||
mini_profiler_snapshots_transport_url =
|
||||
|
||||
# authorization key that will be included as a header in requests made by the
|
||||
# snapshots transporter to the URL specified above. The destination should
|
||||
# know this key and only accept requests that have this key in the
|
||||
# `Mini-Profiler-Transport-Auth` header.
|
||||
mini_profiler_snapshots_transport_auth_key =
|
||||
|
||||
# recommended, cdn used to access assets
|
||||
cdn_url =
|
||||
|
||||
# The hostname used by the CDN to request assets
|
||||
cdn_origin_hostname =
|
||||
|
||||
# comma delimited list of emails that have developer level access
|
||||
developer_emails = __EMAIL__
|
||||
|
||||
# redis server address
|
||||
redis_host = localhost
|
||||
|
||||
# redis server port
|
||||
redis_port = 6379
|
||||
|
||||
# redis replica server address
|
||||
redis_replica_host =
|
||||
|
||||
# redis replica server port
|
||||
redis_replica_port = 6379
|
||||
|
||||
# redis database
|
||||
redis_db = __REDIS_DB__
|
||||
|
||||
# redis password
|
||||
redis_password =
|
||||
|
||||
# skip configuring client id for cloud providers who support no client commands
|
||||
redis_skip_client_commands = false
|
||||
|
||||
# uses SSL for all Redis connections if true
|
||||
redis_use_ssl = false
|
||||
|
||||
# message bus redis server switch
|
||||
message_bus_redis_enabled = false
|
||||
|
||||
# message bus redis server address
|
||||
message_bus_redis_host = localhost
|
||||
|
||||
# message bus redis server port
|
||||
message_bus_redis_port = 6379
|
||||
|
||||
# message bus redis replica server address
|
||||
message_bus_redis_replica_host =
|
||||
|
||||
# message bus redis slave server port
|
||||
message_bus_redis_replica_port = 6379
|
||||
|
||||
# message bus redis database
|
||||
message_bus_redis_db = 0
|
||||
|
||||
# message bus redis password
|
||||
message_bus_redis_password =
|
||||
|
||||
# skip configuring client id for cloud providers who support no client commands
|
||||
message_bus_redis_skip_client_commands = false
|
||||
|
||||
# enable Cross-origin Resource Sharing (CORS) directly at the application level
|
||||
enable_cors = false
|
||||
cors_origin = ''
|
||||
|
||||
# enable if you really need to serve assets in prd
|
||||
serve_static_assets = true
|
||||
|
||||
# number of sidekiq workers (launched via unicorn master)
|
||||
sidekiq_workers = 5
|
||||
|
||||
# adjust stylesheets to rtl (requires "rtlit" gem)
|
||||
rtl_css = false
|
||||
|
||||
# connection reaping helps keep connection counts down, postgres
|
||||
# will not work properly with huge numbers of open connections
|
||||
# reap connections from pool that are older than 30 seconds
|
||||
connection_reaper_age = 30
|
||||
|
||||
# run reap check every 30 seconds
|
||||
connection_reaper_interval = 30
|
||||
|
||||
# set to relative URL (for subdirectory hosting)
|
||||
# IMPORTANT: path must not include a trailing /
|
||||
# EG: /forum
|
||||
relative_url_root = __PATH__
|
||||
|
||||
# increasing this number will increase redis memory use
|
||||
# this ensures backlog (ability of channels to catch up are capped)
|
||||
# message bus default cap is 1000, we are winding it down to 100
|
||||
message_bus_max_backlog_size = 100
|
||||
|
||||
# must be a 64 byte hex string, anything else will be ignored with a warning
|
||||
secret_key_base =
|
||||
|
||||
# fallback path for all assets which are served via the application
|
||||
# used by static_controller
|
||||
# in multi host setups this allows you to have old unicorn instances serve
|
||||
# newly compiled assets
|
||||
fallback_assets_path =
|
||||
|
||||
# S3 settings used for serving ALL public files
|
||||
# be sure to configre a CDN as well per cdn_url
|
||||
s3_bucket =
|
||||
s3_region =
|
||||
s3_access_key_id =
|
||||
s3_secret_access_key =
|
||||
s3_use_iam_profile =
|
||||
s3_cdn_url =
|
||||
s3_endpoint =
|
||||
s3_http_continue_timeout =
|
||||
s3_install_cors_rule =
|
||||
|
||||
### rate limits apply to all sites
|
||||
max_user_api_reqs_per_minute = 20
|
||||
max_user_api_reqs_per_day = 2880
|
||||
|
||||
max_admin_api_reqs_per_key_per_minute = 60
|
||||
|
||||
max_reqs_per_ip_per_minute = 200
|
||||
max_reqs_per_ip_per_10_seconds = 50
|
||||
|
||||
# applies to asset type routes (avatars/css and so on)
|
||||
max_asset_reqs_per_ip_per_10_seconds = 200
|
||||
|
||||
# global rate limiter will simply warn if the limit is exceeded, can be warn+block, warn, block or none
|
||||
max_reqs_per_ip_mode = block
|
||||
|
||||
# bypass rate limiting any IP resolved as a private IP
|
||||
max_reqs_rate_limit_on_private = false
|
||||
|
||||
# logged in DoS protection
|
||||
|
||||
# protection will only trigger for requests that queue longer than this amount
|
||||
force_anonymous_min_queue_seconds = 1
|
||||
# only trigger anon if we see more than N requests for this path in last 10 seconds
|
||||
force_anonymous_min_per_10_seconds = 3
|
||||
|
||||
# Any requests with the headers Discourse-Background = true will not be allowed to queue
|
||||
# longer than this amount of time.
|
||||
# Discourse will rate limit and ask client to try again later.
|
||||
background_requests_max_queue_length = 0.5
|
||||
|
||||
# if a message bus request queues for 100ms or longer, we will reject it and ask consumer
|
||||
# to back off
|
||||
reject_message_bus_queue_seconds = 0.1
|
||||
|
||||
# disable search if app server is queueing for longer than this (in seconds)
|
||||
disable_search_queue_threshold = 1
|
||||
|
||||
# maximum number of posts rebaked across the cluster in the periodical job
|
||||
# rebake process is very expensive, on multisite we have to make sure we never
|
||||
# flood the queue
|
||||
max_old_rebakes_per_15_minutes = 300
|
||||
|
||||
# maximum number of log messages in /logs
|
||||
max_logster_logs = 1000
|
||||
|
||||
# during precompile update maxmind database if older than N days
|
||||
# set to 0 to disable
|
||||
refresh_maxmind_db_during_precompile_days = 2
|
||||
|
||||
# backup path containing maxmind db files
|
||||
maxmind_backup_path =
|
||||
|
||||
# register an account at: https://www.maxmind.com/en/geolite2/signup
|
||||
# then head to profile and get your license key
|
||||
maxmind_license_key=
|
||||
|
||||
# when enabled the following headers will be added to every response:
|
||||
# (note, if measurements do not exist for the header they will be omitted)
|
||||
#
|
||||
# X-Redis-Calls: 10
|
||||
# X-Redis-Time: 1.02
|
||||
# X-Sql-Calls: 102
|
||||
# X-Sql-Time: 1.02
|
||||
# X-Queue-Time: 1.01
|
||||
enable_performance_http_headers = false
|
||||
|
||||
# gather JavaScript errors from clients (rate limited to 1 error per IP per minute)
|
||||
enable_js_error_reporting = true
|
||||
|
||||
# This is probably not a number you want to touch, it controls the number of workers
|
||||
# we allow mini scheduler to run. Prior to 2019 we ran a single worker.
|
||||
# On extremely busy setups this could lead to situations where regular jobs would
|
||||
# starve. Specifically jobs such as "run heartbeat" which keeps sidekiq running.
|
||||
# Having a high number here is very low risk. Regular jobs are limited in scope and scale.
|
||||
mini_scheduler_workers = 5
|
||||
|
||||
# enable compression on anonymous cache redis entries
|
||||
# this slightly increases the cost of storing cache entries but can make it much
|
||||
# cheaper to retrieve cache entries when redis is stores on a different machine to the one
|
||||
# running the web
|
||||
compress_anon_cache = false
|
||||
|
||||
# Only store entries in redis for anonymous cache if they are observed more than N times
|
||||
# for a specific key
|
||||
#
|
||||
# This ensures there are no pathological cases where we keep storing data in anonymous cache
|
||||
# never to use it, set to 1 to store immediately, set to 0 to disable anon cache
|
||||
anon_cache_store_threshold = 2
|
||||
|
||||
# EXPERIMENTAL - not yet supported in production
|
||||
# by default admins can install and amend any theme
|
||||
# you may restrict it so only specific themes are approved
|
||||
# in allowlist mode all theme updates must happen via git repos
|
||||
# themes missing from the list are automatically disallowed
|
||||
# list is a comma seperated list of git repos eg:
|
||||
# https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git
|
||||
allowed_theme_repos =
|
||||
|
||||
# Demon::EmailSync is used in conjunction with the enable_imap site setting
|
||||
# to sync N IMAP mailboxes with specific groups. It is a process started in
|
||||
# unicorn.conf, and it spawns N threads (one for each multisite connection) and
|
||||
# for each database spans another N threads (one for each configured group).
|
||||
#
|
||||
# We want this off by default so the process is not started when it does not
|
||||
# need to be (e.g. development, test, certain hosting tiers)
|
||||
enable_email_sync_demon = false
|
||||
|
||||
# we never want to queue more than 10000 digests per 30 minute block
|
||||
# this can easily lead to blocking sidekiq
|
||||
# on multisites we recommend a far lower number
|
||||
max_digests_enqueued_per_30_mins_per_site = 10000
|
||||
|
||||
# This cluster name can be passed to the /srv/status route to verify
|
||||
# the application cluster is the same one you are expecting
|
||||
cluster_name =
|
24
conf/settings.yml
Normal file
24
conf/settings.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
plugins:
|
||||
ldap_enabled:
|
||||
default: true
|
||||
ldap_user_create_mode:
|
||||
default: 'auto'
|
||||
ldap_lookup_users_by:
|
||||
default: 'email'
|
||||
ldap_hostname:
|
||||
default: 'localhost'
|
||||
ldap_port:
|
||||
default: 389
|
||||
ldap_method:
|
||||
default: 'plain'
|
||||
ldap_base:
|
||||
default: 'ou=users,dc=yunohost,dc=org'
|
||||
ldap_uid:
|
||||
default: 'uid'
|
||||
ldap_bind_dn:
|
||||
default: ''
|
||||
ldap_password:
|
||||
default: ''
|
||||
secret: true
|
||||
ldap_filter:
|
||||
default: ''
|
|
@ -1,41 +1,14 @@
|
|||
## Disclaimer
|
||||
|
||||
This package installs Discourse without Docker, for several reasons (mostly to support ARM architecture and low-profile servers, to mutualize nginx/postgresql/redis services and to simplify e-mail setup).
|
||||
As stated by the Discourse team:
|
||||
> The only officially supported installs of Discourse are [Docker](https://www.docker.io/) based. You must have SSH access to a 64-bit Linux server **with Docker support**. We regret that we cannot support any other methods of installation including cpanel, plesk, webmin, etc.
|
||||
|
||||
So please have this in mind when considering asking for Discourse support.
|
||||
|
||||
Moreover, you should have in mind Discourse [hardware requirements](https://github.com/discourse/discourse/blob/master/docs/INSTALL.md#hardware-requirements):
|
||||
- modern single core CPU, dual core recommended
|
||||
- 1 GB RAM minimum (with swap)
|
||||
- 64 bit Linux compatible with Docker
|
||||
- 10 GB disk space minimum
|
||||
|
||||
Finally, if installing on a low-end ARM device (e.g. Raspberry Pi):
|
||||
- installation can last up to 3 hours,
|
||||
- first access right after installation could take a couple of minutes.
|
||||
|
||||
## Overview
|
||||
[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).
|
||||
|
||||
## 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 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 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`.
|
||||
|
||||
|
@ -43,9 +16,9 @@ You should now be able to start testing. Try using the `/admin/email` "Send Test
|
|||
|
||||
### "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.
|
||||
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.
|
||||
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.
|
||||
|
||||
|
@ -53,20 +26,16 @@ 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
|
||||
$ RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails c
|
||||
$ UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com")
|
||||
```
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
* Integration with YunoHost users and SSO:
|
||||
* LDAP integration: on the login pop-up, you can choose "Login with LDAP" and use your YunoHost credentials
|
||||
* private mode: Forum only accessible by YunoHost users
|
||||
* public mode: Visible by anyone
|
||||
Discourse can now receive mail from `foo@theirexternalmail.com` and give it to the user account with mail address `foo@myyunohostdomain.org`.
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
Supported, with LDAP (no SSO).
|
||||
Supported, with LDAP and SSO.
|
||||
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -24,32 +24,31 @@ Enfin, si vous installez sur un appareil ARM bas de gamme (par exemple Raspberry
|
|||
- 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).
|
||||
|
||||
## Configuration
|
||||
|
||||
Utilisez le panneau d'administration de votre Discourse pour configurer cette application.
|
||||
|
||||
### Configuration de "Répondre par e-mail"
|
||||
### Configuration de "Répondre par email"
|
||||
|
||||
* Vous devez créer un utilisateur Yunohost dédié pour Discourse dont la boîte aux lettres sera utilisée par l'application Discourse. Vous pouvez le faire avec `yunohost user create response`, par exemple. Vous devez vous assurer que l'adresse e-mail est configurée pour être sur votre domaine Discourse.
|
||||
* Vous devez créer un utilisateur YunoHost dédié pour *Discourse* dont la boîte aux lettres sera utilisée par l'application. Vous pouvez le faire avec `yunohost user create response`, par exemple. Vous devez vous assurer que l'adresse email est configurée pour être sur votre domaine *Discourse*.
|
||||
|
||||
* Vous devez ensuite configurer votre fichier Discourse `/var/www/discourse/config/discourse.conf` avec les valeurs de configuration SMTP correctes. Veuillez consulter [ce commentaire](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) pour une explication des valeurs à modifier. Attention, lors de la mise à jour de l'application, vous devrez réappliquer cette configuration.
|
||||
* Vous devez ensuite configurer votre fichier de configuration `/var/www/discourse/config/discourse.conf` avec les valeurs de configuration SMTP correctes. Veuillez consulter [ce commentaire](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) pour une explication des valeurs à modifier. Attention, lors de la mise à jour de l'application, vous devrez réappliquer cette configuration.
|
||||
|
||||
* Vous devez activer la configuration Pop3 pour Dovecot. Voir [ce fil](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) pour savoir comment procéder. Vous pouvez valider votre configuration avec `systemctl restart dovecot && dovecot -n`. N'oubliez pas d'ouvrir les ports dont vous avez besoin ('995' est la valeur par défaut). Vous pouvez valider cela avec `nmap -p 995 yunohostdomain.org`.
|
||||
* Vous devez activer la configuration POP3 pour *Dovecot*. Voir [ce fil](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) pour savoir comment procéder. Vous pouvez valider votre configuration avec `systemctl restart dovecot && dovecot -n`. N'oubliez pas d'ouvrir les ports dont vous avez besoin (`995` est la valeur par défaut). Vous pouvez valider cela avec `nmap -p 995 domain.ltd`.
|
||||
|
||||
* Vous devez ensuite configurer le sondage Pop3 dans l'interface d'administration de Discourse. Veuillez consulter [ce commentaire](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) pour savoir comment procéder. Vous devrez suivre l'étape 5 de ce commentaire. Vous pouvez spécifier votre domaine Yunohost principal pour le `pop3_polling_host`.
|
||||
* Vous devez ensuite configurer le sondage Pop3 dans l'interface d'administration de *Discourse*. Veuillez consulter [ce commentaire](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) pour savoir comment procéder. Vous devrez suivre l'étape 5 de ce commentaire. Vous pouvez spécifier votre domaine Yunohost principal pour le `pop3_polling_host`.
|
||||
|
||||
Vous devriez maintenant pouvoir commencer à tester. Essayez d'utiliser le `/admin/email` « Envoyer un e-mail de test », puis affichez les onglets « Envoyé » ou « Ignoré », etc. Vous devriez voir un rapport sur ce qui s'est passé avec l'e-mail. Vous pouvez également regarder dans `/var/www/discourse/log/production.log` ainsi que `/var/www/mail.err`. Vous devriez peut-être également utiliser [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) ou une autre application client de messagerie Yunohost pour tester rapidement que votre utilisateur et l'utilisateur dédié Yunohost Discourse (`response@...` ) reçoit du courrier.
|
||||
Vous devriez maintenant pouvoir commencer à tester. Essayez d'utiliser le `/admin/email` « Envoyer un email de test », puis affichez les onglets « Envoyé » ou « Ignoré », etc. Vous devriez voir un rapport sur ce qui s'est passé avec l'email. Vous pouvez également regarder dans `/var/www/discourse/log/production.log` ainsi que `/var/www/mail.err`. Vous devriez peut-être également utiliser [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) ou une autre application client de messagerie YunoHost pour tester rapidement que votre utilisateur et l'utilisateur dédié YunoHost *Discourse* (`response@...`) reçoit du courrier.
|
||||
|
||||
### "Réponse par e-mail" et transfert de courrier
|
||||
### "Réponse par email" et transfert de courrier
|
||||
|
||||
Si vous utilisez l'interface utilisateur d'administration de YunoHost pour configurer une adresse de transfert de courrier pour vos utilisateurs, vous risquez de rencontrer le problème selon lequel vos utilisateurs répondent par e-mail à partir de l'adresse e-mail transférée et le logiciel Discourse n'est pas capable de comprendre comment recevoir cet e-mail.
|
||||
Si vous utilisez l'interface utilisateur d'administration de YunoHost pour configurer une adresse de transfert de courrier pour vos utilisateurs, vous risquez de rencontrer le problème selon lequel vos utilisateurs répondent par email à partir de l'adresse e-mail transférée et le logiciel *Discourse* n'est pas en mesure de comprendre comment recevoir cet email.
|
||||
|
||||
Par exemple, votre utilisateur a l'adresse e-mail "foo@myyunohostdomain.org" et tout le courrier est transféré à "foo@theirexternalmail.com". Discourse reçoit des réponses de `foo@theirexternalmail.com` mais ne peut pas comprendre comment les envoyer au compte utilisateur avec `foo@myyunohostdomain.org` configuré.
|
||||
Par exemple, votre utilisateur a l'adresse email "foo@myyunohostdomain.org" et tout le courrier est transféré à `foo@theirexternalmail.com`. *Discourse* reçoit des réponses de `foo@theirexternalmail.com` mais ne peut pas comprendre comment les envoyer au compte utilisateur avec `foo@myyunohostdomain.org` configuré.
|
||||
|
||||
Leur travail est en cours pour permettre [plusieurs adresses e-mail pour un utilisateur](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) dans le développement de discours mais dans la version majeure actuelle (2.3 au 06-08-2019), il n'y a pas d'interface Web pour cette fonctionnalité. Il est possible de le configurer via l'interface de ligne de commande mais c'est **expérimental** et vous ne devriez pas entreprendre ce travail à moins de prendre le temps de comprendre ce que vous allez faire.
|
||||
Leur travail est en cours pour permettre [plusieurs adresses email pour un utilisateur](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) dans le développement de *Discours* mais dans la version majeure actuelle (2.3 au 06-08-2019), il n'y a pas d'interface Web pour cette fonctionnalité. Il est possible de le configurer via l'interface de ligne de commande mais c'est **expérimental** et vous ne devriez pas entreprendre ce travail à moins de prendre le temps de comprendre ce que vous allez faire.
|
||||
|
||||
Voici comment configurer une adresse e-mail secondaire pour un compte utilisateur :
|
||||
Voici comment configurer une adresse email secondaire pour un compte utilisateur :
|
||||
|
||||
```bash
|
||||
$ cd /var/www/discours
|
||||
|
@ -57,79 +56,11 @@ $ RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails c
|
|||
$ UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com")
|
||||
```
|
||||
|
||||
## Fonctionnalités spécifiques à YunoHost
|
||||
|
||||
* Intégration avec les utilisateurs YunoHost et SSO :
|
||||
* Intégration LDAP : dans la pop-up de connexion, vous pouvez choisir "Se connecter avec LDAP" et utiliser vos identifiants YunoHost
|
||||
* mode privé : Forum uniquement accessible ## Disclaimer
|
||||
|
||||
Ce package installe Discourse sans Docker, pour plusieurs raisons (principalement pour prendre en charge l'architecture ARM et les serveurs discrets, pour mutualiser les services nginx/postgresql/redis et pour simplifier la configuration de la messagerie).
|
||||
Comme indiqué par l'équipe Discourse :
|
||||
> Les seules installations officiellement prises en charge de Discourse sont basées sur [Docker](https://www.docker.io/). Vous devez avoir un accès SSH à un serveur Linux 64 bits **avec prise en charge Docker**. Nous regrettons de ne pouvoir prendre en charge aucune autre méthode d'installation, notamment cpanel, plesk, webmin, etc.
|
||||
|
||||
Veuillez donc avoir cela à l'esprit lorsque vous envisagez de demander de l'aide à Discourse.
|
||||
|
||||
De plus, vous devriez avoir à l'esprit Discourse [exigences matérielles](https://github.com/discourse/discourse/blob/master/docs/INSTALL.md#hardware-requirements) :
|
||||
- CPU monocœur moderne, double cœur recommandé
|
||||
- 1 Go de RAM minimum (avec swap)
|
||||
- Linux 64 bits compatible avec Docker
|
||||
- 10 Go d'espace disque minimum
|
||||
|
||||
Enfin, si vous installez sur un appareil ARM bas de gamme (par exemple Raspberry Pi) :
|
||||
- l'installation peut durer jusqu'à 3 heures,
|
||||
- le premier accès juste après l'installation peut prendre quelques minutes.
|
||||
|
||||
## Aperçu
|
||||
[Discourse](http://www.discourse.org) est la plate-forme de discussion 100% open source conçue pour la prochaine décennie d'Internet. Utilisez-le comme :
|
||||
|
||||
- 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).
|
||||
|
||||
## Configuration
|
||||
|
||||
Utilisez le panneau d'administration de votre Discourse pour configurer cette application.
|
||||
|
||||
### Configuration de "Répondre par e-mail"
|
||||
|
||||
* Vous devez créer un utilisateur Yunohost dédié pour Discourse dont la boîte aux lettres sera utilisée par l'application Discourse. Vous pouvez le faire avec `yunohost user create response`, par exemple. Vous devez vous assurer que l'adresse e-mail est configurée pour être sur votre domaine Discourse.
|
||||
|
||||
* Vous devez ensuite configurer votre fichier Discourse `/var/www/discourse/config/discourse.conf` avec les valeurs de configuration SMTP correctes. Veuillez consulter [ce commentaire](https://github.com/YunoHost-Apps/discourse_ynh/issues/2#issuecomment-409510325) pour une explication des valeurs à modifier. Attention, lors de la mise à jour de l'application, vous devrez réappliquer cette configuration.
|
||||
|
||||
* Vous devez activer la configuration Pop3 pour Dovecot. Voir [ce fil](https://forum.yunohost.org/t/how-to-enable-pop3-in-yunohost/1662/2) pour savoir comment procéder. Vous pouvez valider votre configuration avec `systemctl restart dovecot && dovecot -n`. N'oubliez pas d'ouvrir les ports dont vous avez besoin ('995' est la valeur par défaut). Vous pouvez valider cela avec `nmap -p 995 yunohostdomain.org`.
|
||||
|
||||
* Vous devez ensuite configurer le sondage Pop3 dans l'interface d'administration de Discourse. Veuillez consulter [ce commentaire](https://meta.discourse.org/t/set-up-reply-via-email-support/14003) pour savoir comment procéder. Vous devrez suivre l'étape 5 de ce commentaire. Vous pouvez spécifier votre domaine Yunohost principal pour le `pop3_polling_host`.
|
||||
|
||||
Vous devriez maintenant pouvoir commencer à tester. Essayez d'utiliser le `/admin/email` « Envoyer un e-mail de test », puis affichez les onglets « Envoyé » ou « Ignoré », etc. Vous devriez voir un rapport sur ce qui s'est passé avec l'e-mail. Vous pouvez également regarder dans `/var/www/discourse/log/production.log` ainsi que `/var/www/mail.err`. Vous devriez peut-être également utiliser [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) ou une autre application client de messagerie Yunohost pour tester rapidement que votre utilisateur et l'utilisateur dédié Yunohost Discourse (`response@...` ) reçoit du courrier.
|
||||
|
||||
### "Réponse par e-mail" et transfert de courrier
|
||||
|
||||
Si vous utilisez l'interface utilisateur d'administration de YunoHost pour configurer une adresse de transfert de courrier pour vos utilisateurs, vous risquez de rencontrer le problème selon lequel vos utilisateurs répondent par e-mail à partir de l'adresse e-mail transférée et le logiciel Discourse n'est pas capable de comprendre comment recevoir cet e-mail.
|
||||
|
||||
Par exemple, votre utilisateur a l'adresse e-mail "foo@myyunohostdomain.org" et tout le courrier est transféré à "foo@theirexternalmail.com". Discourse reçoit des réponses de `foo@theirexternalmail.com` mais ne peut pas comprendre comment les envoyer au compte utilisateur avec `foo@myyunohostdomain.org` configuré.
|
||||
|
||||
Leur travail est en cours pour permettre [plusieurs adresses e-mail pour un utilisateur](https://meta.discourse.org/t/additional-email-address-per-user-account-support/59847) dans le développement de discours mais dans la version majeure actuelle (2.3 au 06-08-2019), il n'y a pas d'interface Web pour cette fonctionnalité. Il est possible de le configurer via l'interface de ligne de commande mais c'est **expérimental** et vous ne devriez pas entreprendre ce travail à moins de prendre le temps de comprendre ce que vous allez faire.
|
||||
|
||||
Voici comment configurer une adresse e-mail secondaire pour un compte utilisateur :
|
||||
|
||||
```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")
|
||||
```
|
||||
|
||||
## Fonctionnalités spécifiques à YunoHost
|
||||
|
||||
* Intégration avec les utilisateurs YunoHost et SSO :
|
||||
* Intégration LDAP : dans la pop-up de connexion, vous pouvez choisir "Se connecter avec LDAP" et utiliser vos identifiants YunoHost
|
||||
* mode privé : Forum accessible uniquement par les utilisateurs de YunoHost
|
||||
* mode public : Visible par tous
|
||||
*Discourse* peut maintenant recevoir du courrier de `foo@theirexternalmail.com` et le donner au compte utilisateur avec l'adresse email `foo@myyunohostdomain.org`.
|
||||
|
||||
#### Prise en charge multi-utilisateurs
|
||||
|
||||
Pris en charge, avec LDAP (pas de SSO).
|
||||
Pris en charge, avec LDAP et SSO.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"url": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.2.0"
|
||||
"yunohost": ">= 4.2.4"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
pkg_dependencies="g++ libjemalloc1|libjemalloc2 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-dev libapr1-dev libxslt1-dev libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli"
|
||||
|
||||
RUBY_VERSION="2.7.1"
|
||||
RUBY_VERSION="2.7.2"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
@ -63,25 +63,25 @@ check_memory_requirements_upgrade() {
|
|||
}
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
# Create an html to serve as maintenance notice
|
||||
echo "<!DOCTYPE html>
|
||||
# Create an html to serve as maintenance notice
|
||||
echo "<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="3">
|
||||
<title>Your app $app is currently under maintenance!</title>
|
||||
<style>
|
||||
body {
|
||||
width: 70em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
body {
|
||||
width: 70em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -92,8 +92,8 @@ ynh_maintenance_mode_ON () {
|
|||
</body>
|
||||
</html>" > "/var/www/html/maintenance.$app.html"
|
||||
|
||||
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
|
||||
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
|
||||
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
|
||||
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
|
||||
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
|
||||
# Use another location, to not be in conflict with the original config file
|
||||
location ${path_url}_maintenance/ {
|
||||
|
@ -105,38 +105,38 @@ try_files maintenance.$app.html =503;
|
|||
include conf.d/yunohost_panel.conf.inc;
|
||||
}" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
|
||||
# The current config file will redirect all requests to the root of the app.
|
||||
# To keep the full path, we can use the following rewrite rule:
|
||||
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
|
||||
# The difference will be in the $1 at the end, which keep the following queries.
|
||||
# But, if it works perfectly for a html request, there's an issue with any php files.
|
||||
# This files are treated as simple files, and will be downloaded by the browser.
|
||||
# Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
|
||||
# The current config file will redirect all requests to the root of the app.
|
||||
# To keep the full path, we can use the following rewrite rule:
|
||||
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
|
||||
# The difference will be in the $1 at the end, which keep the following queries.
|
||||
# But, if it works perfectly for a html request, there's an issue with any php files.
|
||||
# This files are treated as simple files, and will be downloaded by the browser.
|
||||
# Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
|
||||
|
||||
systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
}
|
||||
|
||||
ynh_maintenance_mode_OFF () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
systemctl reload nginx
|
||||
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
systemctl reload nginx
|
||||
|
||||
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
|
||||
sleep 4
|
||||
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
|
||||
sleep 4
|
||||
|
||||
# Then remove the temporary files used for the maintenance.
|
||||
rm "/var/www/html/maintenance.$app.html"
|
||||
rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
# Then remove the temporary files used for the maintenance.
|
||||
rm "/var/www/html/maintenance.$app.html"
|
||||
rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
|
||||
systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -463,27 +463,27 @@ ynh_cleanup_ruby () {
|
|||
# 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)"
|
||||
local result max db
|
||||
result="$(redis-cli INFO keyspace)"
|
||||
|
||||
# get the num
|
||||
max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
|
||||
# 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
|
||||
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..."
|
||||
test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
|
||||
|
||||
echo "$db"
|
||||
echo "$db"
|
||||
}
|
||||
|
||||
# Create a master password and set up global settings
|
||||
|
@ -492,6 +492,6 @@ ynh_redis_get_free_db() {
|
|||
# usage: ynh_redis_remove_db database
|
||||
# | arg: database - the database to erase
|
||||
ynh_redis_remove_db() {
|
||||
local db=$1
|
||||
redis-cli -n "$db" flushall
|
||||
local db=$1
|
||||
redis-cli -n "$db" flushall
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
# Add settings here as needed by your application
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers)
|
||||
|
||||
#=================================================
|
||||
|
@ -150,6 +150,7 @@ ynh_script_progression --message="Starting a systemd service..."
|
|||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready"
|
||||
sleep 60
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -28,6 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
|||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -57,6 +58,7 @@ ynh_script_progression --message="Storing installation settings..."
|
|||
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=email --value=$email
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -83,11 +85,9 @@ ynh_script_progression --message="Creating a PostgreSQL database..."
|
|||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_string_random)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
# Set extensions
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database=$db_name
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||
|
@ -139,47 +139,16 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring Discourse..."
|
||||
|
||||
# Configure database
|
||||
discourse_config_file="$final_path/config/discourse.conf"
|
||||
cp $final_path/config/discourse_defaults.conf $discourse_config_file
|
||||
ynh_replace_string --match_string="db_name = discourse" --replace_string="db_name = $db_name" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="db_username = discourse" --replace_string="db_username = $db_name" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="db_password =" --replace_string="db_password = $db_pwd" --target_file="$discourse_config_file"
|
||||
|
||||
# Configure hostname
|
||||
ynh_replace_string --match_string="hostname = \"www.example.com\"" --replace_string="hostname = \"$domain\"" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="relative_url_root =" --replace_string="relative_url_root = ${path_url%/}" --target_file="$discourse_config_file"
|
||||
|
||||
# Serve static assets (i.e. images, js, etc.)
|
||||
ynh_replace_string --match_string="serve_static_assets = false" --replace_string="serve_static_assets = true" --target_file="$discourse_config_file"
|
||||
|
||||
# Don't show miniprofiler
|
||||
ynh_replace_string --match_string="load_mini_profiler = true" --replace_string="load_mini_profiler = false" --target_file="$discourse_config_file"
|
||||
|
||||
# Configure e-mail server
|
||||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||
ynh_replace_string --match_string="developer_emails =" --replace_string="developer_emails = $admin_mail" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="smtp_address =" --replace_string="smtp_address = localhost" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="smtp_domain =" --replace_string="smtp_domain = $domain" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="smtp_enable_start_tls = true" --replace_string="smtp_enable_start_tls = false" --target_file="$discourse_config_file"
|
||||
|
||||
# Configure redis
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||
ynh_replace_string --match_string="redis_db = 0" --replace_string="redis_db = $redis_db" --target_file="$discourse_config_file"
|
||||
|
||||
# Don't notify on new versions (handled by the YunoHost package)
|
||||
ynh_replace_string --match_string="new_version_emails = true" --replace_string="new_version_emails = false" --target_file="$discourse_config_file"
|
||||
|
||||
# Calculate and store the config file checksum
|
||||
ynh_store_file_checksum --file="$discourse_config_file"
|
||||
ynh_add_config --template="../conf/discourse_defaults.conf" --destination="$final_path/config/discourse.conf"
|
||||
chmod 400 "$final_path/config/discourse.conf"
|
||||
chown $app "$final_path/config/discourse.conf"
|
||||
|
||||
# Configure LDAP plugin
|
||||
ldap_config_file="$final_path/plugins/discourse-ldap-auth/config/settings.yml"
|
||||
ynh_replace_string --match_string="adfs.example.com" --replace_string="localhost" --target_file="$ldap_config_file"
|
||||
ynh_replace_string --match_string="dc=example,dc=com" --replace_string="ou=users,dc=yunohost,dc=org" --target_file="$ldap_config_file"
|
||||
ynh_replace_string --match_string="sAMAccountName" --replace_string="uid" --target_file="$ldap_config_file"
|
||||
ynh_store_file_checksum --file="$ldap_config_file"
|
||||
ynh_add_config --template="../conf/settings.yml" --destination="$final_path/plugins/discourse-ldap-auth/config/settings.yml"
|
||||
|
||||
# Disable svgo worker
|
||||
echo "svgo: false" > $final_path/.image_optim.yml
|
||||
|
@ -243,7 +212,7 @@ ynh_script_progression --message="Populating the database..."
|
|||
#Set default data (especially to have correct image URLs for subfolder install)
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name <<< "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('title', 1, 'YunoHost Forum', 'NOW()', 'NOW()');
|
||||
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('site_description', 1, 'YunoHost Forum', 'NOW()', 'NOW()');
|
||||
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('contact_email', 14, '$admin_mail', 'NOW()', 'NOW()');
|
||||
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('contact_email', 14, '$email', 'NOW()', 'NOW()');
|
||||
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('contact_url', 1, '$domain$path_url', 'NOW()', 'NOW()');
|
||||
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('site_contact_username', 15, '$admin', 'NOW()', 'NOW()');
|
||||
INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('logo_url', 1, '${path_url%/}/images/d-logo-sketch.png', 'NOW()', 'NOW()');
|
||||
|
@ -262,7 +231,7 @@ ynh_script_progression --message="Creating Discourse admin user..."
|
|||
|
||||
# Create a random password
|
||||
admin_pwd=$(ynh_string_random)
|
||||
$rake_exec admin:create <<< "$admin_mail
|
||||
$rake_exec admin:create <<< "$email
|
||||
$admin_pwd
|
||||
$admin_pwd
|
||||
y
|
||||
|
@ -348,6 +317,7 @@ ynh_script_progression --message="Starting a systemd service..."
|
|||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready"
|
||||
sleep 60
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -357,8 +327,6 @@ ynh_script_progression --message="Configuring permissions..."
|
|||
# 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
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ 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
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -104,7 +105,6 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
# Set extensions
|
||||
|
@ -140,6 +140,7 @@ else
|
|||
fi
|
||||
ynh_app_setting_set --app=$app --key=unicorn_workers --value=$unicorn_workers
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready"
|
||||
sleep 60
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
|
|
|
@ -21,9 +21,10 @@ 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_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers)
|
||||
email=$(ynh_app_setting_get --app=$app --key=email)
|
||||
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||
:
|
||||
|
@ -204,51 +205,16 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Configuring Discourse..."
|
||||
|
||||
# Configure Discourse
|
||||
discourse_config_file="$final_path/config/discourse.conf"
|
||||
# Make a backup of the original config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$discourse_config_file"
|
||||
|
||||
cp $final_path/config/discourse_defaults.conf $discourse_config_file
|
||||
|
||||
ynh_replace_string --match_string="db_name = discourse" --replace_string="db_name = $db_name" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="db_username = discourse" --replace_string="db_username = $db_name" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="db_password =" --replace_string="db_password = $db_pwd" --target_file="$discourse_config_file"
|
||||
# Configure hostname
|
||||
ynh_replace_string --match_string="hostname = \"www.example.com\"" --replace_string="hostname = \"$domain\"" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="relative_url_root =" --replace_string="relative_url_root = ${path_url%/}" --target_file="$discourse_config_file"
|
||||
# Serve static assets (i.e. images, js, etc.)
|
||||
ynh_replace_string --match_string="serve_static_assets = false" --replace_string="serve_static_assets = true" --target_file="$discourse_config_file"
|
||||
# Don't show miniprofiler
|
||||
ynh_replace_string --match_string="load_mini_profiler = true" --replace_string="load_mini_profiler = false" --target_file="$discourse_config_file"
|
||||
# Configure e-mail server
|
||||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||
ynh_replace_string --match_string="developer_emails =" --replace_string="developer_emails = $admin_mail" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="smtp_address =" --replace_string="smtp_address = localhost" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="smtp_domain =" --replace_string="smtp_domain = $domain" --target_file="$discourse_config_file"
|
||||
ynh_replace_string --match_string="smtp_enable_start_tls = true" --replace_string="smtp_enable_start_tls = false" --target_file="$discourse_config_file"
|
||||
# Configure redis
|
||||
ynh_replace_string --match_string="redis_db = 0" --replace_string="redis_db = $redis_db" --target_file="$discourse_config_file"
|
||||
# Don't notify on new versions (handled by the YunoHost package)
|
||||
ynh_replace_string --match_string="new_version_emails = true" --replace_string="new_version_emails = false" --target_file="$discourse_config_file"
|
||||
|
||||
# Calculate and store the config file checksum
|
||||
ynh_store_file_checksum --file="$discourse_config_file"
|
||||
ynh_add_config --template="../conf/discourse_defaults.conf" --destination="$final_path/config/discourse.conf"
|
||||
chmod 400 "$final_path/config/discourse.conf"
|
||||
chown $app "$final_path/config/discourse.conf"
|
||||
|
||||
# Configure LDAP plugin
|
||||
ldap_config_file="$final_path/plugins/discourse-ldap-auth/config/settings.yml"
|
||||
# Make a backup of the original config file if modified
|
||||
ynh_backup_if_checksum_is_different "$ldap_config_file"
|
||||
|
||||
ynh_replace_string --match_string="adfs.example.com" --replace_string="localhost" --target_file="$ldap_config_file"
|
||||
ynh_replace_string --match_string="dc=example,dc=com" --replace_string="ou=users,dc=yunohost,dc=org" --target_file="$ldap_config_file"
|
||||
ynh_replace_string --match_string="sAMAccountName" --replace_string="uid" --target_file="$ldap_config_file"
|
||||
|
||||
# Calculate and store the config file checksum
|
||||
ynh_store_file_checksum --file="$ldap_config_file"
|
||||
ynh_add_config --template="../conf/settings.yml" --destination="$final_path/plugins/discourse-ldap-auth/config/settings.yml"
|
||||
|
||||
# Disable svgo worker
|
||||
echo "svgo: false" > $final_path/.image_optim.yml
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -269,11 +235,6 @@ then
|
|||
secret="$(ynh_string_random)"
|
||||
ynh_add_config --template="../conf/secrets.yml" --destination="$final_path/config/secrets.yml"
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
pushd "$final_path"
|
||||
# Install bundler, a gems installer
|
||||
ynh_gem install bundler
|
||||
|
@ -402,6 +363,7 @@ yunohost service add $app --log "$final_path/log/unicorn.stderr.log" "$final_pat
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready"
|
||||
sleep 60
|
||||
|
||||
#=================================================
|
||||
# DISABLE MAINTENANCE MODE
|
||||
|
|
Loading…
Add table
Reference in a new issue