目 录CONTENT

文章目录
Web

Discourse Forum Setup Tutorial: Zero-Base Deployment of Discourse Open Source Community Forum

zeruns
2025-11-08 / 0 Comment / 1 Like / 11 Views / 0 words / It is currently checking whether it has been included...

Linux + Baota + Docker + Discourse: Quick Zero-Base Forum Website Setup. Discourse is the most popular open-source forum software internationally.

Why use Baota for setup? It's for easier website management and the ability to deploy multiple websites on the same server.

Video Tutorial: https://www.bilibili.com/video/BV1f311BrEdp/

Here's a forum I built with Discourse: https://bbs.eeclub.top/

I previously created a tutorial for setting up the lightweight forum software Flarum. If you're interested, you can check it out: https://blog.zeruns.com/archives/866.html

Webmaster Exchange Group: 767557452


Introduction to Discourse

Discourse is an open-source forum software designed for the modern web environment, positioned as a replacement for traditional forums to provide a smoother community interaction experience.

Discourse was launched ten years ago by Jeff Atwood, co-founder of Stack Overflow.

Many famous software forums internationally are built using Discourse. In comparison, its adoption rate in China is relatively low.

Comparing Discourse and Flarum, Discourse's usage rate is much higher than Flarum's, but Flarum is more popular in China than Discourse. Therefore, when using Discourse and encountering problems, it's best to use a VPN and Google to find solutions and related information, as Baidu's content is relatively limited.

Discourse also comes with built-in AI plugins that can implement AI moderation, AI translation, AI search, and other features. Discourse AI Configuration Tutorial: https://blog.zeruns.com/archives/917.html

I. Core Features

  • Real-time Interaction: Discourse supports real-time updates, allowing users to communicate in a conversational manner rather than the traditional "post" format of forums. This real-time nature enables users to participate in discussions more naturally.
  • Mobile-friendly: Discourse is designed to adapt to different screen sizes, making it more convenient to browse and participate in discussions on mobile devices.
  • User Trust Levels: Discourse determines user trust levels based on their activity and contributions in the community. This helps prevent abuse and spam.
  • Powerful Search Function: The forum supports powerful search functionality, helping users easily find topics and discussions they're interested in.
  • Plugin System: Discourse provides a rich plugin system that can be extended according to needs, allowing customization and enhancement of forum functionality.

II. Main Use Cases

  • Enterprise/Product Communities: For product feedback and user communication, such as user forums for software companies or after-sales discussion areas for hardware products.
  • Interest Communities: For niche interest groups (such as technology, reading, photography) to communicate, supporting discussion sections segmented by topic.
  • Internal Collaboration Platforms: Some companies use it as an internal communication tool, replacing traditional email or instant messaging software to preserve traceable collaboration content.

III. Deployment and Maintenance

Discourse offers two main deployment methods to meet different user needs:

Deployment Method Advantages Disadvantages
Official Hosting No technical background required, official handles server maintenance, updates, and security Requires subscription fees, lower customization freedom
Self-hosted Completely free, can freely choose servers, deep customization of features Requires technical skills in server management and code deployment


Introduction to Baota Panel

Baota Panel is a powerful server management software that supports Windows and Linux systems and provides a simple way to manage servers through a web interface, significantly improving operational efficiency. Its main features and functions include:

  1. Server Management: Baota Panel allows users to complete server maintenance tasks through an interactive interface, such as updating the system, adding websites, and modifying settings. This eliminates the need for users to remember and input complex Linux commands, completing tasks with simple clicks.
  2. Multi-system Support: Baota Panel supports both Windows and Linux systems, meaning users can conveniently use Baota Panel for management on both Windows and Linux servers.
  3. One-click Management Features: Baota Panel provides various server management functions including websites, FTP, and databases. Its visual file manager, visual software manager, visual CPU, memory, and traffic monitoring charts, and scheduled tasks make server management more intuitive and efficient.
  4. Security Monitoring: Baota Panel also provides server security monitoring features, such as one-click scanning of server clusters for viruses, vulnerabilities, and mining malware, as well as real-time alerts to help operations personnel quickly locate faults.
  5. Ease of Use: Baota Panel's installation and use are very simple. Users can install the panel in a short time and replace complex command input with mouse clicks, greatly reducing the difficulty and complexity of server management.
    In summary, Baota Panel is a comprehensive, easy-to-use, and efficient server management tool suitable for all types of users to perform server maintenance and management.

