Step 1 - Install Docker on Ubuntu 16.04
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 https://github.com/discourse/discourse_docker.git /var/discourse
Now go to the ‘discourse’ directory and copy sample of the docker-compose file.
cp samples/standalone.yml containers/app.yml
Edit the ‘app.yml’ file using vim editor.
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’.
- “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.
And type your email address in the ‘DISCOURSE_DEVELOPER_EMAIL’ line.
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.
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: https://www.howtoforge.com/tutorial/how-to-install-and-configure-discourse-forum-with-nginx-on-ubuntu-1604/