How to install Discourse Forum using Docker on CentOS 8
How to install Discourse Forum using Docker on CentOS 8
Discourse is a free and open source platform built for the next decade of the Internet. It is a modern forum software that can be used as a mailing list, discussion forum, long chat room, etc. It uses Ruby on Rails as the backend, Ember.js as the frontend, PostgreSQL as the data storage, and Redis as the cache server. It is simple, efficient, suitable for mobile devices, customizable, and makes online discussions easy and fun.
In this tutorial, we will show you how to install Discourse forum using Docker on CentOS 8 server.
prerequisites
- Server running CentOS 8.
- A valid domain name pointing to the server IP.
- The root password is configured for the server.
Install Docker
First, you need to install Docker in the server. By default, Docker is not available in the CentOS 8 standard repository. Therefore, you need to add the official Docker repository to your system. You can add it with the following command:
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
After creating the repository, install Docker by running the following command:
dnf install docker-ce --nobest
After installing Docker, start the Docker service and use the following command to start it when the system restarts:
systemctl start dockersystemctl enable docker
You can now verify the Docker version with the following command:
docker --version
You should see the following output:
Docker version 20.10.1, build 831ebea
Install discourse
First, create a directory for Discourse using the following command:
mkdir /opt/discourse
Next, download the latest version of Discourse from the Git repository using the following command:
git clone https://github.com/discourse/discourse_docker.git /opt/discourse
Next, change the directory to Discourse and install Discourse using the following command:
cd /opt/discourse./discourse-setup
You will be asked to provide your FQDN as shown below:
which: no docker.io in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) which: no docker.io in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) Ports 80 and 443 are free for use 'samples/standalone.yml' -> 'containers/app.yml' Found 4GB of memory and 2 physical CPU cores setting db_shared_buffers = 1024MB setting UNICORN_WORKERS = 4 containers/app.yml memory parameters updated. Hostname for your Discourse? [discourse.example.com]: discourse.linuxbuz.com
Provide your valid domain name and press Enter. You will be asked to provide a valid email address and password:
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]: yourpassword Optional email address for Let's Encrypt warnings? (ENTER to skip) [[email protected]]: [email protected] Does this look right?
Provide all the details and press Enter. You will need to verify all settings as follows:
Hostname : discourse.linuxbuz.com Email : [email protected] SMTP address : smtp.gmail.com SMTP port : 587 SMTP username : [email protected] SMTP password : yourpassword Let's Encrypt : [email protected] ENTER to continue, 'n' to try again, Ctrl+C to exit:
If everything is normal, press Enter to start the installation. After the installation is complete, you will 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 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=yourpassword -e [email protected] -h centos8-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:e0:37:60:d3:09 local_discourse/app /sbin/boot ab3bdf3c169d47d9ff06052f48ff078d46393f1152b651b9fd3354594cc38714
Now, you can use the following command to verify that Discourse runs the container:
docker ps
You should see the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ab3bdf3c169d local_discourse/app "/sbin/boot" 22 seconds ago Up 21 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app
Access Discourse Web UI
Now, open your web browser and enter the URL https://discourse.linuxbuz.com. You will be redirected to the “Talk Settings” screen:
Click on register Button. You should see the “Registration” page:
advertising
Provide your email, username, password, and click register Button. You should receive an email to activate your account.
in conclusion
Congratulations! You have successfully installed the Discourse forum software on CentOS 8. Now you can browse Discourse to get more features and deploy it in a production environment. If you have any questions, please feel free to ask me.