Baota Official Website: https://url.vpszj.cn/bt


Other Website Building Tutorial Recommendations


Domain Registration

What is a Domain?

A domain is the "street address" of a website, used to replace hard-to-remember IP address strings (like 192.168.1.1). For example, entering blog.zeruns.com allows access to a specific website without needing to remember the server's IP.

Domain structure consists of three parts:

  1. Suffix (like .com) represents the website type
  2. Main domain (zeruns) is the custom name
  3. Subdomain (blog) can be freely set

When users enter a domain, the DNS system automatically converts it to the server's IP address to complete access. Registering a domain requires purchasing through platforms like Alibaba Cloud (annual fee around 50 RMB, some niche suffixes are cheaper), then binding and resolving the domain with the server IP to launch the website. A good domain should be short and memorable, like taobao.com which uses homophones to leave a lasting impression.

Registering a Domain

You can register domains on platforms like Tencent Cloud, Alibaba Cloud, and Rain Cloud, or use Rain Cloud's free second-level domains.

Below is an example using Rain Cloud to register a zeruns.xyz domain.

Find Domain Services in the cloud products.

Click Domain Registration and search for the domain you want to register.

Enter information according to the prompts

After filling in the information, click Register Now and wait for the review to complete

If you're using a domestic server, you'll also need to complete domain registration filing.

I won't go into detail about the filing process; you can research it yourself.

Friendly reminder: Purchasing domestic cloud servers from major providers like Tencent Cloud or Alibaba Cloud for 3 months or more provides free filing services. Purchasing domestic servers from Rain Cloud or Haoliang Cloud Engine for 3 months or more also provides free filing services.


Preparation

First, you need a cloud server with a public IP. I recommend Rain Cloud's:

Rain Cloud discount registration address: https://rain.zeruns.com/?s=blog-en

Discount code: zeruns

After registering with the discount code and binding WeChat, you'll receive a 50% off coupon for the first month and can claim an exclusive 20% off coupon from the points mall

After registering your account, go to the Rain Cloud console. The Cloud Server entrance can be found in the Overview and Cloud Products sections of the backend:

Click Purchase Cloud Server, then Select Server Region. Domestic users are advised to choose mainland data centers. But if you don't have a filed domain or don't want to file, it's recommended to choose Hong Kong or US servers (Hong Kong is recommended first for lower latency).

I chose Hong Kong Zone 3 here.

For configuration, 2-core 4GB is generally sufficient. If your website has many users, choose a higher configuration, or you can upgrade later.

Choose Debian 12 for the system. After making all selections, click Buy Now. Annual payments have a 30% discount (those who registered with my discount code can claim an additional 20% off coupon to stack with the 30% annual discount for a total of 44% off), or you can choose the 1-day trial for 1 RMB.

After purchase, you can see your purchased cloud server in My Cloud Servers. Click Manage.

You can then see the cloud server information, where you can reinstall/switch systems and upgrade configurations. Wait for the server creation to complete before proceeding to the next step.


Connecting to the Server

Download, install, and open SSH client software. Recommended SSH clients are PuTTY or MobaXterm.

SSH client software download address: https://www.123pan.com/ps/2Y9Djv-UAtvH.html

I'm using MobaXterm here. In the SSH client, enter your server's IP address (obtained from the console) and SSH port (default is 22), then click OK or Open.

Then enter the username and press Enter. The username is typically root by default. Next, enter the password (obtained from the console) and press Enter to confirm. The password will not be displayed when entered.

Friendly reminder: In the SSH terminal, hold the left mouse button to select text, then release the mouse and click once in a blank area to copy the selected text; right-click in the SSH terminal to paste.


Deploying Discourse

Discourse requires Docker, so you must first install Docker. In the BaoTa Panel, click DockerInstall Now, select Default installation method, then Confirm and wait for completion.

Docker Installation

Docker Setup

