Discourse Installation Guide

As a containerized software, Discourse is relatively simple to install. However, on servers located in mainland China, installation may get stuck or even fail for various reasons. This topic will explain how to smoothly install Discourse on both servers in mainland China and servers outside mainland China.

Recommended Minimum Server Specifications

CPU: 2 cores
RAM: 4 GB
Available storage: 10 GB+

Once your server is ready, you can begin the installation.

Install Docker

First, you need to install Docker on your system. You can refer to Docker’s official installation tutorial, which supports installation on almost all mainstream operating systems. This guide uses AlmaLinux 9 for demonstration.

For servers in mainland China, use the Tsinghua University mirror for accelerated installation. Instructions are available here:

After Docker is installed, run systemctl enable --now docker to enable auto-start on boot and start Docker.

For servers in mainland China, you need to configure a Docker image accelerator.
Edit the file /etc/docker/daemon.json with vim and add the following content:

{
    "registry-mirrors": [
        "https://docker.1ms.run"
    ]   
}

After saving, run systemctl restart docker to restart Docker.

Prepare the Discourse Installation Environment

  • Valid SMTP email credentials to send admin account activation emails.
  • Your forum domain name must be resolved to your server’s IP address, which is required during installation.
  • Install Git on your server using dnf install git or apt install git.

After preparing the environment, you can proceed to download the Discourse Docker management tool.

sudo -s
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
chmod 700 containers

If your server in mainland China cannot connect to GitHub, you can use any of the following proxy services or your own self-hosted proxy:

Once everything is confirmed correct, you can proceed to install Discourse.

Install Discourse

Run ./discourse-setup to launch the installer.

You will be prompted to enter your forum domain name; enter it and press Enter. The installer will then check your domain’s DNS resolution, and you cannot proceed if the check fails.

If you see the prompt shown above indicating the domain is not correctly resolved, you can manually modify the configuration to install, but this method is outside the scope of this guide. After resolving the DNS issue, re-run ./discourse-setup to launch the installer again.

Next, you will be asked to enter the admin email address, SMTP server, SMTP service port, SMTP username, SMTP password, notification email address, as well as the optional Let’s Encrypt notification email address and Maxmind license. Fill in all information as required.

Finally, a confirmation summary will be displayed. Press Enter to start the installation if all information is correct.

For servers outside mainland China, you only need to wait for the installation to complete. For servers in mainland China, press Ctrl+C to exit the installer and continue with the steps below.

Modifications for Servers in Mainland China

For well-known reasons, you need to modify the configuration file to successfully install Discourse on a server in mainland China. Without this modification, the installation will very likely get stuck at a certain step or even fail entirely.

Open the main configuration file with vim containers/app.yml, and add - "templates/web.china.template.yml" after - "templates/web.template.yml" in the templates section.

After completing this change, save and close the file, then run ./launcher rebuild app to start the installation.
(After applying this optimization, you can directly enter the plugin’s GitHub link when configuring plugins, no need to replace it with a mirrored link.)

Post-Installation Steps

Open your forum domain name in a browser, configure your site information and create an admin account.

Activate your admin account via email and log into the admin dashboard. The installation is now complete; congratulations, you now have your own Discourse forum.

Additional Guides for Reference

3 Likes

Perfect timing to learn how to set up

What specs does this little gadget have? It’s really fast.

2h8g, this program is quite memory-intensive.

I’m using a setup with 2 vCPUs, 4096 MB RAM, 100 GB NVMe, and 5.00 TB transfer, and it feels really good.

Check the website, which region is the server located in?

The website is currently restarting; it is hosted in Japan.

Otaku’s Wonderful House - This is a 2D anime gathering place (justnainai.com)

Looks good. How was the multi-language switch on the header implemented? Is it a plugin?

The frosted glass effect of the top navigation looks good, but the text below is too close to the top navigation bar.

You can use the padding-top code to add some spacing.

Mainly, I feel more comfortable in the shade, so I’m getting things set up in there.

I can’t remember which plugin this is from. Anyway, when you switch while not logged in, the button disappears after you log in.
I didn’t pay much attention to this.

By the way, how do I turn off the summary feature? It’s a bit annoying to receive hundreds of emails every time :downcast_face_with_sweat:

Backend User Preference Settings: Change the summary frequency to Never

1 Like

I see, thank you.

Could you please explain this to me? This keeps happening to me.

Also, I really haven’t been able to find any other tutorials that cover this.

It is recommended that you properly complete the parsing first. If you are sure you want to skip parsing, refer to this article.

It still doesn’t work. This time I chose to directly delete the data and did not install the panel, but it is still the same issue:

Did you run ./discourse-setup --skip-connection-test?

Okay, the domain can now be bound normally, but another error occurred:

ENTER to continue, ‘n’ to try again, Ctrl+C to exit:
letsencrypt.ssl.template.yml enabled

Configuration file at containers/app.yml updated successfully!

DISCOURSE_DEVELOPER_EMAILS left at incorrect default of me@example.com,you@example.com

Sorry, these containers/app.yml settings aren’t valid – can’t continue!
If you have unusual requirements, edit containers/app.yml and then:
./launcher bootstrap app
Which translates to: Sorry, these containers/app.yml settings are invalid - cannot continue!
If you have unusual requirements, edit containers/app.yml, then:
./launcher bootstrap app