Step 1
Step 1 - Install Docker on Ubuntu 16.04
The Discourse software is written in Ruby and Javascript, using PostgreSQL as the main database, and Redis as a cache and for transient data. We will install Discourse under the Docker container.
The installation process will be carried out on Ubuntu 16.04. So to begin with, install Docker using the command below.
wget -qO- https://get.docker.com/ | sh
After the installation is complete, check the docker service and make sure it’s already running on the system.
systemctl status docker
And also make sure that Docker is on the startup boot app.
systemctl is-enabled docker
Step 2 - Install and configure discourse forum
In this step, we will install and configure the Discourse software. We will download the discourse docker-compose script, configure according to our requirement, and then create new Docker container for discourse forum software.
Create new ‘/var/discourse’ directory and clone the installer script.
mkdir -p /var/discourse
git clone GitHub - discourse/discourse_docker: A Docker image for Discourse /var/discourse
Now go to the ‘discourse’ directory and copy sample of the docker-compose file.
cd /var/discourse
cp samples/standalone.yml containers/app.yml
Edit the ‘app.yml’ file using vim editor.
vim containers/app.yml
Configure Docker port mapping
By default, all HTTP and HTTPS requests will be handled by the Docker proxy. And for this guide, we will use Nginx for this purpose - all HTTP and HTTPS will be handled by the Nginx web server.
So we need to change the docker port mapping configuration. The Discourse container will only have the HTTP connection, and the host will be opening new port ‘2045’ and mapping to the container port 80.
Uncomment the HTTPS line and change the HTTP line with new port ‘2045’.
expose:
- “2045:80” # http
- “443:443” # https
Discourse domain name configuration
Type your own domain name for discourse installed on the ‘DISCOURSE_HOSTNAME’ line as below.
DISCOURSE_HOSTNAME: ‘discourse.hakase-labs.me’
And type your email address in the ‘DISCOURSE_DEVELOPER_EMAIL’ line.
DISCOURSE_DEVELOPER_EMAILS: ‘hakase@hakase-labs.me’
SMTP configuration
This is the most important configuration for Discourse Software. Make sure you have the SMTP account for Discourse installation - you can buy or try free-tier SMTP account from Mailgun, Mailjet or SendGrid.
In this tutorial, we will be using the free-tier SMTP account from Mailgun. Uncomment SMTP configuration and type your account as below.
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: postmaster@hakase-labs.me
DISCOURSE_SMTP_PASSWORD: mypassword
Save and exit.
Next, build new Discourse Docker image based on app.yml template configuration.
sudo ./launcher bootstrap app
After that, start/initialize new Discourse container using the command below.
sudo ./launcher start app
The Discourse container should be up and running - check it using docker command.
docker ps -a
Check the host open port using netstat, and make sure new docker-proxy port 2045 is on the list.
Source from: How to Install Discourse Forum with Nginx on Ubuntu 16.04