Discourse – Bringing civilized discussion to the Internet

Configuring Nginx

The Discourse bundle comes with two Nginx configuration files you can use straight out of the box. All you have to do is copy them over to the /etc/nginx/conf.d/ directory (Listing 4).

Listing 4

Copying the Nginx Configuration Files

 

If you have a default.conf file in your Nginx conf.d directory and you're not planning on running any other sites through Nginx, you can give it a different file name to avoid the possibility of it interfering with your setup:

# mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.disabled

At the very least, you'll have to change the server_name line in /etc/nginx/conf.d/discourse.conf,

server_name <enter.your.web.hostname.here>;

and change <enter.your.web.hostname.here> to whatever you decide to name your Discourse server. However, you might also want to change the port number on which Nginx listens or the default public directory if you have installed Discourse somewhere different on your system.

On my test system, I also had to comment out the etag line with a hash sign (#) as follows:

# etag off;

Once saved and after exiting from the configuration file, I had to create the /var/nginx directory by hand before I could safely reload Nginx:

# mkdir /var/nginx
# /etc/init.d/nginx reload

Getting back to the discourse user, install Bluepill, a process monitoring tool (Listing 5). In theory, you can now run Discourse using

Listing 5

Installing Bluepill

 

$ RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=/var/www/discourseRAILS_ENV=productionNUM_WEBS=2 bluepill \
  --no-privileged-c ~/.bluepill load /var/www/discourse/config/discourse.pill

In our lab, however, I encountered an error message that indicated that there was an uninitialized constant in the Discourse number_helper.rb file. If you also encounter this bug, open the file, which you will find in /home/discourse/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.2.0.beta1/lib/active_support/ with your text editor and add the following as the first line of the file:

require 'active_support'

Now running the lines mentioned above starts Discourse without a hitch. To make sure Discourse runs every time the server boots, run crontab -e as the discourse user and include the line in Listing 6 as a cron job.

Listing 6

Start Discourse from cron

 

Up and Running

Now that your Discourse instance is up and running (Figure 2), users can start registering their accounts. Notice, however, that on your first visit, the site tells you to set up accounts for the admin users you assigned in the discourse.conf file in Listing 2. Therefore, you might want to register those users before going public with your site.

Figure 2: Your newly installed Discourse. Note the warning telling you the site is not configured yet.

As soon as you register a user with administrator privileges, they'll see a different page from regular users (Figure 3). The first thing they are asked to do is create some content – at least five topics (posts that start a thread) and 30 public posts – so users can start acquiring "trust levels."

Figure 3: When you sign in as an admin, you receive your orders.

I'll look at the matter of trust a bit later on, but first I'll try to clarify the jargon and talk about how to start posting. First off, a topic in Discourse is the first post in a thread. The rest of the posts are just posts.

Instead of having different forums that contain discussion threads, Discourse is more or less flat and uses categories to split the topics by theme. Suppose you wanted to use Discourse for your LUG; you could have categories for Announcements, Suggestions, Support, Off Topic, and so on. Initially, only an administrator can create a category (Figure 4) by clicking on the menu icon next to their avatar in the upper right-hand corner of the screen and choosing Categories. Once in the Categories screen, clicking the grey + Create Category button on the left lets you start a thread.

Figure 4: As the admin user, you can create categories, which separate posts by subject matter.

Subcategories are created in the same way you create a regular category, except you then assign it to a parent category. For example, the Meetings category could have Announcements as its parent, and it would become a subcategory. The Create Category dialog lets you decide the color of the category's label, the category's permissions (as in, who can create a new topic, see posts, and reply within the category), and personalize a category with an icon and a background image.

Before you start creating content, you will want to do some housework via the administrator's control panel. You can access this by clicking on the menu icon and choosing Admin (Figure 5).

Figure 5: The administrator's control panel allows you to configure every detail of your Discourse site.

The first pane, the Dashboard, informs you of software updates and stats, and on the right, it gives you a rundown of problems detected on your site. On a new site, the issues will mostly refer to unconfigured features, such as favicons, unconfigured email addresses for administration purposes, and so on.

Across the top, a series of tabs allow you to configure every aspect of your Discourse site. If you click on Settings, you'll see no fewer than 18 tabs down the left side of the screen (Figure 6).

Figure 6: The Settings pane lets you configure email, trust levels, security, and more.

To say that the Discourse configuration tool is comprehensive is an understatement.

Under Settings, you can solve most of the problems shown in the Dashboard and even set up Discourse to act as a mailing list server, for those old-timers who prefer settling issues by email (see the Email tab for this). You can also establish how users can register, deciding whether registration is by invitation only (perhaps a good idea for new sites still in the testing phase), must be approved by the moderator, and so on. You can also define how users gain "trust."

Trust Issues

To begin, you have to understand how Discourse regulates the content that gets posted to a site and how it tries to keep the level of, well, discourse high. First off, if you try to create a topic or post with very little content, you get a warning (Figure 7). Also, if you just repeat the same words over and over, you are reprimanded (Figure 8).

Figure 7: Try to post something too short, and you get knuckle-rapped; …
Figure 8: … likewise, if you just copy and paste the same word over and over.

Another filter comes from the users themselves, who can silently "like" (click the heart at the bottom of any post) or "flag" (click the flag icon) a post. If someone participates on the site enough and gets enough likes, they rise through the ranks and reach new levels of trust (see Settings | Trust Levels), which allows them more access to features on the site.

To begin, users start at level 0 with very limited privileges, but at level 1 (Basic) they can start including images in posts and flag other users' posts if they deem them inappropriate; at level 2 (Member), they can invite new users to the site to participate in the discussion of a topic or invite new users with a group private message.

A level 3 (Regular) user can recategorize and rename posts, participate in the exclusive "frequent flyers" lounge, and so on. However, if someone is flagged often enough, they can be demoted and even banned from the site.

The last lines of defense are, of course, the moderators and admins, who can delete posts and ban users, bypassing the meritocratic system described above.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Welcome

    The sorry state of discourse on the Internet has many causes, and the experts have offered many solutions for the mess. One of the biggest problems is the way that social media platforms reward engagement.

  • diaspora*

    You don't need Facebook to keep up with your friends online. With diaspora*, you get a similar experience without the spying.

  • A New Chrome OS-Like Ubuntu Remix is Now Available

    Ubuntu Web looks to be your Chrome OS alternative.

  • News

    In the news: Gnome 44 Release Candidate; Flathub Vying to Become the Standard Linux App Store; Debian 12 to Ship with KDE Plasma 5.27; Planet Computers Launches ARM-Based Linux Desktop PCs; Ubuntu No Longer Shipping with Flatpak; openSUSE Leap 15.5 Beta; Linux Kernel 6.2 Released with NewHardware Support; Kubuntu Focus Team Releases NewMini Desktop; and US National Cybersecurity Strategy Released.

  • Distro Walk – blendOS

    blendOS uses container technology to allow different distributions to coexist on a single desktop environment. Bruce talks to Rudra Saraswat, blendOS's 13-year-old developer.

comments powered by Disqus
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.

Learn More

News