Discourse – Bringing civilized discussion to the Internet
Being Civil

© Lead Image © Svitlana Martynova, 123RF.com
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
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
Kubuntu Focus Announces XE Gen 2 Linux Laptop
Another Kubuntu-based laptop has arrived to be your next ultra-portable powerhouse with a Linux heart.
-
MNT Seeks Financial Backing for New Seven-Inch Linux Laptop
MNT Pocket Reform is a tiny laptop that is modular, upgradable, recyclable, reusable, and ships with Debian Linux.
-
Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled
If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.
-
Gnome 44 Release Candidate Now Available
The Gnome 44 release candidate has officially arrived and adds a few changes into the mix.
-
Flathub Vying to Become the Standard Linux App Store
If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.
-
Debian 12 to Ship with KDE Plasma 5.27
The Debian development team has shifted to the latest version of KDE for their testing branch.
-
Planet Computers Launches ARM-based Linux Desktop PCs
The firm that originally released a line of mobile keyboards has taken a different direction and has developed a new line of out-of-the-box mini Linux desktop computers.
-
Ubuntu No Longer Shipping with Flatpak
In a move that probably won’t come as a shock to many, Ubuntu and all of its official spins will no longer ship with Flatpak installed.
-
openSUSE Leap 15.5 Beta Now Available
The final version of the Leap 15 series of openSUSE is available for beta testing and offers only new software versions.
-
Linux Kernel 6.2 Released with New Hardware Support
Find out what's new in the most recent release from Linus Torvalds and the Linux kernel team.