Setting up a forum with NodeBB

Introduction

This tutorial will explain how to set up NodeBB forum platform with Docker.

Environment

Hardware amd64 VPS
OS Debian 10 Buster

Dependencies

  1. Docker
  2. docker-compose
  3. Internet Domain

Step by Step Instructions

1. Add DNS entry to your domain.

A domain of your choice needs to point to the address of your server.

2. Change to root user

sudo -s

3. Installation of additional Dependencies

apt update
apt install -y certbot nginx

4. Create nodebb user and add persistence

useradd --system --create-home --shell /bin/bash --password <your-password-here> nodebb
mkdir /home/nodebb/data /home/nodebb/files /home/nodebb/config
chown -R nodebb:nodebb /home/nodebb/data /home/nodebb/files /home/nodebb/config

5. Configure NGINX server

Create and open vhost file:

nano /etc/nginx/sites-available/forum.domain.tld.vhost

Paste the following configuration into the file:

server {
  listen 80;
  server_name forum.domain.tld;

  location / {
    proxy_pass http://127.0.0.1:4567;
    proxy_set_header Host      $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-NginX-Proxy true;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

  location ~ /.well-known/acme-challenge/ {
    allow all;
  }
}

Activate vhost file:

ln -s /etc/nginx/sites-available/forum.domain.tld.vhost /etc/nginx/sites-enabled/forum.domain.tld.vhost

Restart NGINX:

systemctl restart nginx

6. Create Let's Encrypt certificate for nextcloud.domain.tld

https://certbot.eff.org/lets-encrypt/debianbuster-nginx

Restart NGINX:

systemctl restart nginx

7. Run server

Create and open docker-compose.yaml:

cd /home/nodebb
nano docker-compose.yaml

Paste the following configuration into the file:

version: '3.3'

services:
  nodebb:
    container_name: nodebb
    image: nilsramsperger/nodebb:v1.13.3
    init: true
    ports:
      - 4567:4567
    volumes:
      - /home/nodebb/data:/var/lib/redis
      - /home/nodebb/files:/opt/nodebb/public/uploads
      - /home/nodebb/config:/etc/nodebb
    environment:
      - 'url=https://forum.domain.tld'
      - 'bcrypt_rounds=16' # set higher for powerful server, lower for tiny servers; min. 12, max. 31 (ultra slow)
    restart: unless-stopped

Run server:

docker-compose up -d

8. Set up server

Visit your website: https://forum.domain.tld

Follow the on-screen instructions.

Do no change any database related settings.

Just enter the Admin's username, password and e-mail address. (E-Mail address does not need to be valid; won't be sent to.)
Then press the launch button and log in with your Admin account.

 

Sources