Return to your SSH terminal and execute the following commands to download Discourse source code, running each line sequentially (do not copy comments). (/www/dk_project/dk_app is BaoTa's default Docker app directory; you may change it to another location if needed, but avoid modifying commands if unsure).

# Create discourse directory
mkdir /www/dk_project/dk_app/discourse/
# Enter discourse directory
cd /www/dk_project/dk_app/discourse/
# Clone the repository
git clone https://github.com/discourse/discourse_docker.git .
# Add the discourse directory to the global safe list to prevent warnings
git config --global --add safe.directory /www/dk_project/dk_app/discourse

Source Code Download

Configure Discourse
Since Linux panels occupy default ports 80 and 443, and your installation path differs from the default, you ​cannot directly run ./discourse-setup​. Instead, ​first edit the configuration file​: Execute the following command to copy and rename the template file.

cp /www/dk_project/dk_app/discourse/samples/standalone.yml /www/dk_project/dk_app/discourse/containers/app.yml

Next, use BaoTa's File Manager to navigate to /www/dk_project/dk_app/discourse/containers and edit app.yml.

App.yml Configuration

App.yml Editing

Key edits required:

1. Port Mapping

expose:
  - "180:80"   # HTTP
  - "1443:443" # HTTPS

Here, we map container ports to 180 and 1443 on the host machine to avoid conflicts with the panel. You may choose other ports, but remember them for later. We also prevent direct public exposure for security, enabling BaoTa's Nginx firewall.

2. Domain Binding

DISCOURSE_HOSTNAME: 'bbs.zeruns.xyz'

Replace the domain in single quotes with your own.

3. Admin Email

DISCOURSE_DEVELOPER_EMAILS: '[email protected]'

Replace the email in single quotes. ​This must be set beforehand​—you’ll need it to activate the admin account later.

4. Email Configuration

DISCOURSE_SMTP_ADDRESS: smtp.qq.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: [email protected]
DISCOURSE_SMTP_PASSWORD: "xxxxxxxx"
DISCOURSE_NOTIFICATION_EMAIL: [email protected]

Configure SMTP settings​. For QQ Mail, use the same address/port as above. Replace the email with your own, and generate an authorization code in QQ Mail’s Account & SecurityPOP3/IMAP/SMTP/Exchange/CardDAV Services settings.

You may also set up your own mail server with a custom domain (see tutorial: https://blog.zeruns.com/archives/822.html).

SMTP Configuration

SMTP Setup

5. Persistent Storage

volumes:
  - volume:
      host: /www/dk_project/dk_app/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /www/dk_project/dk_app/discourse/shared/standalone/log/var-log
      guest: /var/log

These map host directories to the container, preserving data during rebuilds. You can manage these folders directly via BaoTa’s File Manager later.

After editing, ​confirm and save​.

Configuration Saved

6. Set Directory Permissions

chmod 700 /www/dk_project/dk_app/discourse/containers

Permissions

Permissions Applied

Begin Installation

Return to your terminal (reconnect via SSH if disconnected). Execute:

cd /www/dk_project/dk_app/discourse
./launcher rebuild app

Installation

Wait for completion (≈10-15 minutes). If successful, no errors appear, and you’ll see the app container running in BaoTa’s Containers panel (the temporary container will disappear after setup).

Note​: For mainland China servers, GitHub access issues may cause failures. Use a proxy for installation, or expect longer download times due to slow GitHub connections.

Installation Progress

Installation Complete


Configure Website & SSL Certificate

In BaoTa Panel, go to ​Docker → Websites → Create → Reverse Proxy Container​.

  • Enter your domain
  • Select container app
  • Choose port 80 (mapped from container)

Reverse Proxy Setup

Click Settings (on the right of your new site) → SSLLet's Encrypt → ​Apply Certificate​.

SSL Certificate

After success, enable "Force HTTPS" and ​Save​.

Force HTTPS

Open your domain in a browser, register as admin, and activate via email (sent to the address configured earlier).

Registration

Activation Email

Admin Activation

Setup Guide

Complete setup by configuring site name, description, and language.

Site Setup

Your forum is now ready! Access the admin panel via the left sidebar to customize settings. For plugins, visit Discourse’s official community.

Admin Panel

If issues arise, ​edit the config file and re-run ./launcher rebuild app .


1
  1. Tipping via Alipay

    qrcode alipay
  2. Tipping via WeChat

    qrcode weixin

Comment Section