Is this Nethserver module helpful to you?
Please consider donating to the author

Thank you kindly!

2019/03/04 05:32 · HF

Available for NS7.8

beta stage

Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more!. Discourse is based on the docker engine with a debian container, you will install nethserver-docker with a reverse proxy to the container. The installation can be long on tiny server.

Maintainer

Stephane de Labrusse at stephdl@de-labrusse.fr

Installation

1-You need to install my repository, see how to do it

2-You can install discourse

yum install nethserver-discourse --enablerepo=stephdl

Principle

You create a container which named by default app, its configuration is templated and can be found at /var/discourse/containers/app.yml. If you need to add some custom settings, the custom-template is the way to go. The path to the templates are : /etc/e-smith/templates/var/discourse/containers/app.yml/

By default we follow the stable branch, this can be changed in the configuration. If you need the testing branch, then use version: tests-passed and build again the container

You can create another discourse instance by adding a new configuration /var/discourse/containers/app2.yml and running again the launcher, however you will have to create your own apache reverse proxy.

The container and the data are separated, all your data are in /var/discourse/shared/standalone/, this path is included in the internal backup of NethServer if you have decided to use it. It means that you can destroy the container, the website won't be available anymore but the data of your website will be safe. Once the docker container will be up, then you website will be online.

First access

Something to understand is that discourse will be in a container, it cannot use the smtp of localhost, you need to give the complete parameters of a remote smtp (the one of your server, or another of your internet provider for example). Discourse must be able to send email because the admin will receive a link to enable his account.

config setprop discourse domain DISCOURSE.DOMAIN.COM emailAdmin USER@DOMAIN.COM smtpHostname SMTP.DOMAIN.COM smtpLogin USER@DOMAIN.COM smtpPassword PASSWORD smtpPort 587 smtpTls true
  • domain: the domain where discourse is reachable, obviously it is a real domain name resolved locally or on internet
  • emailAdmin: the email of the administrator, an activation email will be sent to this account
  • smtpHostname: the host of your smtp provider
  • smtpLogin: the account you have to use with the smtp provider
  • smtpPassword: the password of the smtp account
  • smtpPort: the port of the smtp server
  • smtpTls: use TLS or not (true/false)

then issue:

signal-event nethserver-discourse-save

once done we need to bootstrap the docker container of dicourse, this can be really long

cd /var/discourse
./launcher rebuild app

once ended you can see the container up

[root@ns7loc12 discourse]# docker ps
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS               NAMES
9a393d387f24        local_discourse/app   "/sbin/boot"        37 minutes ago      Up 37 minutes                           app

if you have had no errors, then you can go to the domain you have set, in my example https://DISCOURSE.DOMAIN.COM

You will have some questions to answer, then an activation email will be sent to the emailAdmin, discourse must be able to send email for this, else you could not install completely discourse.

The discourse domain name must be added manually to the virtualhost list of letsencryt if you plan to use it

Launcher

Discourse use the docker engine behind, they have implemented a nice and easy way to interact with docker : launcher The default container is named app and its configuration is saved at /var/discourse/containerd/app.yml, it is a template.

[root@ns7loc4 ~]# /var/discourse/launcher
Usage: launcher COMMAND CONFIG [--skip-prereqs] [--docker-args STRING]
Commands:
    start:       Start/initialize a container
    stop:        Stop a running container
    restart:     Restart a container
    destroy:     Stop and remove a container
    enter:       Open a shell to run commands inside the container
    logs:        View the Docker logs for a container
    bootstrap:   Bootstrap a container for the config based on a template
    run:         Run the given command with the config in the context of the last bootstrapped image
    rebuild:     Rebuild a container (destroy old, bootstrap, start new)
    cleanup:     Remove all containers that have stopped for > 24 hours
    start-cmd:   Generate docker command used to start container

Options:
    --skip-prereqs             Don't check launcher prerequisites
    --docker-args              Extra arguments to pass when running docker
    --skip-mac-address         Don't assign a mac address
    --run-image                Override the image used for running the container

for example to stop the container

/var/discourse/launcher stop app

Manual

Debug

  • docker network: check if docker has a workable network
docker run --network aqua busybox nslookup google.com
docker run --network aqua busybox ping -c 1 8.8.4.4
  • discourse container: enter in the discourse (debian) container, after you can issue some linux command
/var/discourse/launcher enter app

you have few available commands, you need to install each needed, for ping : apt install iputils-ping

  • check logs of the container
/var/discourse/launcher logs app

Bugs

Please raise Issues on github