Discourse: Difference between revisions
Line 81: | Line 81: | ||
Create the following nginx vhost config file to proxy connections sent to 'discourse.opensourceecology.org' to the unix socket file created by Discourse. | Create the following nginx vhost config file to proxy connections sent to 'discourse.opensourceecology.org' to the unix socket file created by Discourse. | ||
<pre> | |||
cat << EOF > /etc/nginx/conf.d/discourse.opensourceecology.org.conf | |||
################################################################################ | ################################################################################ | ||
# File: discourse.opensourceecology.org.conf | # File: discourse.opensourceecology.org.conf | ||
Line 166: | Line 168: | ||
EOF | EOF | ||
</pre> | </pre> | ||
TODO: actually include varnish | |||
==SSL Cert== | ==SSL Cert== |
Revision as of 07:44, 8 November 2019
2019-11 Install Guide
In 2019-11, I (Michael Altfield) tested an install of Discourse on the OSE Staging Server. I documented the install steps here so they could be exactly reproduced on production
Install Prereqs
First we have to install docker. The version in the yum repos (1.13.1) was too old to be supported by Discourse (which states it requires a minimum of 17.03.1).
Note that the install procedure recommended by Docker and Discourse for Docker is a curl piped to shell. This should never, ever, ever be done. The safe procedure is to manually add the gpg key and repo to the server as get.docker.org script should do -- assuming it were not modified in transit. Note that Docker does *not* cryptographically sign their install script in any way, and it therefore cannot be safely validated.
# first, install the (ASCII-armored) docker gpg key to /etc/pki/rpm-gpg/docker.gpg cp docker.gpg /etc/pki/rpm-gpg/docker.gpg chown root:root /etc/pki/rpm-gpg/docker.gpg chmod 0644 /etc/pki/rpm-gpg/docker.gpg # and install the repo cat << EOF > /etc/yum.repos.d/docker-ce.repo [docker-ce-stable] name=Docker CE Stable - $basearch baseurl=https://download.docker.com/linux/centos/7/$basearch/stable enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/docker.gpg EOF # finally, install docker from the repos yum install docker-ce
Install Discourse
From the Disourse Install Guide, checkout the github repo as root to /var/discourse. You'll want to validate that this wasn't modified in transit; there are no cryptographic signatures to validate authenticity of the repo's contents here. A huge failing on Discourse's part (but, again, Discourse's sec is rotten from its foundation in Docker; see above).
sudo -s git clone https://github.com/discourse/discourse_docker.git /var/discourse cd /var/discourse
The Discourse install script doesn't support the very simple config of an smtp server running on localhost:25 without auth. That is to say, Discourse doesn't support the default postfix config for RHEL/CentOS and most web servers on the net..
We have to manually edit the /var/discourse/containers/app.yml. I couldn't find any Discourse documentation for these DISCOURSE_SMTP_* variables, but I did have success with these values:
DISCOURSE_SMTP_ADDRESS: localhost DISCOURSE_SMTP_PORT: 25 DISCOURSE_SMTP_AUTHENTICATION: none DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none DISCOURSE_SMTP_ENABLE_START_TLS: false
TODO: how to resolve the errors (bug?) that the username & password is not defined on first install?
Also, we already have nginx bound to port 443 as our ssl terminator, so the defaults in app.yml will fail. Instead, we add the 'web.socketed.template.yml' file, remove the 'expose' block, and we'll setup nginx to proxy connections to the resulting discourse unix socket file [1]
Add this line to the "templates" block in /var/discourse/containers/app.yml.
- "templates/web.socketed.template.yml"
And also comment-out the entire "expose" block and all its contents
#expose: # - "80:80" # http # - "443:443" # https
TODO: try the 'discourse-setup' script now
discourse.opensourcecology.org DNS
Add 'discourse.opensourceecology.org' to the list of domain names defined for our VPN IP Address in /etc/hosts on the staging server.
In production, this will mean actually adding A & AAAA DNS entries for 'discourse' to point to our production server.
Nginx Vhost Config
Create the following nginx vhost config file to proxy connections sent to 'discourse.opensourceecology.org' to the unix socket file created by Discourse.
cat << EOF > /etc/nginx/conf.d/discourse.opensourceecology.org.conf ################################################################################ # File: discourse.opensourceecology.org.conf # Version: 0.1 # Purpose: Internet-listening web server for truncating https, basic DOS # protection, and passing to varnish cache (varnish then passes to # apache) # Author: Michael Altfield <michael@opensourceecology.org> # Created: 2019-11-07 # Updated: 2019-11-07 ################################################################################ # this whole site is a subdomain, so the below block for redirecting a naked # domain does not apply here #server { # # redirect the naked domain to 'www' # #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # # '$status $body_bytes_sent "$http_referer" ' # # '"$http_user_agent" "$http_x_forwarded_for"'; # #access_log /var/log/nginx/www.opensourceecology.org/access.log main; # #error_log /var/log/nginx/www.opensourceecology.org/error.log main; # include conf.d/secure.include; # include conf.d/ssl.opensourceecology.org.include; # listen 10.241.189.11:443; # server_name opensourceecology.org; # return 301 https://www.opensourceecology.org$uri; # #} server { access_log /var/log/nginx/discourse.opensourceecology.org/access.log main; error_log /var/log/nginx/discourse.opensourceecology.org/error.log; include conf.d/secure.include; include conf.d/ssl.opensourceecology.org.include; #include conf.d/ssl.openbuildinginstitute.org.include; listen 10.241.189.11:443; #listen [2a01:4f8:172:209e::2]:443; server_name discourse.opensourceecology.org; ############# # SITE_DOWN # ############# # uncomment this block && restart nginx prior to apache work to display the # "SITE DOWN" webpage for our clients # root /var/www/html/SITE_DOWN/htdocs/; # index index.html index.htm; # # # force all requests to load exactly this page # location / { # try_files $uri /index.html; # } ################### # SEND TO VARNISH # ################### # location / { # proxy_pass http://127.0.0.1:6081; # proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-Proto https; # proxy_set_header X-Forwarded-Port 443; # proxy_set_header Host $host; # } ################## # SEND TO DOCKER # ################## location / { proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:; proxy_set_header Host $http_host; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Real-IP $remote_addr; } } EOF
TODO: actually include varnish
SSL Cert
TODO: update the certbot cron script to add a Subject Alt Name for discourse.opensourceecology.org
MJ Feb 2019 Review
- Legend:
= exists,
= good,
= great
Q&A plugin appears to be adequate, but does not have downvotes. Downvotes are important, as a knowledgeable person should ideally be able to downsize bull****. This is important for collaborative learning - and should be developed to approach the usefulness of Stack Exchange and Reddit. Would need to put development time into this.
Rating - appears excellent - [1]
Commenting plugin - excellent, up with Disqus. [2]
Bug Tracking - a simple wiki/Discourse hack can be done by a Bugtracking or Known Bugs category on the wiki, and embedding a thread on that bug from Discourse, so discussion can happen, and when resolved, thread can be closed. We'd have to see in practice how this looks. That is the simplest way to go without installing yet another pieces of software, and using Discourse and Wiki hold most of the weight, the rest being Wordpress.
Cons
- Free to try rather than really free? See last con at [3]
OSE Use Case
- The generic OSE use case for transparency is using the Wiki for embedding all kinds of content, where the wiki is a proven and scalable tool for collaborative development - and a core tool in OSE's usage. With this said, it is useful to have various forms of content embedded in the wiki, so that we don't have to use many different platforms for different functions: we can just embed content from other common platforms. The intent is modular design where content can be reused and mixed throughout OSE's web presence.
- Embed individual Discourse threads on wiki pages. This way we upgrade content from wiki pages to live discussion - where content for discussion can be edited right in the wiki page. The intent of this is to improve the use of the Wiki as a development platform so that the wiki is more intuitive. See embed of thread example - [4]. This must allow any single thread from Discourse to be embedded.
- Rating of a service or product - in an open source franchise, products/services of collaborators can be rated. A simple tool like the wiki can have a rating feature - without having to use any other software. This is yet another way to make the wiki more functional and user-friendly. See example - [5]
- Upvoting - no evidence of Discourse serving this function well compared to Askbot. By upvoting, we mean simply that all the content remains visible, and a single solution is not marked. This allows users to pick nuggets from different answers - while allowing bulk filtering to occur before looking at the answer. From the OSE perspective, marking a question as resolved is not inclusive or abundant. What if someone else has a better solution? It may be that Discourse can be modified to do upvoting readily, or can simulate this function well - but we would have to see in practice if this is feasible.
2018-09 Review
In 2018-09, I (Michael Altfield) had just learned about Discourse as I was working on the phplist project. phplist's forums use Discourse. At the same time, Alex Au recommended to Marcin that we setup a replacement forum using Discourse.
Pros
- Very pleasant interface
- Very nice functionality ootb. Badges, user trust system for easy moderation, climbing ranks, love, at-calls (@), etc -- co-founder Jeff Atwood also founded Stack Exchange, so expect similar functionality
- Very popular. Many, many forums have switched to Discourse over the past several years
- Great selection of plugins & integrations (though no decent db/index for searching them) https://meta.discourse.org/c/plugin https://github.com/discourse
- ie: replace wordpress comments with a discourse thread. This may or may not be good.
- Example wordpress blog post: https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/
- Corresponding discourse thread for the comments to the above post: https://meta.discourse.org/t/wp-discourse-dysfunctional-shows-only-start-the-discussion-at/36016
- ie: replace wordpress comments with a discourse thread. This may or may not be good.
- Looks like we can import our content from Vanila https://meta.discourse.org/t/how-to-migrate-from-vanilla-to-discourse/27273
- Well-funded org that hosts their project (think wordpress.com) for many of their customers. The good here is that Discorse can pay a salary to devs, unlike many open source projects. But it's worth nothing that people choose to pay for hosting probably because it's Ruby on Rails, and a PIA to self-host.
- While not officially supported, it looks like users have setup Discourse behind varnish 4 [2]
Cons
- Ruby on rails
- They openly state that they're hard to install, and therefore _only_ support installation via a docker container [3]
- I'm seriously worried about the security of a project that thinks it's acceptable to use
wget -qO- https://get.docker.com/ | sh
as a step in their install guide [4] - Discourse explicitly states that they only support newer devices. I'm concerned that means that we may make our content inaccessible to, say, that 6-year-old desktop running windows xp in the machine shop. Indeed, discourse only supports IE 11+, which came with Windows 8.1 in 2013--5 years ago. [5]
- If javascript is disabled, the site is read-only. JS is a requirement for posting, replying, etc. But because Discourse also functions as a mailing list, JS-free users can still contribute content in a limited way by replying to threads via email [6]
Neutral
- Project has been around for 5 years (initial release in 2013) https://en.wikipedia.org/wiki/Discourse_%28software%29
Noteable sites using Discourse
- Ubuntu https://discourse.ubuntu.com/
- Phplist https://discuss.phplist.org/
- Whonix https://forums.whonix.org/
- Manjaro https://forum.manjaro.org
See Also
References
- ↑ https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247
- ↑ https://meta.discourse.org/t/discourse-behind-varnish/4864/10
- ↑ https://github.com/discourse/discourse/blob/master/docs/INSTALL.md#why-do-you-only-officially-support-docker
- ↑ https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#install-docker--git
- ↑ https://github.com/discourse/discourse#requirements
- ↑ https://forums.whonix.org/t/turn-off-javascript-for-forums/1692/2
Links
- Civilized Discourse Construction Kit - positively biased post about Discourse - [6]
- https://www.slant.co/options/2789/~discourse-review
- https://forums.whonix.org/t/change-whonix-forum-software-to-discourse/1181