Download Attune CE

Install And Configure Discourse Development Environment On Fedora

Exported on 24-Sep-2021 13:40:09

Install Discourse On Fedora Server With AttuneOps

This Blueprint Installs Discourse Forum On A Fedora Server

Discourse is a web application that makes it easy for communities to discuss anything. It takes care of creating a space where people can interact, ask questions and provide answers for one another. And since the app is open-source, you can customize it with your own branding and domain name to match your organization's needs.

Discourse allows you to setup a fully-functional community or forum website in quick and easy way using Docker.

Pre-Blueprint Attune setup
  1. On the Inputs tab, create a Linux node for the host you wish to install the stack on.
  2. On the Inputs tab, create Linux credentials to connect to the host you wish to install the stack on.
Steps Involved
  • Install and configure Docker
  • Clone Discourse project
  • Configure, Build and Run Discourse

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - Install Docker - Fedora

Installs docker, required to run the discourse image

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Update dnf repository
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

# Configure docker repo baseurl
sudo sed -i '3,/baseurl=/c\baseurl=https://download.docker.com/linux/centos/7/$basearch/stable' /etc/yum.repos.d/docker-ce.repo

# Install containerd
sudo dnf -y install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.4.9-3.1.el7.x86_64.rpm


# Install docker cli
sudo dnf -y install docker

2 - Enable Docker Service - Fedora

Starts docker daemon and configures it to launch at startup

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Enable docker
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

3 - Clone Discourse

Downloads the latest release of the Discourse source code

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install git
sudo yum -y install git

# Clone latest release from Discourse github repo
git clone https://github.com/discourse/discourse_docker.git

4 - Upload Discourse Configuration File

Uploads discourse initial configuration file.

Replace following variables with your own, currently we are using a dummy SMTP server credential from Mailjet:

DISCOURSE_HOSTNAME: 'discourse.test' DISCOURSE_DEVELOPER_EMAILS: 'me@example.com,you@example.com'

DISCOURSE_SMTP_ADDRESS: in-v3.mailjet.com DISCOURSE_SMTP_PORT: 587 DISCOURSE_SMTP_USER_NAME: 03114bcb5c42df3c21e42fd0bb27ff95 DISCOURSE_SMTP_PASSWORD: 098f7c25bbea521bc4bbc6ae9d52c591

Login as user on node

Connect via SSH
ssh user@hostname
Deploy archive discourse-app.yml.zip to remote path uploads
  1. Locate Files archive "discourse-app.yml.zip", This can be downloaded from Attune
  2. Copy the Files archive to the server
  3. Extract the root of the Files archive to uploads, relative to the home directory
  4. Check that the files are in the correct location

5 - Configure Discourse and Docker

Places the default configuration file to discourse project location.

Also configures docker cgroup mount location and sets discourse up to run with ""--privileged" flag.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Move config file
sudo mv ~/uploads/discourse-app.yml ~/discourse_docker/containers/app.yml

# Mount cgroup for docker
sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd


# Fix docker permisson issue
sed -i '/user_args=""/c\user_args="--privileged"' ~/discourse_docker/launcher

6 - Build and Run Discourse

Installs screen required to run the build process in background.

Once the build is complete, it launches the Discourse application server. You can see the background process by running: screen -x

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install screen
sudo yum -y install screen

# Enable zombie mode
sudo echo "zombie xy" >> ~/.screenrc

#CD Into discourse directory
cd ~/discourse_docker/

# Create deployment script
echo 'sudo ./launcher rebuild app; sudo ./launcher run app' | sudo tee -a  deploy-discourse.sh

# Creates a fresh Discourse image from the source
screen -d -m  bash deploy-discourse.sh