DEV Community

Cover image for How to install a Discourse Forum
Rabin Dhamala
Rabin Dhamala

Posted on • Edited on • Originally published at cleavr.io

How to install a Discourse Forum

If you're looking for a versatile and feature-rich community forum software, then Discourse is a top choice. As an open-source platform, Discourse offers modern and responsive forum functionality that allows you to engage with your community or customers effectively. In this step-by-step guide, we will walk youthrough the process of installing Discourse for production use, so you can create a powerful and interactive community platform.

Prerequisites

Before installing Discourse, make sure you have the following
prerequisites in place:

  1. A server or virtual machine running a compatible operating system,
    such as Ubuntu 22.04 or later, with sufficient resources (CPU,
    RAM, storage) to support a production-grade forum.

  2. A domain name registered and configured to point to the IP address
    of your server. This is necessary for accessing your Discourse
    forum over the internet.

  3. Ports 80 and 443 open on your server's firewall. Port 80 is used
    for HTTP traffic, while port 443 is used for HTTPS traffic. These
    ports need to be open to allow incoming web traffic to your
    Discourse instance.

  4. An email server set up and configured to send emails for Discourse
    to function properly. Discourse relies on email notifications for
    user registration, password reset, and other important
    functionalities. So, having a functional email server is a
    prerequisite for installing Discourse.

Now, let's get started with the installation process.

Step 1: Provision Your Server

The recommended server specs for running Discourse may vary depending on
the size of your community and the expected usage patterns. However, as
a general guideline, the Discourse team recommends the following minimum
server specifications for a production Discourse installation:

  • CPU: Dual-core or higher, clocked at 2.0 GHz or higher
  • RAM: 2 GB or higher
  • Storage: 10 GB or higher of free disk space
  • Operating System: Ubuntu 22.04 LTS or later, or another officially supported Linux distribution
  • Database: PostgreSQL 13 or later
  • Web Server: Nginx

In my case, I have used Cleavr to provision a plain server. With Cleavr, you can easily deploy and manage web applications, including Discourse, on your own server or a cloud provider of your choice. Cleavr provides a user-friendly interface, advanced server management features, and seamless integration with popular web servers, databases, and email services, making it an excellent choice for installing and managing Discourse for production use.

Step 2: Install Discourse

Login to your server using SSH and pull the official Discourse github repository and start discourse setup. Run the following commands:

sudo mkdir /var/discourse
sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
sudo ./discourse-setup
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure Email

To enable notifications, password resets, and system alerts on
Discourse, configuring an email SMTP server is necessary. It is recommended to use established email service providers like SendGrid, Mailgun, or Amazon SES. Detailed setup instructions are available from the service providers or seek help from a professional.

Once you have obtained the API keys or SMTP credentials from your email service provider, you can proceed with the Discourse installation process and input the necessary information when prompted. This will allow your Discourse forum to send emails and provide a smooth experience for your forum users.

email setup

Please note that using personal SMTP servers, such as those provided by Gmail, is not recommended for Discourse installations. It is against Gmail's terms of service to use their SMTP servers for mass mailing, which includes sending automated emails from a forum.

Step 4: Access Discourse

Once the installation is complete, you can access your
Discourse forum by navigating to your domain name in your web browser. Discourse provides a web-based setup wizard to further configure your forum, including setting up categories, creating an admin account, and customizing your forum's appearance.

Upon successfully setting up your Discourse domain, you will be greeted with a congratulatory message to acknowledge the successful installation.

Installation

Once you have completed the registration process and confirmed your admin email, you will receive a notification that your forum is now ready for use.

Forum

Step 5: Secure Your Discourse Instance

After installation, it's important to secure your Discourse instance to protect against potential security risks. Some recommended security
measures include:

  • Enable HTTPS using a valid SSL certificate.
  • Regularly update Discourse and its plugins to the latest versions.
  • Configure strong and unique passwords for all user accounts.
  • Set up firewall rules to allow only necessary incoming and outgoing traffic.
  • Disable unnecessary services and features in Discourse that you don't use.

In conclusion, installing Discourse for production use
involves setting up a Docker container(handled automatically during discourse setup), configuring email, and securing your instance. By following the steps outlined in this guide, you can have a powerful and customizable community forum up and running in no time. Happy forum-ing!

Top comments (0)