Discourse – Bringing civilized discussion to the Internet
Being Civil
The open source Discourse framework modernizes bulletin boards and online forums with live updates as you read, providing never-ending scrolling, community moderation capabilities, heuristic spam blocking, special layouts for mobile devices, and more.
Let's face it: Internet forums have not improved much since the heyday of Usenet in the early 1990s, and when web-based forums came along, things got worse, not better. Say goodbye to threaded discussions, killfiles, cross-posting, uuencoded binary attachments, and many other wonderful features that had worked their way into the newsgroup-based technology over the years. Now, say hello to pages and pages of unstructured lists of messages, clunky interfaces, and endless, unreadable, unwrapped lines of text. All because, you know, the web.
Now Jeff Atwood (of Coding Horror and Stack Overflow fame), Robin Ward, Sam Saffron, Neil Lalonde, and Régis Hanol have decided to change all that. Meet Discourse [1], a framework that drags forums kicking and screaming into the 21st century.
With an interface (Figure 1) slightly reminiscent of the defunct Google Wave (now Apache Wave – equally more or less defunct), Discourse has the lofty goal of bringing civilized discussion to the Internet.
The list of features is impressive and includes live updates as you read, threads, never-ending scrolling (no more pages), community moderation capabilities, heuristic spam blocking, and special layouts for mobile devices, among many other features.
Although you can host your forum at the Discourse website (many options, plans, and prices are available, including having the team install the software for you on a server in the cloud), you can also set up your own forum on your own server. Discourse is distributed under the free GPL license after all, and uses exclusively free software on the back end.
That said, from download to a fully functional Discourse site is quite a bumpy ride. Multiple dependencies have to be resolved, installed, and configured in obscure ways, and the documentation is not all that up to date. Because this method of deploying Discourse is unsupported (the developers would prefer you used a Docker container in the cloud), you might consider using the methods recommended by the creators; they are very reasonable.
Being as hardheaded as I am, though, I gave it a shot, and here's how I fared.
Pre-Installation
As usual, I start with a stock Debian (wheezy server) install, updated and upgraded:
apt-get update apt-get upgrade
The instructions for installing on Ubuntu or any other Debian-based distro can be found at the Discourse GitHub site [3]. The distro is labeled deprecated by the developers, and some of the instructions are not relevant or have changed since it was written, but it is a good start. Be patient because the preinstall is a looong and rather convoluted process; however, trust me, it pays off in the end.
First, get the dependencies out of the way by installing git
and vim
– Git to download the Discourse software tree, and vim because it is always useful:
# apt-get install git vim
Next, get rid of Apache completely to avoid port collisions (Discourse prefers Nginx),
# apt-get purge apache2.2-common
and install Nginx as the web server and PostgreSQL as the database back end:
# apt-get install postgresql postgresql-contrib-9.1 nginx
The tutorial [3] says you need the Postfix email server, although you don't, but you do need Redis and the OpenSSH server:
# apt-get install redis-server openssh-server
So that everything works smoothly, you'll need some extra system packages, some of which you might already have installed on your system. However, just in case, use the complete install
command in Listing 1, then download Discourse from the GitHub repository.
Listing 1
Getting Discourse
Setting Up Ruby
Discourse is written in Ruby on Rails and is best run on a Ruby virtual machine (RVM). In the tutorial, the developers recommend creating a discourse user and sandboxing the RVM within it. They also recommend associating the user with a PostgreSQL account, so you should do that, too.
First, create a new user called discourse and set your password; then, create a new PostgreSQL user account, also called discourse, and set its password:
# adduser --shell /bin/bash --gecos 'Discourse application' discourse # su postgres $ createuser -s discourse $ psql -c "alter user discourse password '<yourpassword>';"
Assuming you are in the directory into which you downloaded Discourse from GitHub, you can now move the discourse
directory into the web server's root directory, pass ownership over to the discourse user, then change to the discourse user:
# mv discourse /var/www/ # chown -R discourse:discourse /var/www/discourse/ # su discourse
Note that all actions now must be performed using this user unless specified otherwise. As usual, the #
prompt indicates that you have to enter commands as root.
Now you can install the Ruby virtual machine into the discourse user and refresh your profile – remember to do this as the discourse user:
$ \curl -s -S -L https://get.rvm.io | bash -s stable $ . ~/.rvm/scripts/rvm
To build Ruby, you need to discover all the requirements, so run:
$ rvm --autolibs=read-fail requirements
On my system, this gave the list shown in Table 1. The next step is to install the missing dependencies with apt-get
, which in my case required the following command line:
Table 1
My Ruby Dependencies
libreadline6-dev |
libsqlite3-dev |
sqlite3 |
autoconf |
libgdbm-dev |
libncurses5-dev |
automake |
bison |
pkg-config |
libffi-dev |
# apt-get install libreadline6-dev \ libsqlite3-dev sqlite3 autoconf \ libgdbm-dev libncurses5-dev automake \ bison pkg-config libffi-dev
If you repeat the rvm --autolibs
… command again, you can make sure you caught all the dependencies. Now you can install Ruby, set it as the default, and install the Ruby bundler gem:
$ rvm install 2.0.0 $ rvm use 2.0.0 --default $ gem install bundler
This gem simplifies installing other gems by resolving dependencies automatically.
To get the Discourse-specific gems, move into the /var/www/discourse
directory and install:
$ cd /var/www/discourse $ bundle install --deployment --without test
At this point, you can sit back and relax, because you have a lot of downloading and installing to get through.
Configuring Discourse
Once everything has installed, change into the /var/www/discourse/config
directory and copy the discourse_quickstart.conf
file to discourse.conf
and the discourse.pill.sample
file to discourse.pill
.
You probably won't have to edit discourse.pill
, but open discourse.conf
in your favorite text editor and add or edit the values on the left of the =
signs. You can see an example (sans comments and faff) in Listing 2 (see also the "Language Support" box).
Language Support
You might want your forums in a language that is not English. Discourse supports that, too. You can see all the supported languages by running the Discourse rails console within the /var/www/discourse
directory,
$ RAILS_ENV=production bundle exec rails c
and then typing
> LocaleSiteSetting.values
from within the console. (The >
symbol is the Rails prompt, by the way.) The instruction above will dump the values contained in LocaleSiteSettings
to the Rails console output, and you will be able to see what values are available.
To change to a language different from English, say Spanish, you can enter:
> SiteSetting.default_locale = 'es'
that is, once you have checked that es is one of the values contained within LocaleSettings
.
Listing 2
Sample discourse.conf File
Remember the developers_emails
field – where you can enter a comma-separated list of email addresses for the people who will be site admins – because it can be useful when you get your site online. I will talk more about it in the "Up and Running" section, but for now, move back to the /var/www/discourse
directory and set up the database (see Listing 3).
Listing 3
Setting Up the Database
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.