Atlantic.Net Blog

How to Install Discourse Forum on Debian 10 with Nginx and Let’s Encrypt

Discourse is open-source forum software written in Ember.js and Ruby on Rails. You can build your own online discussion forums and chat rooms using Discourse. Discourse is mostly used by gamers to create content accessible by the community. It is used by many companies including New Relic, Cloudflare, and Docker to power their communities. Discourse offers a rich set of features including dynamic notifications, infinite scrolling, powerful moderation, spam blocking, two-factor authentication, a comprehensive API, and many more.

In this post, we will explain how to install Discourse Forum with Docker on Debian 10.

Step 1 – Install Docker

By default, the latest version of Docker is not available in the Debian default repository, so you will need to add the Docker official repository to your system.

First, install the required dependencies using the following command:

apt-get update -y
apt-get install git apt-transport-https ca-certificates curl gnupg2 software-properties-common -y

Once all the dependencies are installed, add the Docker CE repository with the following command:

curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"

Once the repository is added, update the repository and install Docker CE with the following command:

apt-get update -y
apt-get install docker-ce -y

Once Docker CE is installed, you can proceed to install Discourse.

Step 2 – Install Discourse

First, create a directory for Discourse and download the latest version of Discourse with the following command:

mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse

Next, change the directory to discourse and start the Discourse installation using the following command:

cd /var/discourse
./discourse-setup

During the installation, you will be asked to provide the Hostname, email, and SMTP details as shown below:

Hostname for your Discourse? [discourse.example.com]: discourse.linuxbuz.com

Checking your domain name . . .
Connection to discourse.linuxbuz.com succeeded.
Email address for admin account(s)? [[email protected],[email protected]]: [email protected]
SMTP server address? [smtp.example.com]: smtp.gmail.com
SMTP port? [587]: 
SMTP user name? [[email protected]]: [email protected]
SMTP password? [pa$$word]: Jethva@1981
notification email address? [[email protected]]: [email protected]
Optional email address for Let's Encrypt warnings? (ENTER to skip) [[email protected]]: [email protected]
Optional Maxmind License key (ENTER to continue without MAXMIND GeoLite2 geolocation database) [1234567890123456]: 

Provide all the details and hit Enter. You should see the following output:

Does this look right?

Hostname          : discourse.linuxbuz.com
Email             : [email protected]
SMTP address      : smtp.gmail.com
SMTP port         : 587
SMTP username     : [email protected]
SMTP password     : Jethva@1981
Notification email: [email protected]
Let's Encrypt : [email protected]
Maxmind license: (unset)

ENTER to continue, 'n' to try again, Ctrl+C to exit: 

Confirm all the information and hit Enter to start the installation. Once the installation has been finished, you should get the following output:

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=discourse.linuxbuz.com -e [email protected] -e DISCOURSE_SMTP_ADDRESS=smtp.gmail.com -e DISCOURSE_SMTP_PORT=587 -e [email protected] -e DISCOURSE_SMTP_PASSWORD=Jethva@1981 -e DISCOURSE_SMTP_DOMAIN=gmail.com -e [email protected] -e [email protected] -h debian10-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:95:89:04:2c:d3 local_discourse/app /sbin/boot
adc3196fb49b6711135c30f88bf6b3f5132e1310e22060f6d907a16ce4e7d963

Step 3 – Access Discourse

Now, open your web browser and access the Discourse web interface using the URL https://discourse.example.com. You should see the following page:

Click on the Register button. You should see the following page:

Provide your email address, username, and password, and click on the Register button. You should see the following page:

You will get an activation email in your mailbox. You can activate your Discourse account by clicking on the activation email.

Conclusion

In the above post, you learned how to install Discourse Forum with Docker on Debian 10. You can implement a Discourse Forum for your organization on your VPS hosting account from Atlantic.Net.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year